@staix/agent-hub 0.12.15 → 0.12.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,15 @@ Issue and pull request numbers in the entries for 0.7.7 and earlier refer to the
4
4
 
5
5
  ## Unreleased
6
6
 
7
+ ## 0.12.16
8
+
9
+ - Record source-verification commits for current operating documents and agent notes; fail missing coverage, invalid stamps and README version drift, and report stale source scopes deterministically (#188).
10
+ - Require six sequential guard checks to pass without mutation and fail their named assertion with a seeded regression. Reuse full Linux/macOS plus seeded CI only for an identical release tree (#187).
11
+ - Add a default-off task-idle sweep with persisted escalation steps, real-activity anchors, PII-safe notices, hold/cohort suppression and explicitly opted-in owner reassignment (#186).
12
+ - Preview initialization changes and native launcher arguments through the same builders, without hub writes or native startup; redact arbitrary user values and identify unresolved runtime metadata (#189).
13
+ - Show native Claude/Codex context-window readings with freshness and session identity. Optional pressure checkpoints do not pause quota, reassign work or replace sessions; unknown readings stay unknown and private summaries stay out of cloud memory (#185).
14
+ - Advance the control protocol to 14 for context status metadata while retaining controlled recovery from supported earlier protocols.
15
+
7
16
  ## 0.12.15
8
17
 
9
18
  - Bind Pi tool-step ceiling diagnostics to the trusted producer's session and turn, retain the rejected pre-effect invocation count, and keep the first active failure cause frozen (#179).
package/README.md CHANGED
@@ -4,12 +4,12 @@ Native multi-agent hub for one developer's machine: Claude Code, Codex, Kimi Cod
4
4
  hub-owned local-LLM worker collaborate as peers in independent project directories, with
5
5
  task-aware model routing (Switchyard) in front of a self-hosted gateway (OmniRoute).
6
6
 
7
- Status: 0.12.2, control protocol 11. Durable delivery records distinguish queued
7
+ Status: 0.12.16, control protocol 14. Durable delivery records distinguish queued
8
8
  work from uncertain execution. The [smoke checklist](docs/smoke.md) records
9
9
  verified paths and remaining prerequisites.
10
10
 
11
11
  Read the [operations guide](docs/operations.md) for the daily workflow, queue
12
- reconciliation, and the staged protocol-9/10 to protocol-11 upgrade command.
12
+ reconciliation, and the staged upgrade command for supported source protocols.
13
13
  Controlled recovery preserves work; uncertain effects are never automatically
14
14
  replayed and may require operator review.
15
15
 
@@ -28,7 +28,7 @@ cd <your project> && ahub init && ahub up && ahub tail
28
28
  Or install the same version from GitHub:
29
29
 
30
30
  ```bash
31
- bun add -g github:STAIxBWLB/agent-hub#v0.12.0 && ahub setup
31
+ bun add -g github:STAIxBWLB/agent-hub#v0.12.16 && ahub setup
32
32
  ```
33
33
 
34
34
  The installed commands remain `ahub` and `agent-hub`.
@@ -44,6 +44,19 @@ and agent sessions so both load the update.
44
44
  - [Smoke checklist](docs/smoke.md): the live checks, and what has and has not been verified against real agents
45
45
  - [Changelog](CHANGELOG.md), [Contributing](CONTRIBUTING.md)
46
46
 
47
+ ## What ahub changes on your machine
48
+
49
+ `ahub init --dry-run --json` lists missing project defaults, the managed AGENTS.md
50
+ block, legacy CLAUDE.md cleanup and gitignore updates before writing them.
51
+ The preview does not register the project.
52
+
53
+ `ahub claude|codex|kimi|pi --print-command` (also `--dry-run`) prints the native
54
+ argv, Claude session settings and environment variable names without launching.
55
+ It uses the normal command builders. Arbitrary user arguments, configured commands
56
+ and settings are redacted; runtime-assigned endpoints and session identities are
57
+ explicitly unresolved. It does not check executable or account readiness.
58
+ See [Security notes](docs/security.md).
59
+
47
60
  ## Why not agent-bridge
48
61
 
49
62
  [raysonmeng/agent-bridge](https://github.com/raysonmeng/agent-bridge) proves the
@@ -1,6 +1,6 @@
1
1
  # Budget, pause and handoff
2
2
 
3
- Scope: quota readings, pause, handoff and resume, and the status line tee. Read before editing `src/hub/budget.ts`, `src/cli/statusline-tee.ts`, `src/hub/bus.ts`, `src/hub/delivery-journal.ts` or `src/hub/restart.ts` (pause persistence).
3
+ Scope: quota and native context readings, checkpoints, pause, handoff and resume, and the status line tee. Read before editing `src/hub/budget.ts`, `src/hub/context-window.ts`, `src/cli/statusline-tee.ts`, `src/hub/bus.ts`, `src/hub/delivery-journal.ts` or `src/hub/restart.ts` (pause persistence).
4
4
 
5
5
  - Budget: checkpoint first, pause second (a paused peer receives nothing). A handoff that fails is left unmarked so the next tick or hub run retries it; never record it as done.
6
6
  - A handoff needs somebody to hand over to: `canHandOff` is false right after a restart, when no peer is attached yet, and the handoff waits for a later tick instead of stripping tasks of their owner.
@@ -8,3 +8,7 @@ Scope: quota readings, pause, handoff and resume, and the status line tee. Read
8
8
  - On resume the notice is published before the peer is released, so it leads the first delivery.
9
9
  - The coordinator only lifts its own pauses: `manualPaused` in the daemon keeps a `ahub pause` in place, and `ahub resume` refuses while a budget record is open.
10
10
  - The status line tee must never fail or slow the render: no throw, original command run with the same stdin, 5 s cap.
11
+
12
+ - Keep native context occupancy in `src/hub/context-window.ts` separate from quota accounting; never use Codex's accumulated `total` as occupancy or estimate Pi counters.
13
+ - Context checkpoint completion requires its request id and the current attached peer/native session. Invalidate its transport generation synchronously at a new peer claim, before asynchronous recall or attachment. Never pause, reassign or replace a session on context pressure. Refuse private-turn, PII-pattern and all non-approved associated PII-task summaries (owner or reviewer, including in_review, with the current routing policy) before local persistence or cloud memory; never broadcast checkpoint text.
14
+ - Invalid/stale context readings expose unknown and do not rearm a crossing. Latch a crossing only after its event is accepted; reconsider paused/recovery-held crossings after release with fresh current-session readings. Tee context fields contain finite numeric values or null only, bound to daemon instance, launcher and native session.
@@ -1,6 +1,6 @@
1
1
  # Task board and hub tools
2
2
 
3
- Scope: the task flow, assignment, the state machine and the hub's MCP tools. Read before editing `src/hub/tasks.ts`, `src/hub/board.ts`, `src/hub/routing.ts` or `src/hub/hub-tools.ts`.
3
+ Scope: the task flow, assignment, the state machine and the hub's MCP tools. Read before editing `src/hub/tasks.ts`, `src/hub/board.ts`, `src/hub/routing.ts`, `src/hub/task-sweep.ts` or `src/hub/hub-tools.ts`.
4
4
 
5
5
  - Tool callers are models: MCP `inputSchema` is not enforced on the way in. Normalize at the boundary (`cleanRefs`) before anything reaches the board, and never throw after a board write.
6
6
  - `assign()` never defaults to the task's current owner, or a decline can only come back to the decliner.
@@ -1,7 +1,8 @@
1
1
  # Tests
2
2
 
3
- Scope: tests, fakes and the test gate. Read before adding or changing a test or fake under `test/`, or editing `scripts/check.sh` or `scripts/hang-watch.sh`.
3
+ Scope: tests, fakes and the test gate. Read before adding or changing a test or fake under `test/`, or editing `scripts/check.sh`, `scripts/hang-watch.sh`, `scripts/seeded-check.ts` or `scripts/seeds.json`.
4
4
 
5
5
  - Tests that are not about batching build the bus with `batchMs: 0`; with the default 15 s window a lone status envelope looks like a lost message.
6
6
  - In Bun 1.3.14 a test timeout that fires while `Bun.spawnSync` runs can start the next test inside spawnSync's own event loop, where another spawnSync then spins at full CPU for good (trigger not pinned down; see README). Bun 1.4.2 still runs the next test inside the outer spawnSync's event loop. `scripts/check.sh` runs tests with a 20 s timeout and under `scripts/hang-watch.sh`; a test that spawns and reads the process table gets a timeout of its own.
7
7
  - A child process gets a scrubbed environment, so test knobs for fakes travel in a wrapper script, not in `process.env`.
8
+ - Run `bun scripts/seeded-check.ts` before reporting the seeded-guard gate complete. Keep the six `scripts/seeds.json` cases sequential; require the same named test green before its seeded assertion fails. Seed rot, survivors, setup/compiler failures, timeout/watchdog termination and process leaks fail the gate. Never run the full seed runner from a unit test or mutate the source checkout; inspect preserved failed fixtures before removing them. CI runs this in the required Linux `seeded guards` job after the ordinary check, separately from `scripts/check.sh`.
@@ -1,6 +1,6 @@
1
1
  # Operations guide
2
2
 
3
- This guide describes ahub 0.12.7 and control protocol 13. Live verification
3
+ This guide describes ahub 0.12.16 and control protocol 14. Live verification
4
4
  results and remaining prerequisites are recorded separately in [the smoke ledger](smoke.md).
5
5
 
6
6
  ## Install and start
@@ -27,7 +27,7 @@ what the hub runs, which files it sends as credentials, where task text goes,
27
27
  or how far the local worker's sandbox reaches (`kimi_cmd`, `codex_bin`,
28
28
  `pi.cmd`, `checks`, `mlx.bin`, `mlx.runtimeDir`, `mlx.modelPath`, `omniroute.urls`,
29
29
  `omniroute.access_hosts`, the `omniroute` key files, `memory.worker_url`,
30
- `local.read_allow`, `local.bash_network`, `local.network_allow`, `local.sandbox`) are machine-local:
30
+ `local.read_allow`, `local.bash_network`, `local.network_allow`) are machine-local:
31
31
  they apply only from a file git confirms nobody committed. Put them in
32
32
  `.agenthub/config.local.json` (`ahub init` adds it to `.gitignore`), which is
33
33
  read after `config.json`; outside a git repository they keep their defaults, and
@@ -647,21 +647,21 @@ Rows without a live process are stale registrations; forget them with
647
647
 
648
648
  Upgrade running projects with the target release's own coordinator. It accepts
649
649
  a running source on control protocol 9 (0.6.x), 10 (0.7.0 through 0.12.0),
650
- 11 (0.12.1 and 0.12.2), 12 (0.12.3) or 13 (0.12.4 through 0.12.10) and only
650
+ 11 (0.12.1 and 0.12.2), 12 (0.12.3), 13 (0.12.4 through 0.12.15) or 14 (0.12.16), and only
651
651
  a target on its own protocol, so the target's coordinator fits every supported
652
652
  source and carries every recovery fix released up to it. Protocol 8 and older
653
653
  (0.5.x and earlier) are refused as `manual-bootstrap-required`. Run from the
654
654
  project directory, without replacing the global CLI first:
655
655
 
656
656
  ```bash
657
- bunx --package @staix/agent-hub@0.12.10 ahub upgrade --to 0.12.10 --dry-run
658
- bunx --package @staix/agent-hub@0.12.10 ahub upgrade --to 0.12.10 --yes
657
+ bunx --package @staix/agent-hub@0.12.16 ahub upgrade --to 0.12.16 --dry-run
658
+ bunx --package @staix/agent-hub@0.12.16 ahub upgrade --to 0.12.16 --yes
659
659
  ```
660
660
 
661
661
  | Running now | Coordinator to use |
662
662
  | --- | --- |
663
663
  | 0.6.x (protocol 9) | the target's, through `bunx` as above |
664
- | 0.7.0 through 0.12.0 (protocol 10), 0.12.1 and 0.12.2 (protocol 11), 0.12.3 (protocol 12), 0.12.4 through 0.12.10 (protocol 13) | the target's, through `bunx` as above |
664
+ | 0.7.0 through 0.12.0 (protocol 10), 0.12.1 and 0.12.2 (protocol 11), 0.12.3 (protocol 12), 0.12.4 through 0.12.15 (protocol 13), 0.12.16 (protocol 14) | the target's, through `bunx` as above |
665
665
  | any supported source, with the installed CLI already at the target | `ahub upgrade` below, which is the same coordinator |
666
666
  | 0.5.x or earlier (protocol 8 and older) | not supported: bootstrap by hand with the matching CLI |
667
667
 
@@ -688,19 +688,19 @@ The coordinator verifies and retains the exact target package, preserves its
688
688
  own source, and promotes the global CLI only after restored projects pass
689
689
  readback.
690
690
 
691
- Once the installed CLI is 0.12.0, review the current project or all registered
691
+ Once the installed CLI matches the target release, review the current project or all registered
692
692
  projects first:
693
693
 
694
694
  ```bash
695
695
  ahub restart --dry-run
696
- ahub upgrade --to 0.12.2 --dry-run
696
+ ahub upgrade --to 0.12.16 --dry-run
697
697
  ```
698
698
 
699
699
  Apply only after reviewing the plan:
700
700
 
701
701
  ```bash
702
702
  ahub restart --yes
703
- ahub upgrade --to 0.12.2 --yes
703
+ ahub upgrade --to 0.12.16 --yes
704
704
  ahub recovery status <operation-id>
705
705
  ahub recovery resume <operation-id>
706
706
  ahub recovery abort <operation-id>
@@ -924,3 +924,172 @@ the capability is absent. It never rewrites these settings. Explicit
924
924
  `--backend mlx`, `--model mlx/fast`, and recorded MLX recovery launches are
925
925
  refused before any local startup. Re-enable MLX or explicitly migrate the
926
926
  recorded launch before recovery.
927
+
928
+ ## Task idle sweep
929
+
930
+ The between-turn task sweep (#186) is disabled by default. Set `task_sweep` in
931
+ `.agenthub/config.json` (or its machine-local override) to enable it:
932
+
933
+ ```json
934
+ {
935
+ "task_sweep": {
936
+ "enabled": true,
937
+ "interval_s": 300,
938
+ "unaccepted_min": 60,
939
+ "idle_min": 120,
940
+ "review_min": 120,
941
+ "ladder_min": 30,
942
+ "auto_reassign": false
943
+ }
944
+ }
945
+ ```
946
+
947
+ Booleans must be actual booleans. Each time setting must be a finite number of
948
+ at least 1; timeouts are bounded to the platform timer limit. Each threshold
949
+ measures time since the last real task history event. A ladder record does not
950
+ refresh that activity; a new event resets the ladder even at the same timestamp.
951
+
952
+ The first overdue sweep sends the assigned owner or reviewer one normal task
953
+ reminder. After `ladder_min`, the next sweep notifies the console and available
954
+ planner-role peers. After another interval it reports a reassignment suggestion
955
+ from the ordinary routing function. At most one step runs per task per sweep.
956
+ PII notices contain only the public task stub, never its text, refs or plan.
957
+
958
+ Busy, paused, offline or native-active peers, queued/in-flight deliveries and
959
+ queue holds, unresolved dependencies, completion checks, recovery/shutdown and
960
+ silent turn-free cohorts suppress the sweep. An offline owner remains governed
961
+ by the existing `tasks.release_after_min` policy. Human reviews produce console
962
+ notices. The sweep does not change route-explain output.
963
+
964
+ For Claude, `ahub claude` installs the existing PreToolUse/PostToolUse/Stop
965
+ observation hooks when the sweep is enabled, including in advisory projects.
966
+ The hooks return no facts in advisory mode. A native Stop establishes an idle
967
+ boundary; a subsequent PreToolUse marks activity. A delivery acknowledgement or
968
+ task approval does not establish native idle. Restart the daemon and relaunch
969
+ Claude after enabling the sweep so its session receives the hooks. A caller's
970
+ `--settings` still wins: the launcher warns that native idle observation is off,
971
+ and the sweep cannot verify that Claude session between turns.
972
+
973
+ `auto_reassign: true` explicitly allows an available alternative owner selected
974
+ under the existing routing, role and PII constraints to receive the task at step
975
+ three. Review-pending work always produces only a reviewer suggestion. The
976
+ sweep records no failed-work outcome and never weakens routing constraints.
977
+
978
+ Each ladder step is persisted in task history before publishing. A restart
979
+ therefore does not repeat it. A crash after the history write can leave its
980
+ notice unpublished or uncertain; the history records an attempted step, not a
981
+ receipt. Inspect `ahub task show <id>` and the delivery journal before acting;
982
+ durable-delivery retries remain the journal's responsibility.
983
+
984
+ ## Documentation source verification
985
+
986
+ `docs/verified.json` maps README, the current security, operations and quickstart
987
+ pages, and every agent note to a full source commit and explicit covered paths.
988
+ A stamp records a human check of the cited paths, symbols, numeric limits and
989
+ operational commands. It does not certify live deployment or prove prose
990
+ correctness automatically. Specs, changelogs and the smoke ledger retain their
991
+ own dated evidence and are outside this manifest.
992
+
993
+ `node scripts/check-docs.mjs` also runs in `scripts/check.sh`. Missing manifest
994
+ coverage, unresolved or nonancestor commits, removed source paths and a README
995
+ status version different from `package.json` fail the gate. Source commits since
996
+ a stamp and uncommitted covered changes produce sorted stale notices without
997
+ failing it. Counts are commits touching any covered path, rather than file or
998
+ line counts; an unrelated commit leaves the document fresh. Git history must
999
+ include the stamped ancestors (CI checks out full history).
1000
+
1001
+ During release preparation, source review precedes restamping. Review each stale
1002
+ page against its covered source, correct drift, and use the full SHA of the
1003
+ reviewed source commit as `verifiedAgainst`. Record any deferred page and its
1004
+ specific unverified claims in the release verification report before tagging.
1005
+ Do not advance a stamp solely to clear a notice. Source stamps can name an
1006
+ ancestor: the manifest-only follow-up commit need not hash or stamp itself.
1007
+
1008
+ ## Seeded guard verification
1009
+
1010
+ `bun scripts/seeded-check.ts` runs six guard pairs sequentially: header quoting,
1011
+ Origin refusal, control-token authentication, the hop cap, PII public views and
1012
+ uncertain-delivery receipts. Each named test first passes on current tracked
1013
+ checkout bytes, then must fail an assertion with the corresponding guard weakened.
1014
+ Seed rot (anything other than one exact replacement), a surviving seed and an
1015
+ invalid detection have distinct errors. Compiler, setup, unrelated-test and timeout
1016
+ failures never count as detection.
1017
+
1018
+ Each seed has a private temporary checkout without Git metadata, state, output
1019
+ directories or user untracked files. Installed dependency packages are linked,
1020
+ never copied or installed by the runner. Child tests use private home, temp and
1021
+ registry directories and a scrubbed environment. The normal 20-second test timeout,
1022
+ 60-second hang watchdog and current-invocation process ledger/leak scan apply to
1023
+ both legs. Successful fixtures are removed; a failed pair prints its preserved
1024
+ fixture location with test and leak evidence for inspection.
1025
+
1026
+ The required Linux CI job `seeded guards` follows the ordinary checks; it does not
1027
+ repeat on macOS or run recursively inside `bun test`. The runner reports every
1028
+ pair's elapsed seconds and the total runtime. Runtime measurement remains pending
1029
+ until that gate executes; a green ordinary check alone does not prove these pairs.
1030
+
1031
+ The full CI gate tests the PR head tree on Linux and macOS, followed by the
1032
+ sequential seeded-guard job. Main and release jobs reuse only a successful full
1033
+ PR or push check with the identical Git tree and all three successful jobs. An absent or
1034
+ unreadable result runs the main gate again and refuses release. A manual
1035
+ `prepare_bundle` dispatch builds reviewable plugin assets without publishing;
1036
+ it is never accepted as full-gate evidence.
1037
+
1038
+ ## Preview initialization and native launch
1039
+
1040
+ Run `ahub init --dry-run --json` for action/path/reason metadata, including a
1041
+ managed-block summary. The real init applies the same plan and preserves user text
1042
+ and legacy symlink/hardlink safeguards. Preview creates no files or registration.
1043
+
1044
+ Use `ahub claude --print-command`, `ahub codex --dry-run`,
1045
+ `ahub kimi --model <alias> --print-command`, or
1046
+ `ahub pi --mode tui --print-command` to inspect launch JSON.
1047
+ Environment values and arbitrary supplied values are withheld. Native-assigned
1048
+ proxy/bridge endpoints and new session identity remain unresolved.
1049
+ Claude and Codex previews include conditional `AGENTHUB_INSTANCE_ID` and
1050
+ `AGENTHUB_LAUNCH_ID` environment names with unresolved reasons. Claude's existing
1051
+ daemon identity is read at launch; a launch identity is allocated only after
1052
+ verified Orca terminal readback. Codex identities are injected when that Orca
1053
+ launch record is made. Preview neither reads those runtime identities nor
1054
+ allocates them, and never displays their values. Pi's environment preview
1055
+ continues to describe its native builder output.
1056
+ These previews do not connect to the daemon, toggle permissions, record terminal
1057
+ ownership, bind servers or start agents, sidecars or models.
1058
+
1059
+
1060
+ ## Native context readings and optional checkpoints
1061
+
1062
+ `ahub status`, `ahub tail` and the dashboard show native context occupancy,
1063
+ source and measurement freshness. Claude readings come from the status-line
1064
+ tee installed by `ahub claude`; Codex readings come from its current thread's
1065
+ native token-usage updates. Pi and other unsupported surfaces show unknown.
1066
+ A stale or disconnected reading is unknown, not 0%. Codex's accumulated session
1067
+ usage is never used as context occupancy.
1068
+
1069
+ Context-triggered checkpoints are disabled by default. To enable them, add
1070
+ this to `.agenthub/config.json` and restart the daemon deliberately:
1071
+
1072
+ ```json
1073
+ {"context":{"gate":0.85,"stale_min":30}}
1074
+ ```
1075
+
1076
+ `gate` is a fraction between 0 and 1; 0 disables checkpoint requests.
1077
+ `stale_min` must be positive. A reading at or above the threshold records a metadata-only
1078
+ event and console notice, then asks an attached Claude/Codex with active work
1079
+ for a checkpoint when no checkpoint request is already outstanding. The request
1080
+ supplies a `request_id`; include that id with
1081
+ `hub_checkpoint {summary, request_id}`. Repeated high readings do not repeat
1082
+ it until a fresh below-threshold reading or new session rearms the crossing.
1083
+
1084
+ The resulting non-private note is saved in the state directory as
1085
+ `context-checkpoint-<peer>.json`, mode 0600; saving to shared memory is attempted
1086
+ when memory is enabled. Its body is never broadcast. A private turn, an open PII
1087
+ task held by the peer, or PII-pattern text prevents persistence and sharing.
1088
+ Requests are bound to the current peer, native session and transport generation.
1089
+ A new connection claim invalidates the old request before asynchronous recall or
1090
+ attachment, even with an unchanged native session id. Requests also expire after
1091
+ `budget.checkpoint_timeout_s` (90 seconds by default).
1092
+ Quota pause and task handoff are separate; a context checkpoint neither pauses
1093
+ nor hands work over. Continue normally or deliberately restart into a fresh
1094
+ session with your chosen checkpoint as preface. No automatic restart or native
1095
+ compaction override is performed.
@@ -17,7 +17,7 @@ ahub setup # installs the Claude Code channel plu
17
17
  Or use the matching GitHub release:
18
18
 
19
19
  ```bash
20
- bun add -g github:STAIxBWLB/agent-hub#v0.12.0
20
+ bun add -g github:STAIxBWLB/agent-hub#v0.12.16
21
21
  ahub setup
22
22
  ```
23
23
 
@@ -58,7 +58,7 @@ ahub say @kimi "run the tests and report" # one peer
58
58
 
59
59
  or set `OMNIROUTE_API_KEY`. Name the model in `.agenthub/routing.toml` (`[local] fixed_model`). Then `ahub local`. It works only inside the project, asks before it writes or runs anything (`ahub permit <id> allow`), and everything it executes is sandboxed.
60
60
 
61
- ## The five commands of a working day
61
+ ## Commands of a working day
62
62
 
63
63
  | Command | What for |
64
64
  | --- | --- |
package/docs/security.md CHANGED
@@ -6,12 +6,13 @@ agent-hub connects agents that can each run commands. This page says what the hu
6
6
 
7
7
  - **Other agents' text is untrusted.** Every message that crosses from one peer to another is framed as untrusted input (a channel tag with `meta.source` for Claude, a fixed header line plus a standing instruction for the others). A message body cannot forge the hub's own headers: such lines are quoted (`sanitize`). Replies inherit a hop count capped at 3, so agents cannot ping-pong forever; neither a digest nor a steer can reset it.
8
8
  - **The control link is loopback plus a secret.** The daemon and the Codex proxy bind 127.0.0.1 only. The control WebSocket requires a per-run token (`.agenthub/state/control-token`, mode 600), and both servers refuse any request that carries an `Origin` header: any web page can open a WebSocket to localhost, and browsers always send `Origin`. External clients cannot claim the console user's id or a hub-managed peer's id.
9
- - **Permission prompts stay on.** `ahub claude` and `ahub codex` add nothing that weakens the agents' own prompts. Kimi's and `local`'s permission requests are relayed to the console and cancelled after `approvals.timeout_s` (default 120 s) of silence; the macOS notification for a waiting request carries the peer and the tool name only. The one exception is the hub's own tools (`hub_send` and the task tools, matched by exact name): Kimi's requests for them are approved once without a prompt and logged by name, the same trust Codex gets through `approval_mode` in the hub's config. They touch no file and run no process, and every call passes the hub's own checks. The match relies on the agent putting the tool name in the request's `title`, as Kimi does; an ACP agent that titles calls with model-written text must not be configured as `kimi_cmd`. A payload longer than the console shows is marked as cut and never offers a session-wide grant. `--unattended` turns prompts off, says so loudly, and is never the default.
9
+ - **Permission prompts stay on.** `ahub claude` and `ahub codex` add nothing that weakens the agents' own prompts. Kimi's and `local`'s permission requests are relayed to the console and cancelled after `approvals.timeout_s` (default 120 s) of silence; the macOS notification for a waiting request carries the peer and the tool name only. The one exception is the hub's own tools (`hub_send` and the task tools, matched by exact name): Kimi's requests for them are approved once without a prompt and logged by name, the same trust Codex gets through `approval_mode` in the hub's config. They invoke hub-owned operations rather than arbitrary file or shell tools, and every call passes the hub's own checks. Identity comes from the exact permission title, or from the earlier tool-call title bound to the same call id and resolved against the configured MCP servers when the permission title contains argument JSON (Qwen). Payload text and unrelated display titles never establish identity. A payload longer than the console shows is marked as cut and never offers a session-wide grant. `--unattended` turns prompts off, says so loudly, and is never the default.
10
10
  - **A committed config cannot choose launch commands, credential files, data endpoints or a wider sandbox.** The machine-local fields (`kimi_cmd`, `codex_bin`, `pi.cmd`, `checks`, `mlx.bin`, `mlx.runtimeDir`, `mlx.modelPath`, `omniroute.urls`, `omniroute.access_hosts`, the `omniroute` key files, `memory.worker_url`, `local.read_allow`, `local.bash_network`, `local.network_allow`) apply only from a config file git confirms nobody committed: `.agenthub/config.json` or `.agenthub/config.local.json`, matched by file identity so no other spelling the file system accepts slips past, and `.agenthub` itself not a committed symlink or submodule. Without a repository, or when git fails, they keep their defaults; an empty value always means the default. "Untracked" is answered by the repository that contains the project: a checkout copied or extracted into an unrelated repository, or into an ignored directory of one, is trusted like your own files. So a cloned repository cannot choose a launch command, a completion check, a gateway to send a key file to, a memory endpoint, or a wider sandbox. A command in `checks` runs as you, outside the local worker's sandbox, like a git hook. Nothing in `routing.toml` or in task text is ever run. `routing.toml` and the other shared fields still come from the checkout, and they matter: `routing.toml` picks the models the local worker and the hub's inference use at your gateway and can turn the PII constraint off, and roles and budget shape who does what. Review them in a repository you do not trust.
11
11
  - **Telemetry holds no bodies.** `.agenthub/state/events.jsonl` (issue #40) records envelope ids, routing and sizes, task ids and states, overlapping paths and token counts. It never records a message body, a task title or detail, and marks private (PII) envelopes and tasks as such. It stays on the machine; `ahub export` only prints it.
12
12
  - **Snapshots stay in your repository.** Per-turn snapshots (issue #33) are git objects in the project's own object store, written through a temporary index; nothing is referenced, pushed or copied elsewhere, and `git gc` prunes them. They hold what the work tree held, including untracked files that are not ignored, so keep secrets in ignored files. They carry the repository's own permissions, and nothing caps their disk use but `git gc`. A turn of a peer holding an open PII task is not snapshotted; a PII file left in the project is snapshotted by later turns like any other file. `ahub undo` restores only files whose current content is exactly what the turn left.
13
13
  - **The edit hook reads, never decides.** `ahub check-path --hook` (issue #32) reads hub.db and returns context for Claude and a line for you; it sets no permission decision, so your permission rules stay in charge. It names other owners' task ids, titles and states, which then reach Claude's model; PII tasks are left out.
14
14
  - **The session record holds identities only.** `.agenthub/state/sessions.json` (issue #37, mode 600) keeps each attached peer's recovery metadata: launch options, session and thread ids, Pi's session file path. No message or task text; loss notices name deliveries by id, sender and public task title.
15
+ - **Context checkpoints have a separate text record.** Native occupancy readings carry numeric metadata only. An optional context checkpoint persists its summary in `.agenthub/state/context-checkpoint-<peer>.json` with mode 0600 and attempts shared-memory storage when enabled. Completion requires the outstanding request id, current peer/native session and transport generation; new connection claims invalidate old requests. Private turns, every open PII task associated with the peer as owner or reviewer (including pending review), and PII-pattern summaries are refused before persistence or cloud memory. Its text is never broadcast, and context pressure does not pause, reassign or replace the session.
15
16
  - **The local worker is boxed in.** Paths are resolved through symlinks and must stay inside the project; a secrets denylist (`.env*`, keys, credential files, the hub's own state) applies to its file tools, its git arguments and its memory capture alike; `.git` and `.agenthub` are not writable. Writes, edits, shell commands and mutating git wait for approval, and the approver sees what will be written or run, with control characters escaped. Everything it executes runs under the macOS sandbox, attended or not. Since 0.10 the profile starts from deny default (issue #39): commands run and read only the system, toolchain and project directories (and the project's git dir and the selected developer dir; with network on, the public CA bundles); no writes outside the project, its git dir and a temp dir of its own (`TMPDIR`, made for each command and removed when it ends; issue #63); no `.git/hooks` or `.git/config` writes; no network, loopback included, unless `local.bash_network`; with it, only through the hub's egress proxy to the hosts in `local.network_allow` (issue #65), which refuses names that resolve to internal addresses (behind NAT64 with the well-known prefix, by the IPv4 address the answer carries; a network-specific prefix is not recognised), so claude-mem and the Codex app-server stay out of reach (`"direct"` opens everything, until 0.13.0). One channel stays open: `trustd`, which TLS clients need, can fetch a certificate's AIA or OCSP URL on a command's behalf, outside the proxy. The allow-default profile of 0.9 and earlier was removed in 0.12.0 (issue #83); a `local.sandbox` setting is ignored with a note. The shared temp dirs (the user's and `/private/tmp`) are closed. Without the sandbox there is no `bash` tool.
16
17
  - **Capabilities are enforced, not suggested.** `capabilities` (issue #39) is checked by the daemon where task operations and messages arrive, so a peer cannot get round it by phrasing. A peer can never answer a permission request: the control link takes `permit` from the console role only, and a message that quotes a permit command is just text. Both bind the hub's own tool paths: a vendor agent with its own shell in the project (Codex, Claude, Kimi) can read `.agenthub/state/control-token` and connect as the console, which only the local worker's and Pi's sandbox prevents.
17
18
  - **PII has an enforced path.** A task matching `signals.pii_patterns` goes to `local` or to nobody; its text is absent from other peers' envelopes, the console stream, the log and the board listing; the console user reviews it; `local` answers such a turn to the console only, keeps it out of its history, refuses it when the only gateway is off campus, and may not save notes or spin off tasks during it. Nothing about it is sent to claude-mem, whose observer is a cloud model.
@@ -1242,3 +1242,107 @@ Relay native-session counters and per-dispatch transport usage are separate
1242
1242
  measurements. Request usage and provider availability are optional metadata,
1243
1243
  bound to their own dispatch IDs; provider absence does not change model
1244
1244
  qualification. Primary and fallback dispatches have independent outcomes.
1245
+
1246
+
1247
+ ## Task idle sweep (#186, 2026-10-09)
1248
+
1249
+ `Tasks.sweep(now)` owns a deterministic, default-off between-turn sweep. It
1250
+ classifies proposed tasks with an owner as unaccepted assignments, in-progress
1251
+ tasks with an idle owner as idle-owner findings, and in-review tasks with a
1252
+ reviewer as review-pending findings. Separate minute thresholds and a ladder
1253
+ interval are configured through the strict `task_sweep` config block described
1254
+ in operations. The daemon ticks only an enabled sweep and clears its timer on
1255
+ shutdown. No control message shape changes.
1256
+
1257
+ The activity identity is the last real history entry index, so simultaneous
1258
+ real events are distinct. Typed sweep entries persist finding kind, activity
1259
+ index, step and injected sweep time in the existing hub.db task history. They
1260
+ never reset activity or invalidate a pending completion check. Persisting a
1261
+ step precedes its notice: restart does not repeat the step, but a crash between
1262
+ write and publish can leave the attempted notice unpublished or uncertain.
1263
+ This is not an exactly-once delivery claim.
1264
+
1265
+ The ladder sends one ordinary task reminder to the responsible peer, then
1266
+ notifies the console and available planner-role peers, then suggests an
1267
+ alternative from pure `assign()`. Every notice uses public task titles and
1268
+ numeric task refs only; PII text and task refs/plans are absent from notices and
1269
+ ladder records. Busy/paused/offline/native-active peers, unresolved dependencies,
1270
+ completion checks, queued/in-flight/held deliveries, recovery/shutdown and live
1271
+ silent cohorts suppress the sweep. Human review reminders go to the console.
1272
+
1273
+ The Claude launcher and preview share one native-observation hook selector.
1274
+ Turn-free coordination selects facts observations; an enabled task sweep also
1275
+ selects the existing PreToolUse/PostToolUse/Stop transport in advisory mode.
1276
+ Advisory observations update native turn evidence without enabling facts
1277
+ injection. A delivery receipt or task transition never counts as a native Stop.
1278
+ Explicit caller settings remain authoritative, with a diagnostic that the
1279
+ managed idle observation hooks are disabled for that session.
1280
+
1281
+ Automatic reassignment remains off. Explicit `auto_reassign: true` enables only
1282
+ an owner handover to an available routed alternative through Tasks' existing
1283
+ assignment path; reviewer handovers remain suggestions. No failed-work outcome
1284
+ is inferred from elapsed time. Existing route-explain behavior is unchanged,
1285
+ and offline-owner release and delivery-journal retries remain separate policies.
1286
+
1287
+ ## Initialization and launcher previews (issue #189)
1288
+
1289
+ Initialization provides a read-only action/path/reason plan with managed-block
1290
+ insert/replace/remove metadata. Normal initialization applies the same planner.
1291
+
1292
+ Claude/Codex/Kimi/Pi launcher previews share native command builders with actual
1293
+ launches. Preview exits before project registration, runtime setup or terminal
1294
+ ownership records. JSON contains argv/settings with arbitrary user-supplied
1295
+ values and custom executable overrides redacted, environment names only, and
1296
+ explicit reasons for unresolved native-assigned endpoints/session identities.
1297
+ A preview does not assert runtime, account or executable readiness.
1298
+ Claude/Codex previews report the conditional daemon/Orca launcher identity
1299
+ environment names and unresolved reasons without reading runtime identity,
1300
+ querying Orca, allocating a launch id or exposing values. Existing Pi launch
1301
+ behavior and its builder-derived environment preview remain unchanged.
1302
+
1303
+
1304
+
1305
+ ## Native context telemetry and checkpoints (issue #185)
1306
+
1307
+ Context occupancy is separate from quota and accumulated billable session usage.
1308
+ Claude reports `context_window.used_percentage` and `context_window_size` from
1309
+ its status-line payload. A valid `current_usage` counter tuple is required;
1310
+ null, malformed or missing current usage is unknown, including immediately
1311
+ after compaction. Its input occupancy excludes output and sums input tokens,
1312
+ cache creation and cache reads, matching the [official status-line schema](https://code.claude.com/docs/en/statusline).
1313
+ Codex reports `tokenUsage.last.totalTokens / tokenUsage.modelContextWindow` in
1314
+ `thread/tokenUsage/updated`. The [native protocol](https://github.com/openai/codex/blob/main/codex-rs/app-server-protocol/schema/typescript/v2/ThreadTokenUsage.ts)
1315
+ and [native TUI](https://github.com/openai/codex/blob/main/codex-rs/tui/src/token_usage.rs)
1316
+ distinguish the last active context from the accumulated `total`; the displayed
1317
+ raw occupancy does not apply the TUI's baseline-adjusted remaining percentage.
1318
+ Pi's RPC state exposes no measured native counter. Its extension context API
1319
+ returns an estimate, so Pi and unsupported peers remain unknown here.
1320
+
1321
+ Each reading records source and measurement time. Claude's status-line file is
1322
+ bound to the daemon instance, managed launcher and native session; Codex's
1323
+ notification is fenced by its owning link and native thread. Stale, invalid,
1324
+ disconnected or replaced-session readings expose unknown occupancy, never zero.
1325
+ `context.gate` defaults to 0 (off); `context.stale_min` defaults to 30.
1326
+ A valid above-gate reading emits one metadata-only `context_pressure` event
1327
+ and one crossing notice. Invalid or stale readings do not rearm a crossing;
1328
+ a valid below-gate reading or a new native session does. A crossing held by pause or recovery remains unlatched and is reconsidered after release using only a still-fresh, current-session reading; no new native sample is required.
1329
+
1330
+ Context and quota checkpoints share the same request/wait path. Only one
1331
+ request per peer may wait at a time. Context responses must carry the supplied
1332
+ `request_id` and match the attached peer and native session. Timeout,
1333
+ disconnection, recovery hold, shutdown and session replacement invalidate the
1334
+ request. Context requests leave quota records, task assignments, pause state,
1335
+ native compaction settings and session ownership unchanged.
1336
+
1337
+ A valid non-private context response is saved in the state directory as a
1338
+ 0600 `context-checkpoint-<peer>.json` note. With memory enabled, its text is
1339
+ also saved as a handover note only after the active-turn, task PII and text
1340
+ pattern checks. It is never broadcast to peers or quoted in logs/events.
1341
+ Private turns and all non-approved PII tasks associated with the peer as owner or reviewer, including tasks already in review, block requests and completion. The current routing PII policy is rechecked at both boundaries. The operator chooses
1342
+ whether to continue the native session or restart; this change provides no
1343
+ automatic session replacement. Status, tail and dashboard expose readings with
1344
+ source, measurement time and freshness beside quota information.
1345
+
1346
+ The control contract is protocol 14. Recovery sources 9 through 13 remain
1347
+ supported; protocol 13 identifies releases 0.12.4 through 0.12.15, while
1348
+ 0.12.16 uses protocol 14.