core.config¶
User-level configuration persistence.
Stores editable settings in a TOML file and the immutable install
identity (user_id) in a separate .user_id file so that users
cannot accidentally break label continuity by editing their config.
On first run a unique UUID user_id is generated and written to
.user_id. This stable ID is written into every LabelSpan and
never changes.
UserConfig is a dataclass (UserConfig(data_dir=...)).
The editable username field is a display name that can be changed
freely without affecting label identity or continuity.
Location¶
<data_dir>/config.toml # user-editable settings
<data_dir>/.user_id # stable UUID (auto-generated, do not edit)
<data_dir>/.title_secret # local-only secret for title hashing/sketching
Default: ~/Library/Application Support/taskclf/data/processed/
config.toml schema¶
On first run, if config.toml is missing, taskclf writes a full commented starter file once (see the User config template guide and configs/user_config.template.toml). The file is not regenerated on later startups.
# Canonical template:
# GitHub: https://github.com/fruitiecutiepie/taskclf/blob/master/configs/user_config.template.toml
# Download: https://raw.githubusercontent.com/fruitiecutiepie/taskclf/master/configs/user_config.template.toml
# Guide: https://fruitiecutiepie.github.io/taskclf/guide/config_template/
# --- Identity ---
# Display name in exported labels; cosmetic only (stable identity is in a separate file).
username = "default-user"
# --- Notifications ---
# If false, suppresses tray desktop notifications.
notifications_enabled = true
# If true, notification text hides raw app names (recommended for screen sharing).
privacy_notifications = true
# --- ActivityWatch ---
# Base URL of your ActivityWatch server (typically http://127.0.0.1:5600).
aw_host = "http://localhost:5600"
# How often the tray asks ActivityWatch for the active window (seconds).
poll_seconds = 60
# HTTP timeout for ActivityWatch API calls (seconds).
aw_timeout_seconds = 10
# --- Web UI ---
# TCP port for the embedded labeling dashboard (http://127.0.0.1:this port).
ui_port = 8741
# Auto-dismiss the model suggestion banner after N seconds; 0 keeps it until you act.
suggestion_banner_ttl_seconds = 0
# --- Transitions and gaps ---
# How long a foreground app must stay dominant before a transition is detected.
transition_minutes = 2
# Shorter threshold for lockscreen/idle apps (BreakIdle); often below transition_minutes.
idle_transition_minutes = 1
# Unlabeled minutes before the tray shows gap-fill escalation (orange icon).
gap_fill_escalation_minutes = 480
| Key | Type | Default | Description |
|---|---|---|---|
username |
str |
"default-user" |
Display name in labels (stable UUID is in .user_id) |
notifications_enabled |
bool |
true |
Tray desktop notifications on/off |
privacy_notifications |
bool |
true |
Hide raw app names in notification text |
aw_host |
str |
"http://localhost:5600" |
ActivityWatch server base URL |
poll_seconds |
int |
60 |
Polling interval for the active window (seconds) |
aw_timeout_seconds |
int |
10 |
ActivityWatch HTTP timeout (seconds) |
ui_port |
int |
8741 |
Embedded labeling dashboard TCP port |
suggestion_banner_ttl_seconds |
int |
0 |
Auto-dismiss suggestion banner after N seconds; 0 until user acts |
transition_minutes |
int |
2 |
Dominance time before a transition is detected (minutes) |
idle_transition_minutes |
int |
1 |
Threshold for lockscreen/idle / BreakIdle (minutes) |
gap_fill_escalation_minutes |
int |
480 |
Unlabeled time before gap-fill escalation (minutes) |
The user_id UUID is stored separately in .user_id and never appears in config.toml.
The title-featurization secret is stored separately in .title_secret and is intentionally omitted from config.toml, REST payloads, and UserConfig.as_dict().
Backward compatibility¶
On startup, if config.json exists but config.toml does not, the JSON
file is automatically migrated: settings go to config.toml, user_id
goes to .user_id, and the original is renamed to config.json.bak.
If old code wrote user_id into config.toml, it is automatically
moved to .user_id and removed from the TOML file.
Legacy title_salt values are also migrated out of config.toml into
.title_secret. UserConfig.title_salt remains as a read-only
compatibility alias for code paths that still expect that name.
CLI usage¶
Set display name at tray launch (persisted for future runs):
REST API¶
| Method | Endpoint | Description |
|---|---|---|
GET |
/api/config/user |
Read user_id, username, and suggestion_banner_ttl_seconds |
PUT |
/api/config/user |
Update username and/or suggestion_banner_ttl_seconds |
GET /api/config/user¶
Returns:
{
"user_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"username": "alice",
"suggestion_banner_ttl_seconds": 0
}
PUT /api/config/user¶
Body (user_id is ignored -- it is immutable):
Returns the full updated config.
Python usage¶
from taskclf.core.config import UserConfig
cfg = UserConfig("data/processed")
cfg.user_id # stable UUID (read-only, from .user_id)
cfg.username # "default-user"
cfg.username = "alice" # persists immediately to config.toml
cfg.as_dict() # {"user_id": "...", "username": "alice", ...}
taskclf.core.config
¶
User-level configuration persistence.
Stores editable settings in config.toml and the immutable install
identity (user_id) in a separate .user_id file so that users
cannot accidentally break label continuity by editing their config.
Typical locations::
data/processed/config.toml # user-editable settings
data/processed/.user_id # stable UUID, never shown in config
Usage::
from taskclf.core.config import UserConfig
cfg = UserConfig(data_dir)
cfg.user_id # stable UUID, auto-generated on first run
cfg.username # editable display name (defaults to "default-user")
cfg.username = "alice" # persists immediately
cfg.as_dict()
UserConfigField
dataclass
¶
One user-editable key in config.toml with default and comment.
Source code in src/taskclf/core/config.py
UserConfig
dataclass
¶
Read/write access to config.toml and .user_id in a data directory.
The immutable user_id lives in a separate .user_id file so
it never appears in the user-editable config. On first run a random
UUID is generated and written there.
username is a free-form display name that can be changed at any
time without affecting label continuity.
On first run, if config.toml is missing, a full commented starter
template is written once. Existing files are not regenerated on later
loads.
Mutations from update() or property setters persist immediately.
config.toml uses # comments above each known setting.
Source code in src/taskclf/core/config.py
187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 | |
user_id
property
¶
Stable UUID assigned to this install. Never changes.
title_secret
property
¶
Stable per-install secret used for privacy-preserving title featurization.
title_salt
property
¶
Backward-compatible alias for the local title secret.
update(patch)
¶
Merge patch into the config and persist. Returns the full config.
user_id is ignored in patch — it is immutable after creation.
Source code in src/taskclf/core/config.py
default_starter_config_dict()
¶
render_default_user_config_toml()
¶
Return the full commented default config.toml text (for docs and templates).