Each line of event.env is an independent rule: ["msg" if ] <check> <op> <thr>. Check runs on every pass; first numeric output compared float-safe; op is the rightmost 'op threshold' pair so checks with their own >/< parse fine. Alerts once on false->true + one recovery message on true->false (no repeats while the condition holds); per-rule state keyed by rule-line hash in ~/.local/share/linux_post_install/eventer/state/. Subcommands: run (timer entrypoint), config (interactive add/remove/edit with check-validation), list (rules + live values), enable [interval] (systemd user timer pos-event-trigger.timer; 5m..weekly or OnCalendar; graceful without a user manager, loginctl enable-linger attempt), disable, status. --dry-run honors the DEV.md convention. Alerts via lib/notify.sh (Telegram default). New: bin/pos-system-event-trigger, lib/eventer-lib.sh, config/event.env template (no-clobber via postinstall), install.sh lib install, INTERACTIVE_CMDS entry. Docs: POS.md system row, HOWTO.md index, howto/event-trigger.md. make gen && make check green; functional tests cover trigger/recovery/no-repeat, float+unit parsing, editor add/remove/edit + validation + dry-run, timer enable/disable/status, dispatcher routing.
16 KiB
AGENT_TODO — Worklist & Idea Backlog
Living list of what we are doing, what is next, and what we might do later.
Deep history lives in git: git log --follow AGENT_TODO.md, git blame, and
the individual feature commits — the Done section below is just a readable
summary (newest last).
Conventions
- Now — items actively being worked on this session (only a few).
- Next — queued, well-scoped items.
- Later — idea backlog. Ideas marked NOT NOW were evaluated and rejected for the stated reason; revisit only if circumstances change.
- When a task is completed: move it from Now/Next into Done (dated one-line) in the same commit that finishes the work.
Done
-
2026-08-09 — New
pos system event-trigger— state-based threshold rule monitors (eventer). Each line of~/.config/linux_post_install/event.envis an independent rule:["<msg>" if ] <check-command> <op> <threshold>(op> < >= <= == !=, unit suffix ok60c/80%). The check command is run on every pass and its first numeric output compared float-safe; operator detected as the rightmostop thresholdpair so checks containing their own>/<(awk, redirection) parse fine. Alerts once on false→true plus one recovery message on true→false (no repeats while a condition holds); per-rule state in~/.local/share/linux_post_install/eventer/state/keyed by rule-line hash (editing a rule resets its state). Subcommands:run(timer entrypoint),config(interactive add/remove/edit with validation by test-running the check),list(rules + live values),enable [interval](systemd user timerpos-event-trigger.timer+ oneshot service;5m…weeklyorOnCalendar=…; graceful warnings when no user systemd manager,loginctl enable-lingerattempt),disable,status.--dry-runhonors the DEV.md dry-run convention. Alerts vialib/notify.sh(Telegram default; other platforms viaNOTIFY_PLATFORM). New:bin/pos-system-event-trigger,lib/eventer-lib.sh,config/event.envtemplate (installed no-clobber by postinstall),lib/eventer-lib.shinstalled by install.sh,system-event-triggeradded toINTERACTIVE_CMDS, usage EXAMPLES row. Docs: POS.md system row, HOWTO.md index row, howto/event-trigger.md;make gen && make checkgreen; functional tests covered trigger/recovery/no-repeat, float + unit parsing, editor add/remove/edit + validation + dry-run, timer enable/disable/status (graceful), dispatcher routing. -
2026-08-09 —
pos media mp3/mp4hardened + smart format selection. Both tools: yt-dlp calls go throughspawn(honor$DRY_RUN;--dry-runprints the exact command and skips dep checks),-o/--output,--no-playlist,--cookies(file existence check), clean ffmpeg/yt-dlp guards,# POS_FLAGS:for completion, full metadata (--embed-metadata --embed-chapters --embed-thumbnail --no-overwrites, mp3 also--convert-thumbnails jpg+--parse-metadata "%(artist,uploader)s:%(artist)s"so the uploader fills the artist tag). mp3 gains--by-artist(~/Music/<artist>/<title>.mp3). mp4 gains-f <id>/--best/--worst(no prompt), conflict validation, and an interactive picker that shows a curated-Ftable ([audio]/[video]/[combo]grouping, raw clutter dropped) on stderr — stdout carries only the chosen id (ui_pick lesson) — with id validation against the real table and empty/best default. Docs: howto/media.md rewritten (flags, metadata, by-artist, troubleshooting);make gen && make checkgreen. -
2026-08-09 — Telegram
ai …now answers about a message you reply to: the listener extractsreply_to_message.text(falls back tocaption) from each update and passes it tohandle_message; the AI bridge prefixes the prompt with[Reply context — the message you are replying to]. So replying to a/statusoutput and askingai check this detailsgives the model the actual output. Applies only to the AI bridge (mapped/commandsuntouched); reply context rides in the user turn so the session records what was analyzed. Docs: howto/ai.md bridge section. -
2026-08-09 —
pos ai geminisessions + Telegram-friendly replies.--session <name>givesask/chatpersistent memory (~/.local/share/linux_post_install/ai/<name>.json, capped at 40 turns, pruning keeps the first user turn as scene); newsessionssubcommand (list /reset <name>). Telegram listener now keeps one session per chat (telegram-<chat_id>) withai /resetto clear. New--system "<text>"flag injects a GeminisystemInstruction(viajqmerge) sent every turn but never stored in the session file; the listener passes a Telegram-voice prompt ("reply like a friendly Telegram chat, use emojis") and strips markdown (**,*, backticks,#, links, lists, blockquotes) from replies beforesendMessage, since messages go out as plain text. Docs: howto/ai.md (flags, sessions, bridge memory/formatting),make gen && make checkgreen. -
2026-08-09 — Fixed
pos configsecret-value corruption:cfg_read_secret's cursor-advanceechowent to stdout and, since the function is called via$(...), a leading\nended up inside every secret value → the env file gotAI_GEMINI_API_KEY="\n<key>", unreadable bycfg_value/load_config(menu showed(not set),pos ai geminidemanded a key). The newline now goes to the terminal (echo >&2). Defense in depth:cfg_write/write_config_keystrip CR and truncate multi-line pastes (warn),cfg_valueand the ai/telegramload_configs strip CR on read. Verified on a real PTY (piped tests couldn't reproduce — non-TTY stdin skips the echo path). -
2026-08-09 —
aicategory —pos ai gemini(ask/chat/models) via Google Gemini REST API.askprints only the answer (pipe/script/Telegram-friendly),chatis a multi-turn REPL (q/quit/Ctrl+C,/reset, empty input re-prompts),modelslists generateContent-capable ids and flags the default;--modeloverride; defaultgemini-2.5-flash. Config scopeai(AI_GEMINI_API_KEYsecret +AI_GEMINI_MODEL) in~/.config/linux_post_install/ai.env, edited viapos config ai;config/ai.envtemplate installed no-clobber by postinstall;ai-geminiadded toINTERACTIVE_CMDS. Telegram listener now answers non-command messages starting withaiviapos ai gemini ask(owner chat only; error replies carry thepos config aihint) — future intents (reminders) slot in as more case arms inhandle_message. Docs: POS.mdaisection + listener bridge, howto/ai.md, HOWTO/README index rows,bin/posusage example. -
2026-08-09 — Entertainment plugins
gold+weathernow emit emoji-visualized Telegram messages. Gold: headline is USD/gram (XAU/oz ÷ 31.1034768), ounce as reference, bid/ask, cleaned timestamp (+00:00/fractional seconds stripped). Weather: per-WMO-code emoji (☀️/🌙 day-night aware for clear sky), °C + feels-like, humidity, wind with unit spacing. Both verified live; emojis are safe in the default plain send mode. -
2026-08-09 —
pos tree: prints the liveposcommand tree (categories → commands → subcommands) by deriving the hierarchy frombin/pos-*filenames +# POS:/# POS_SUBCMDS:headers, so it always matches what the dispatcher can run. Category-less likepos-config;--depth Nlimit;pos help treeworks. Docs: POS.mdtreesection,bin/posusage example,make genregenerated the AGENT_Context tree/dispatch/filetable +_pos_flags[tree]. -
2026-08-09 — Telegram sender
config/config setremoved — redundant withpos config telegram(same# POS_CONFIG:registry, masked token display + input, chat-id validation, chmod 600); sender/listener error hints now point there. Deep-review bugfixes in the same commit: mapped/commandvalues containing|are no longer truncated (load_mapswitched from a|to a\x1fdelimiter — previously/up=echo hi | headsilently ranecho hi);pos entertainment send <plugin> [args…]actually forwards the extra args (every arg wasshifted in the flag loop, so$@was empty) and passes--before the message so leading--plugin output isn't parsed as an option;write_config_key(entertainment-lib) andcfg_write(config-ui) replaced unescapedsed -i "s|^K=.*|K=\"$v\"|"with grep-v+append so values with&/|/\no longer mangle (also the path all telegram config now flows through);sync_systemddaemon-reloads after removing timer units;digitsconfig validation accepts negative group/supergroup chat ids (-100…). -
2026-08-09 — Fixed telegram listener editor crash on remove/edit/test:
ui_pickprinted its menu listing to stdout, soidx="$(ui_pick)"captured the menu and the number, andMAP_CMDS[$idx](arithmetic array subscript) blew up with "syntax error in expression". Menu decoration now goes to stderr; only the picked index is emitted on stdout. Pre-existing bug (before the::descwork), exposed by the description column. -
2026-08-09 — Telegram listener pushes its mapped
/commandsto the bot's/menu viasetMyCommands(auto after every map edit, on--enable, and at daemon start; manual--sync-commandsflag). Map lines may carry a menu description:/cmd::short description=bash command(falls back to the bash command, ~40 chars). Names are validated against Telegram's lowercase[a-z0-9_]rule — invalid ones are skipped from the menu with a warning but still resolve when typed; empty map clears the menu. Fixed latent bugs found by the sync work:map_has(awkEND{exit 1}overrode the match), andwarn()went to stdout so it leaked into the generated JSON (now stderr). -
2026-08-09 —
pos config <TAB>scope completion is now cached at gen time (_pos_config_scopesarray emitted bymake genfrom the# POS_CONFIG:registry) instead of scanning ~40 tools per TAB — a per-keypress subshell storm that wedged interactive shells for minutes on the loaded homelab box. Two stuck-bashsessions (69%/38% CPU) killed.plugin_marker/plugin_keyshardened with|| truesoconfig_keysno longer aborts mid-scan underset -euo pipefailon mixed lib/plugin dirs (installed layout) — fixes missing plugin keys inpos config entertainment. -
2026-08-09 —
pos config <scope>interactive config editor: reads the# POS_CONFIG:registry across tools into a single runtime config (~/.config/linux_post_install/*.env, one file per scope, chmod 600); secret masking with show/hide toggle,digits:/num:/url:validation,-to clear, blank keeps;*pluginsmarker expands plugin vars (entertainment) fromentertainment-lib.sh;desc::examplevalue-format hints shown in the editor; gen-docs now handles category-less tools (pos-config), fixed aset -e+pipefailbug that truncated the header registry. -
2026-08-09 —
pos-communication-telegram→pos-communication-telegram-sender: one canonicalsend(dropped the legacy--sendflag, which duplicated thesendsubcommand in completion).pos communication telegram <TAB>now completes to justsender listener.lib/notify.shmaps platformtelegram→telegram-sendervianotify_sender_name(); entertainment-send + health--sendcheck updated. Removed phantom subcommands from howto/communication.md (webhook/logs/broadcast/file never existed). -
2026-08-09 — Structure/convention audit fix:
--dry-runnow truly dry (spawn()honorsDRY_RUN, install.sh exports it to child phases, postinstall mutations run-wrapped);gen-docs.shno longer chmods regenerated files to 0600;make checknow syntax-checks apps/entertainment/features/templates;.gitignoreprotectsconfig/authorized_keys+config/rclone.conf; honest--sendconfirmation; docs refreshed (notify.sh in lib lists, pos-health systemd units, tsui, scripts/, INTERACTIVE_CMDS). -
2026-08-07 —
pos system health --sendnotification-only; listener@quietprefix (run mapped command without replying, for commands that self-notify)./status=@quiet pos system health --send= exactly one digest.
Now
- (none — Tier 1 shipped:
pos system health,lib/notify.sh, digest timer)
Next
- Wire alerting into more tools as they are added (default: source
lib/notify.sh, callnotify_sendon success/failure).
Later — idea backlog
- Tier 2: watch plugins —
pos system watch <event>: poll conditions and alert on change (public IP changed, disk > 90%, backup skipped, fail2ban spike). Reusesnotify_send+ a systemd timer per watch. - Tier 2:
pos healthextras — temperature/fan/load average thresholds,ss -tlnport checks for known services, SMART status for disks. - Tier 3: backup rotation + remote target — keep-N rotations, upload to
rclone remote after verify,
--remoteflag, digest reports rotation age. - Tier 3:
pos secretvault — gpg/age-encrypted key-value store; backend for future tools that need stored tokens. - Tier 3:
pos inventory— machine manifest (OS, packages, services, mounted disks, USB devices) exportable as markdown/JSON. - Tier 4:
pos self update— pull repo,make gen && make check, re-run install.sh to refresh/usr/local/bin. - Tier 4:
pos new— scaffold a new tool fromtemplates/pos-tool.sh(category, name, POS header, exec bit, doc stubs). - NOT NOW: per-category
bin/subdirectories — flatbin/+ filename dispatch scales fine; revisit only ifbin/passes ~40 files. - NOT NOW: split
lib/entertainment-lib.sh— fine under 600 lines; revisit if it grows.
Done (summary, newest last)
- 2026-08-06: Fix entertainment timer
1hnot firing —interval_to_oncalendaremitted invalidOnCalendar=*-*-* */N:00:00(systemd rejects*/Nin the hour field); now*-*-* 00/N:00:00. Dropped the cron fallback entirely: scheduling is systemd user timers only (sync_cron/interval_to_cron/cron_blockremoved),statussimplified,Ndintervals rejected with a clear error. - 2026-08-06: Nested
possubcommands —# POS_SUBCMDS:header annotation (telegram, docker-compose, docker-vbox) +make genemits a_pos_subcmdscompletion map; nested tools (telegram listener) auto-list under their parent instead of as a flat sibling (telegram-listener) inpos <category>and tab-completion; generic tool-level completion (subcommands + flags +--help). - 2026-08-06: Telegram listener —
pos communication telegram listener: interactive/command→ bash map editor + owner-only polling daemon as a systemd user service (map in~/.config/linux_post_install/telegram_commands.env, re-read per message;/help, unknown-command reply, 60s timeout, stdout reply). - 2026-08-06: NFS in
pos system—pos system nfs-server(status/share/ unshare/list/reload/enable/disable, idempotent /etc/exports edits, generic default with Tailscale/WireGuard/LAN examples) +pos system nfs-client(mount/unmount/list + persistent mounts as systemd.mountunits ordered after network-online.target, no fstab);nfs-kernel-server+nfs-commonadded to preinstall PACKAGES. - 2026-08-06:
posHOW-TO guide set —DOC/HOWTO.mdindex + per-categoryDOC/howto/*.md(network, docker, media, system, ssh, usb, communication, entertainment) with flags, recipes, config, and troubleshooting; wired into DOC/README, root README, AGENTS.md. - 2026-08-06: Multi-platform alerting —
lib/notify.shroutes viaNOTIFY_PLATFORM(notify.env, default telegram; sender contract for Matrix/Synapse later),system.envshared config for health/backup, dynamic effective values in--help, telegram--markdownalias. - 2026-08-06: Tier 1 —
pos system health(dashboard +--send),lib/notify.sh(wired into backup + firewall), daily digest timer via postinstall. - 2026-08-06: Document Map index + Entertainment section in AGENT_Context (
cf36780). - 2026-08-06: Entertainment module — plugins (weather/joke/gold),
pos entertainment config/enable/disable/send/status, auto-trigger + Telegram send. - 2026-08-05:
pos communication telegram—--parse-mode(plain/markdown/html). - 2026-08-05: doc/code sync gate —
make gen+make check+ pre-commit hook. - 2026-08-05:
pos usb server— USB Redirector control tool (494eae2). - 2026-08-05:
pos <category> --helpauto-discovery in the dispatcher. - 2026-08-05: AGENTS.md with lazy-loaded DOC references.