@staix/agent-hub 0.46.1 → 0.48.0

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.
Files changed (139) hide show
  1. package/CHANGELOG.md +85 -0
  2. package/README.md +12 -6
  3. package/docs/adding-an-ai-tool.md +20 -4
  4. package/docs/agent-notes/adapters.md +3 -3
  5. package/docs/agent-notes/benchmarks.md +7 -1
  6. package/docs/agent-notes/daemon.md +5 -4
  7. package/docs/agent-notes/tasks.md +4 -2
  8. package/docs/agent-notes/tests.md +3 -0
  9. package/docs/contracts/companion-cli-v1.json +3 -0
  10. package/docs/data-policy.md +9 -0
  11. package/docs/design/adapters.md +14 -0
  12. package/docs/design/cli-output-inventory.md +362 -0
  13. package/docs/design/cli-output.md +42 -1
  14. package/docs/design/execution-reference.md +5 -2
  15. package/docs/design/guidance-probes.md +14 -2
  16. package/docs/design/refusal-inventory.md +26 -0
  17. package/docs/design/roadmap.md +4 -0
  18. package/docs/design/task-board.md +17 -1
  19. package/docs/dogfood.md +27 -11
  20. package/docs/events.md +9 -0
  21. package/docs/friction.md +46 -0
  22. package/docs/memory.md +35 -3
  23. package/docs/operations.md +95 -16
  24. package/docs/profiles.md +1 -0
  25. package/docs/quickstart.md +14 -2
  26. package/docs/roles.md +6 -0
  27. package/docs/sdlc.md +44 -1
  28. package/docs/security.md +29 -12
  29. package/docs/specs/2026-09-19-agent-hub-design.md +17 -0
  30. package/docs/specs/2026-09-19-multi-project-design.md +7 -1
  31. package/docs/verification/2026-11-25-agy-1.5.16.md +31 -0
  32. package/docs/verification/2026-11-25-claude-implementer-2.1.332.md +47 -0
  33. package/docs/verification/2026-11-25-codex-0172-reviewer-isolation.md +47 -0
  34. package/docs/verification/2026-11-25-kimi-272-reviewer-compat.md +38 -0
  35. package/docs/verification/2026-11-25-kimi-tui-272.md +14 -0
  36. package/docs/verification/2026-11-25-pi-160-compat.md +40 -0
  37. package/docs/verification/2026-11-26-0.47.0.md +43 -0
  38. package/docs/verification/2026-11-26-0.48.0.md +45 -0
  39. package/docs/verification/2026-11-26-codex-0172-reviewer-tool-call.md +29 -0
  40. package/docs/verification/dogfood/2026-11-24.md +2829 -0
  41. package/docs/verification/pi-160-model-free.ts +57 -0
  42. package/docs/verification/pi-160-native.mjs +21 -0
  43. package/docs/verified.json +44 -32
  44. package/package.json +2 -2
  45. package/plugins/agent-hub/.claude-plugin/plugin.json +1 -1
  46. package/plugins/agent-hub/kimi-hook.js +598 -131
  47. package/plugins/agent-hub/server.js +687 -143
  48. package/src/adapters/acp.ts +5 -0
  49. package/src/adapters/channel-peer.ts +7 -0
  50. package/src/adapters/claude-print-child.ts +27 -5
  51. package/src/adapters/codex-appserver.ts +9 -0
  52. package/src/adapters/compat.ts +12 -11
  53. package/src/adapters/configured-acp.ts +45 -2
  54. package/src/adapters/configured-print.ts +163 -0
  55. package/src/adapters/conformance/index.ts +1 -0
  56. package/src/adapters/conformance/print.ts +57 -0
  57. package/src/adapters/definitions/native-activity.ts +57 -0
  58. package/src/adapters/definitions/native-factories.ts +4 -2
  59. package/src/adapters/jcode.ts +10 -2
  60. package/src/adapters/local-probe.ts +59 -14
  61. package/src/adapters/local-worker.ts +20 -6
  62. package/src/adapters/registry-types.ts +5 -3
  63. package/src/adapters/role-eligibility.ts +5 -0
  64. package/src/cli/bench.ts +2 -1
  65. package/src/cli/broker.ts +2 -1
  66. package/src/cli/capabilities-output.ts +10 -14
  67. package/src/cli/configured-acp-entry.ts +10 -2
  68. package/src/cli/console-state.ts +25 -5
  69. package/src/cli/error-format.ts +2 -0
  70. package/src/cli/guidance.ts +1 -1
  71. package/src/cli/handoff-output.ts +20 -17
  72. package/src/cli/help.ts +79 -41
  73. package/src/cli/init-settings.ts +15 -0
  74. package/src/cli/intake-output.ts +13 -13
  75. package/src/cli/launch.ts +3 -2
  76. package/src/cli/learn-output.ts +40 -21
  77. package/src/cli/main.ts +150 -79
  78. package/src/cli/memory.ts +47 -2
  79. package/src/cli/output.ts +54 -31
  80. package/src/cli/roadmap.ts +2 -2
  81. package/src/cli/room-output.ts +71 -0
  82. package/src/cli/room.ts +19 -33
  83. package/src/cli/schedule-output.ts +20 -19
  84. package/src/cli/sdlc-output.ts +188 -170
  85. package/src/cli/source-output.ts +17 -14
  86. package/src/cli/specs.ts +13 -13
  87. package/src/cli/study-output.ts +66 -69
  88. package/src/cli/task-output.ts +106 -158
  89. package/src/cli/terminal-recovery.ts +2 -1
  90. package/src/cli/upgrade-runtime.ts +2 -1
  91. package/src/cli/warn-line.ts +18 -0
  92. package/src/cli/worktrees-output.ts +25 -23
  93. package/src/hub/audit-source.ts +45 -0
  94. package/src/hub/board.ts +141 -5
  95. package/src/hub/bus.ts +13 -2
  96. package/src/hub/config-apply.ts +14 -1
  97. package/src/hub/config-trust.ts +1 -0
  98. package/src/hub/control-client.ts +1 -1
  99. package/src/hub/daemon.ts +390 -47
  100. package/src/hub/guidance-probe-store.ts +51 -10
  101. package/src/hub/guidance-probes.ts +25 -7
  102. package/src/hub/handoff.ts +5 -1
  103. package/src/hub/hub-tools.ts +23 -5
  104. package/src/hub/instance-config.ts +3 -3
  105. package/src/hub/learn-followup.ts +103 -0
  106. package/src/hub/learning.ts +63 -1
  107. package/src/hub/manager.ts +15 -1
  108. package/src/hub/memory-policy.ts +2 -1
  109. package/src/hub/memory-review.ts +217 -0
  110. package/src/hub/peer-activity.ts +37 -0
  111. package/src/hub/peers.ts +3 -0
  112. package/src/hub/project-move.ts +258 -0
  113. package/src/hub/registry.ts +16 -5
  114. package/src/hub/restart.ts +7 -0
  115. package/src/hub/review-brief.ts +8 -4
  116. package/src/hub/review-checkout.ts +26 -0
  117. package/src/hub/review-findings.ts +6 -3
  118. package/src/hub/risk-tier.ts +129 -0
  119. package/src/hub/roadmap-check.ts +1 -0
  120. package/src/hub/routing.ts +3 -1
  121. package/src/hub/sdlc-merge.ts +9 -0
  122. package/src/hub/sdlc-metrics.ts +24 -1
  123. package/src/hub/sdlc-queue.ts +1 -1
  124. package/src/hub/sdlc.ts +15 -6
  125. package/src/hub/settings.ts +2 -0
  126. package/src/hub/spec-readback.ts +136 -0
  127. package/src/hub/specs.ts +1 -1
  128. package/src/hub/task-list-page.ts +1 -1
  129. package/src/hub/tasks.ts +586 -80
  130. package/src/hub/ui.ts +4 -2
  131. package/src/local/probe-types.ts +1 -0
  132. package/src/local/probe-workspace.ts +49 -0
  133. package/src/omniroute/client.ts +19 -3
  134. package/src/ui/guidance-panel.ts +2 -2
  135. package/src/ui/guidance-view.ts +4 -2
  136. package/src/ui/index.html +26 -2
  137. package/src/ui/overview-model.ts +138 -0
  138. package/src/ui/plugin.ts +30 -4
  139. package/templates/roles/ops/project-manager.md +1 -1
package/src/cli/help.ts CHANGED
@@ -8,11 +8,11 @@ export interface HelpEntry { section: string; usage: string; description: string
8
8
 
9
9
  /** #1405: one source for the probe usage, read by `ahub help` and by the refusal of a malformed probe command. */
10
10
  export const GUIDANCE_PROBE_USAGE = {
11
- register: "register --file JSON [--json]",
12
- start: "start --id HASH --revision N [--variant G1-HASH] [--json]",
13
- show: "show --id HASH [--json]",
14
- receipts: "receipts --id HASH [--json]",
15
- cancel: "cancel --id HASH --revision N [--json]",
11
+ register: "register --file <json> [--json]",
12
+ start: "start --id <hash> --revision <n> [--variant <variant-id>] [--json]",
13
+ show: "show --id <hash> [--json]",
14
+ receipts: "receipts --id <hash> [--json]",
15
+ cancel: "cancel --id <hash> --revision <n> [--json]",
16
16
  } as const;
17
17
  /** What to print when `ahub guidance probe ...` did not parse: the typed subcommand's own usage, or all five for an unknown one. */
18
18
  export function guidanceProbeUsage(args: readonly string[]): string {
@@ -28,6 +28,7 @@ const SECTIONS: [string, [usage: string, description: string][]][] = [
28
28
  ["ahub worktrees [--json] | tidy [--json] | tidy --confirm <fingerprint> [--json]", "list live and settled worktrees; preview what is safe to remove; `--confirm` (the person only) runs git worktree remove and git branch -d, never forced"],
29
29
  ["ahub --project <path|id> <command>", "select a repository or worktree explicitly"],
30
30
  ["ahub projects [--json] [--full] [--color=auto|always|never]", "list registered projects and live status"],
31
+ ["ahub projects move <old-id|old-root> <new-root> [--state <dir>] [--confirm <fingerprint>]", "re-key a moved project after previewing; stop all affected hubs first"],
31
32
  ["ahub projects remove <id>", "forget a stopped registration (keeps project files)"],
32
33
  ["ahub setup [--yes] [--agents <a,b>] [--research|--no-research] [--undo]", "install or update the channel plugin and project-neutral hook in Claude configuration homes in use, preserving unrelated profile settings, ask once which agents ahub up starts (--agents answers it, --yes keeps the current choice or claude,codex, no terminal keeps the default), save the research default only with explicit --research/--no-research (ordinary setup leaves it unchanged), install the hub's own skills in every other agent host installed here (Codex, Kimi, Qwen, Jcode, Pi, agy; each tree carries a .ahub-skill.json marker and a tree the hub did not write unmodified is reported and left alone), register the acon console plugin (console/plugins/ahub.json in the hub home, read at acon's next start), then run doctor; --undo removes only the hub's own unmodified skill trees and asks once unless --yes is given"],
33
34
  ["ahub init [--profile dev|research|writing|general|<pack>] [--agents <a,b,...|none>] [--sdlc off|advise|enforce] [--required-checks <a,b,...>] [--coordination advisory|turn-free] [--memory|--no-memory] [--research|--no-research] [--snapshots|--no-snapshots] [--pi|--no-pi] [--specs|--no-specs] [--spec-review off|report|require] [--conductor <peer>|none] [--planner <a,b,...>] [--reviewer <a,b,...>|person] [--track-config|--no-track-config] [--no-jcode-home] [--autonomy inherit|off] [--shadow] [--release-guard] [--yes] [--dry-run --json]", "preview or write .agenthub/config.json and the AGENTS.md marker block (drops a legacy CLAUDE.md block); a pack is a shipped one (writing-pack, analysis, ops) or a project file .agenthub/roles/<name>.pack.json; a new project inherits a trusted machine autonomy default and the agent set chosen at ahub setup (start.agents) into config.local.json. Settings flags (#1065): --agents sets start.agents (none starts no agent), --research/--no-research sets research.enabled (new project default: the trusted setup choice, else off) and --autonomy off skips the autonomy inheritance, all in config.local.json; --sdlc sets sdlc.toml mode (off writes no file on a new project); advise/enforce discovers required checks from CI or literal workflow job names; --required-checks overrides discovery, and enforce without names refuses before writes; --coordination, --memory, --snapshots and --pi set their keys in config.json. On an existing project only a flag you give changes anything, and --dry-run shows each change as old -> new (--dry-run --json adds a settings array); a value equal to the current one is a no-op, an invalid value is refused with the allowed ones and nothing is written. --specs/--no-specs and --spec-review set the design-specs keys (and the AGENTS.md specs block). --track-config keeps .agenthub/config.json, routing.toml and sdlc.toml visible to git (a rule that ignores one is named and nothing is written; a routing.toml that names a machine endpoint stays ignored) and lists them to commit; --no-track-config ignores them; either sets the AGENTS.md role sentence, and neither keeps what git and the block say today. A person at a terminal who runs ahub init on a new project with no flag that sets anything and no --yes is asked each setting in turn with its default in brackets (Enter keeps it, a wrong answer asks again, and a third wrong answer ends init with nothing written), sees the plan and answers y/N; N, Ctrl-C and Ctrl-D write nothing. A peer, a live test, a pipe and --dry-run are never asked, and --yes takes the defaults. Success prints next steps to commit shared init changes, start with ahub up or ahub claude and, for advise/enforce, accept specs/departures and use guarded merge. --conductor, --planner and --reviewer (#1408) choose who conducts, plans and reviews, each on its own: the shared config.json roles are written as an explicit list for every peer whose roles change (the one that loses a role too), implementer and verifier are untouched, a peer that cannot hold the role (a headless conductor, a kind that cannot plan) is refused before any write with the reason and the eligible peers, --conductor none leaves the person conducting from ahub console and --reviewer person sends reviews to the person; Executables, secrets, models and permissions stay file edits"],
@@ -57,9 +58,11 @@ const SECTIONS: [string, [usage: string, description: string][]][] = [
57
58
  ["ahub sdlc configure [--mode off|advise] [--required-checks names] [--json] [--color=auto|always|never]", "save only lifecycle mode/check names through loader validation and backup, pending restart (person or current unique conductor on the person's explicit instruction in its own session; enforce and other fields remain person-only; no release consent)"],
58
59
  ["ahub sdlc release-guard -- <literal git push|gh release create|npm publish argv>", "read-only authorization preflight; init --release-guard installs the tag pre-push hook"],
59
60
  ["ahub sdlc release-guard-hook <remote-name> <remote-url>", "internal pre-push readback; validates version tags and forwards exact stdin on success"],
60
- ["ahub sdlc accept <task> --issue <n> [--repo owner/repo]", "accept the task's spec issue at its current body; build entry needs it in enforce (person only)"],
61
+ ["ahub sdlc accept <task> --issue <n> [--repo owner/repo]", "accept the task's spec issue at its current body; prints the read-back state first and proceeds in every state; build entry needs it in enforce (person only)"],
62
+ ["ahub sdlc readback start <task> [--json] [--color=auto|always|never]", "person or current conductor: ask one reviewer-role peer that did not propose the task to state the spec issue back; one request per body edit time, and no eligible reader writes nothing"],
63
+ ["ahub sdlc readback show <task> [--json] [--color=auto|always|never]", "read the reader's report, the paths the issue names that are missing from the default branch head, or the pending request"],
61
64
  ["ahub sdlc accept-departure <task> <head> <reason...>", "accept current plan departures on that exact PR head (person only)"],
62
- ["ahub sdlc plan-review <task> <revision> <reason...> [--review full|delta|none --reviewers N] [--ci full|focused|reuse]", "record planner review, scope and host-read issue metadata"],
65
+ ["ahub sdlc plan-review <task> <revision> <reason...> [--review full|delta|none --reviewers <n>] [--ci full|focused|reuse]", "record planner review, scope and host-read issue metadata"],
63
66
  ["ahub sdlc train report|configure|cut <release-id> [revision] [json]", "plan a release and freeze its approved scope after resource/quota admission"],
64
67
  ["ahub sdlc release-assign <task> <revision> <release-id|none> <reason...>", "assign approved/in-flight work without changing execution"],
65
68
  ["ahub sdlc costs [owner/repo] [--json] [--color=auto|always|never]", "read bounded planner cost metrics for linked merged PRs"],
@@ -114,7 +117,7 @@ const SECTIONS: [string, [usage: string, description: string][]][] = [
114
117
  ["ahub title <peer> <text...>", "person only: replace a Pi or local-worker session title; native-title peers rename in their own UI"],
115
118
  ["ahub queue list [--peer <id>] [--all] [--json] [--full] [--color=auto|always|never]", "inspect durable deliveries; open to any agent as public queue metadata, held bodies stay with the person or conductor; rows a resolution already settled (a retried parent, a discarded or completed row) are hidden and counted on stderr, --all shows them"],
116
119
  ["ahub queue show <delivery-id> [--json] [--color=auto|always|never]", "person or configured conductor: inspect one delivery and revision; agent output uses the public view"],
117
- ["ahub queue resolve <delivery-id> --action completed|retry|discard --reason <text> [--revision N] [--json] [--color=auto|always|never]", "person or configured conductor: resolve a queued or needs_review delivery; --revision binds the displayed row instead of a fresh show; a queued delivery can be discarded while its peer is busy, and a refusal names its cause"],
120
+ ["ahub queue resolve <delivery-id> --action completed|retry|discard --reason <text> [--revision <n>] [--json] [--color=auto|always|never]", "person or configured conductor: resolve a queued or needs_review delivery; --revision binds the displayed row instead of a fresh show; a queued delivery can be discarded while its peer is busy, and a refusal names its cause"],
118
121
  ["ahub queue discard --peer <id> --reason <text> [--state queued|needs_review|failed] [--yes] [--json]", "person or configured conductor: without --yes count one peer's deliveries; with --yes discard them all with the reason, one recorded discard each. With no --state it takes the peer's queued and unsettled failed deliveries (a failed row a resolution already settled is left alone); --state names exactly one kind, needs_review only that way; other peers' queues are untouched"],
119
122
  ]],
120
123
  ["Tasks and review", [
@@ -147,7 +150,7 @@ const SECTIONS: [string, [usage: string, description: string][]][] = [
147
150
  ["ahub schedule list | run <id> | pause <id> | resume <id> [--json] [--color=auto|always|never]", "list is person only; run, pause and resume are the person's or the configured conductor's: the machine-local schedules (`schedules` in .agenthub/config.local.json); list shows each one's next run, run proposes one now through the same hold, open-task and PII path as the timer and restarts its period, pause stops the timer proposing it without counting a skip, resume starts a fresh period so a pause is never replayed as a run"],
148
151
  ["ahub intake \"<text>\" [--source <id>...] | approve <id> | discard <id> [--json] [--color=auto|always|never]", "person only, except approve (person or configured conductor): turn a plain request into a draft backlog card that nothing offers or pulls until you approve it; the configured planner is asked to split it with hub_backlog_split, or the hub model proposes the split (a PII request only on an on-prem model, never to a planner); each --source must be a registered src: id; approve clears the draft on it and its parts, discard cancels them through task cancel"],
149
152
  ["ahub capabilities [--json] [--color=auto|always|never]", "person only, never a conductor or an agent shell: list the skills and commands each attached peer offers (Kimi 2.3.2 and Qwen 0.26.1 sessions, Codex 0.166.0 skills; other versions list nothing), whether you share each one, its digest and the class a call would count as; sharing is invocation.share in .agenthub/config.local.json, this machine only; it only lists and never calls anything"],
150
- ["ahub learn list [--all] | accept <id> | reject <id> [--json] [--color=auto|always|never]", "person only, never a conductor or an agent shell: review a recurring-unmet-criterion candidate the hub filed (#514a); accept writes its one review checklist line, added to your current checklist, to .agenthub/config.local.json through the settings writer (this machine only, never a tracked file, ahub settings undo puts it back, applies after a restart) and closes the card; reject only closes it"],
153
+ ["ahub learn list [--all] [--accepted] | accept <id> | reject <id> [--json] [--color=auto|always|never]", "person only, never a conductor or an agent shell: review a recurring-unmet-criterion candidate the hub filed (#514a) or a followed checklist line; accept writes its one review checklist line, added to your current checklist, to .agenthub/config.local.json through the settings writer (this machine only, never a tracked file, ahub settings undo puts it back, applies after a restart) and closes the card, or on a removal card takes just that line out again; reject only closes it; list --all includes decided candidates, and list --accepted shows each followed line, its status since acceptance and the checklist size"],
151
154
  ["ahub study draft <parent> <contract.json> | revise <id> <revision> <contract.json> | approve <id> <revision> | close <id> <revision> --reason <text> | approve-protocol <hash> [--json] [--color=auto|always|never]", "person only: store a research campaign contract as a draft, revise it, approve it (the only step that creates the unit tasks and lets work start) or close it; approve-protocol binds approval to the exact protocol and evaluator hashes; a planner drafts through hub_study_draft and hub_study_revise and can never approve"],
152
155
  ["ahub study evidence <ev-id> [--revision <n>] | evidence --task <task> | check <task> <manifest.json> [--json] [--color=auto|always|never]", "explicit evidence provenance and offline synthesis readiness: single-link reads reuse research scope/privacy; task inventory and check are person-only. Complete claim/link inventories and registered deliverable hashes bind the manifest. Separate citation, locator, person judgment, contradiction and artifact statuses never certify truth; a non-ready check exits nonzero"],
153
156
  ["ahub study show [<id> | --after <id>] [--json] [--color=auto|always|never]", "read-only for anyone: list this project's research campaigns, 50 per page (the page names the --after cursor that continues it), or one campaign's coverage per unit, handoff state, budget support and why dispatch is held; a private campaign, task or source shows ids, counts and states only"],
@@ -155,10 +158,10 @@ const SECTIONS: [string, [usage: string, description: string][]][] = [
155
158
  ["ahub deliverables [--task <id>] [--approved] [--check] [--json] [--color=auto|always|never]", "what each task delivered and a reviewer approved, by id, hash and size (a path only where the PII screen allows); --check measures the files now and marks one changed since review; an agent sees only the tasks hub_task_show shows it"],
156
159
  ["ahub task show <id> [--json] [--full] [--color=auto|always|never] | escalate <id>", "full task with history (the person sees PII text, an agent the public view) / hand it to the next peer in escalate_to (person or configured conductor)"],
157
160
  ["ahub task role <id> <role|none>", "the person, or an agent on a task it owns: change bounded catalog guidance on an open task; routing and authority are unchanged"],
158
- ["ahub task assign <id> <peer> [--role owner|reviewer|planner] [--revision N]", "name the owner (default), reviewer or person-only planner; a task that still waits reserves its owner; a peer that cannot take it is refused with the reason; --revision refuses stale console actions"],
159
- ["ahub task unassign <id> [--role owner|reviewer] [--revision N]", "person or configured conductor: remove the owner/reservation or reviewer without routing a replacement or stopping native work; preserves the actual actor"],
161
+ ["ahub task assign <id> <peer> [--role owner|reviewer|planner] [--revision <n>]", "name the owner (default), reviewer or person-only planner; a task that still waits reserves its owner; a peer that cannot take it is refused with the reason; --revision refuses stale console actions"],
162
+ ["ahub task unassign <id> [--role owner|reviewer] [--revision <n>]", "person or configured conductor: remove the owner/reservation or reviewer without routing a replacement or stopping native work; preserves the actual actor"],
160
163
  ["ahub task claim <id> <slot> <supported|unsupported|unclear> [--model <label>] [--model-said <supported|unsupported|unclear>] [--manifest <manifest.json> --disposition <resolved|qualified>]", "person only: record your verdict on one declared plan claim (by its 1-based slot, never its text), with optional model agreement metadata; paired manifest/disposition fields bind an adjudicated or explicitly qualified research conclusion to the exact synthesis manifest; a later verdict for the slot replaces the earlier one"],
161
- ["ahub task cancel <id> --reason <text> [--superseded-by <ref>] [--revision N] [--json] [--color=auto|always|never]", "the person, or an agent on its own task as hub_task_cancel allows: close obsolete work with a reason; retain its history without stopping native work or releasing dependents; eligibility follows the task-board policy"],
164
+ ["ahub task cancel <id> --reason <text> [--superseded-by <ref>] [--revision <n>] [--json] [--color=auto|always|never]", "the person, or an agent on its own task as hub_task_cancel allows: close obsolete work with a reason; retain its history without stopping native work or releasing dependents; eligibility follows the task-board policy"],
162
165
  ["ahub task label <id> ok|regressed|reverted|incomplete|wrong|abandoned [--created <time>]", "your later verdict on an approved task, kept in the research records (research must be on); an agent labels only a task it owns, and its record names it; --created is the person's"],
163
166
  ["ahub review <id> approved|changes_requested [note...] [--unmet <item>]... [--head <sha>] [--findings <json>] [--security-pass <json>]", "give a review verdict on a task; the person can do the same in ahub console: Tasks, select the task, r, then a (approve) or c (request changes, with a note)"],
164
167
  ["ahub review brief <id>", "print the review brief of a task's commit: reviewable and excluded files, rules, coverage to account for"],
@@ -175,14 +178,14 @@ const SECTIONS: [string, [usage: string, description: string][]][] = [
175
178
  ["ahub budget execution configure <config.json> [--reason <text>] | disable <id> [--json] [--color=auto|always|never]", "opt-in limits on model calls, tool calls, time and tokens for pi and local; an optional reason is kept with the person and the time"],
176
179
  ]],
177
180
  ["History and reports", [
178
- [`ahub guidance probe ${Object.values(GUIDANCE_PROBE_USAGE).join(" | ")}`, "person or configured conductor only: bounded T1 declaration and fake-only probe lifecycle; receipts reads the sealed receipts, the outcome denominator and the comparability reasons, read-only; production execution is unavailable"],
179
- ["ahub guidance create --file JSON [--json]", "record a bounded immutable advisory proposal through current task authority; no activation or probe"],
180
- ["ahub guidance list --task N --task-created MS [--cursor TOKEN] [--json]", "bounded guidance metadata pages; withdrawn history and withheld fields remain explicit"],
181
- ["ahub guidance show --task N --task-created MS --id HASH [--json]", "screened editable-section diff selected by existing variant id, never a displayed experiment label"],
182
- ["ahub guidance withdraw --task N --task-created MS --revision R --id HASH [--json]", "one-way withdrawal using current task flow; retained history never becomes active guidance"],
183
- ["ahub lineage show (--task N | --attempt ra-id | --root JSON [--task-scope N --task-created MS]) [--cursor TOKEN] [--nodes N --edges N --bytes N] [--json]", "bounded execution metadata and explicit evidence strengths; unavailable stays unknown, with no probes or replay"],
184
- ["ahub lineage link --task N --task-created MS --revision N --ref JSON [--from JSON] [--json]", "register a declared metadata link through the task's current authority and revision; no producer attestation"],
185
- ["ahub turns [peer] [--limit N] [--json] [--color=auto|always|never]", "recent turns and the files each changed (a git work tree only)"],
181
+ [`ahub guidance probe ${Object.values(GUIDANCE_PROBE_USAGE).join(" | ")}`, "person or configured conductor only: bounded T1 declaration and probe lifecycle; receipts reads the sealed receipts, the outcome denominator and the comparability reasons, read-only; live execution only for the id the hub was started with in AGENTHUB_LIVE_GUIDANCE_PROBE_ID, started by the conductor"],
182
+ ["ahub guidance create --file <json> [--json]", "record a bounded immutable advisory proposal through current task authority; no activation or probe"],
183
+ ["ahub guidance list --task <n> --task-created <ms> [--cursor <token>] [--json]", "bounded guidance metadata pages; withdrawn history and withheld fields remain explicit"],
184
+ ["ahub guidance show --task <n> --task-created <ms> --id <hash> [--json]", "screened editable-section diff selected by existing variant id, never a displayed experiment label"],
185
+ ["ahub guidance withdraw --task <n> --task-created <ms> --revision <r> --id <hash> [--json]", "one-way withdrawal using current task flow; retained history never becomes active guidance"],
186
+ ["ahub lineage show (--task <n> | --attempt <ra-id> | --root <json> [--task-scope <n> --task-created <ms>]) [--cursor <token>] [--nodes <n> --edges <n> --bytes <n>] [--json]", "bounded execution metadata and explicit evidence strengths; unavailable stays unknown, with no probes or replay"],
187
+ ["ahub lineage link --task <n> --task-created <ms> --revision <n> --ref <json> [--from <json>] [--json]", "register a declared metadata link through the task's current authority and revision; no producer attestation"],
188
+ ["ahub turns [peer] [--limit <n>] [--json] [--color=auto|always|never]", "recent turns and the files each changed (a git work tree only)"],
186
189
  ["ahub undo <turn> [--yes] [--context]", "put back the files a turn changed; refuses files changed since. Without --yes it only lists them; --context also drops a Codex turn from its conversation"],
187
190
  ["ahub report [--since 7d|<iso>] [--by task] [--json] [--color=auto|always|never]", "turns, tokens, messages, overlaps and task events per period"],
188
191
  ["ahub report --dogfood [--since 7d|<iso>] [--json]", "read-only scorecard: flow, quality, cost, delivery, performance and adoption; missing evidence is unknown"],
@@ -194,20 +197,21 @@ const SECTIONS: [string, [usage: string, description: string][]][] = [
194
197
  ["ahub research addons [--since 30d] [--all] [--json]", "approved tasks with each add-on (claude-mem, ponytail, ripwire, ...) on against off, with intervals; association, not cause"],
195
198
  ["ahub research export [--format jsonl|csv | --dataset <dir>] [--since 30d] [--all]", "the research records for outside analysis: ids, counts and tokens, never text; --dataset writes per-project tasks.jsonl, manifest.json and quality.json (family names only, with each field's unknown count, quota gaps and token attribution share) to a directory in your home outside every project"],
196
199
  ["ahub research backfill", "build this project's research records once from events.jsonl (person or configured conductor)"],
197
- ["ahub bench run <suite.json> --arm <label> [--repeat N] [--tasks a,b] [--addon <name>=on|off]... [--memory off|claude-mem|native|both]", "run a benchmark suite against the peers attached here, in a project kept for benchmarks (it resets the work tree; person or configured conductor); --addon and --memory declare the arm's add-on and memory state and refuse a setup that differs"],
200
+ ["ahub bench run <suite.json> --arm <label> [--repeat <n>] [--tasks a,b] [--addon <name>=on|off]... [--memory off|claude-mem|native|both]", "run a benchmark suite against the peers attached here, in a project kept for benchmarks (it resets the work tree; person or configured conductor); --addon and --memory declare the arm's add-on and memory state and refuse a setup that differs"],
198
201
  ["ahub bench list|status [--json]", "benchmark runs on this machine / the one running now"],
199
202
  ["ahub bench report <run> [--json]", "pass rate, first pass, rework, tokens and wall time per task and overall"],
200
203
  ["ahub bench compare <run|arm>... [--suite <name>] [--mixed] [--json]", "compare arms of one suite with 95% bootstrap intervals; inconclusive below 5 counted attempts per arm"],
201
204
  ["ahub bench export [--format jsonl|csv]", "benchmark records for outside analysis: ids, outcomes and counts, never suite text"],
202
205
  ["ahub check-path <file> [--peer <id>]", "other owners' open tasks that claim or changed a file"],
203
- ["ahub memory [list] [--tier short|long] [--kind <kind>] [--peer <p>] [--machine <id>] [--since <iso>] [--limit N] [--json]", "the hub's own memory for this project: decisions, contracts, fails and findings, short- and long-term (docs/memory.md)"],
206
+ ["ahub memory [list] [--tier short|long] [--kind <kind>] [--peer <p>] [--machine <id>] [--since <iso>] [--limit <n>] [--json]", "the hub's own memory for this project: decisions, contracts, fails and findings, short- and long-term (docs/memory.md)"],
204
207
  ["ahub memory search <words> [--ungrouped] | show <id> | graph <id|node> [--hops 1|2] [--history | --as-of <iso>] [--json]", "find entries, read one with its provenance, or list its graph neighbourhood; search groups visible hits by task unless --ungrouped; superseded and expired entries are hidden unless a person asks for --history or --as-of"],
205
208
  ["ahub memory promote|demote|forget <id> | supersede <old> <new> | rebuild", "change memory: move an entry between tiers, forget it, mark it superseded, or rebuild the index from the logs; an agent shell's change is recorded as that agent"],
206
209
  ["ahub memory sync [--remote <private git url>] | machine [--label <name>]", "sync hub memory with your other machines through a private git remote, or show or name this machine"],
207
- ["ahub memory import claude-mem [--db <path>] [--limit N] [--restart] | dedupe [--apply] | suggestions | confirm|reject <id>", "copy the hub's notes from claude-mem into hub memory; review the model's suggested edges (confirm and reject are a person's)"],
208
- ["ahub memory decay [--days N] [--json]", "list long-term entries older than N days (default 90) that no open goal links; review only, nothing is changed"],
210
+ ["ahub memory import claude-mem [--db <path>] [--limit <n>] [--restart] | dedupe [--apply] | suggestions | confirm|reject <id>", "copy the hub's notes from claude-mem into hub memory; review the model's suggested edges (confirm and reject are a person's)"],
211
+ ["ahub memory decay [--days <n>] [--json]", "list long-term entries older than N days (default 90) that no open goal links; review only, nothing is changed"],
209
212
  ["ahub memory declined [--json]", "list declined physical outbound row ids and safe rule labels; never shows row text; reports incomplete scans explicitly"],
210
213
  ["ahub memory profile-check [--json]", "read-only check of the running hubs' memory bindings against their memory profiles; exits 1 when one is not ready"],
214
+ ["ahub memory review on|off|status [--json]", "the person's switch for the scheduled memory review: on needs both token caps in memory.review, off stops the schedule at once and cancels the review card a run left open; status shows the period, the caps and the next run"],
211
215
  ["ahub goal [list] [--all] | show <id> [--json]", "long-term tasks: state, which machine holds each and until when, linked board tasks"],
212
216
  ["ahub goal new <title> [--milestone <text>]... [--depends <id>]... [--shared] | link <id> <task> | state <id> <state> | done <id> | take <id> [--force]", "a person's changes to long-term tasks (link also the configured conductor's); take --force voids other machines' claims"],
213
217
  ]],
@@ -244,7 +248,7 @@ export function helpCommands(entry: HelpEntry): string[] {
244
248
 
245
249
 
246
250
  /**
247
- * CLI output standard v1, Help: the overview lists each command once per group as ` <name> <one-line summary>` in two aligned columns; the long text, every usage form
251
+ * CLI output standard v1, Help: the overview lists each command once as ` <name> <one-line summary>` in two aligned columns; the long text, every usage form
248
252
  * and every flag are in `ahub help <command>`. A summary is at most SUMMARY_MAX cells. A command not named here (the native agents, whose text comes from their
249
253
  * adapter definitions, never from a table that names a peer) takes the first clause of its description. `<group>/<command>` wins over `<command>` where one name
250
254
  * means two things (`backlog`, `check-path`).
@@ -291,12 +295,11 @@ function firstClause(description: string, max: number): string {
291
295
  /** One overview row: the command words an entry documents (`pause|resume`), and its one-line summary. */
292
296
  export interface OverviewRow { section: string; name: string; summary: string }
293
297
  export function helpOverviewRows(entries: readonly HelpEntry[] = HELP): OverviewRow[] {
294
- const shown = new Map<string, Set<string>>(), rows: OverviewRow[] = [];
298
+ const shown = new Set<string>(), rows: OverviewRow[] = [];
295
299
  for (const entry of entries) {
296
- const seen = shown.get(entry.section) ?? shown.set(entry.section, new Set()).get(entry.section)!;
297
- const fresh = helpCommands(entry).filter(word => !seen.has(word));
300
+ const fresh = helpCommands(entry).filter(word => !shown.has(word));
298
301
  if (!fresh.length) continue;
299
- fresh.forEach(word => seen.add(word));
302
+ fresh.forEach(word => shown.add(word));
300
303
  const own = (word: string) => SUMMARIES[`${entry.section}/${word}`] ?? SUMMARIES[word];
301
304
  const summary = own(fresh[0]!) ?? entry.summary ?? firstClause(entry.description, SUMMARY_MAX);
302
305
  rows.push({ section: entry.section, name: fresh.join("|").replace(/^version\|--version$/, "version|--version"), summary: Bun.stringWidth(summary) > SUMMARY_MAX ? firstClause(summary, SUMMARY_MAX) : summary });
@@ -313,10 +316,11 @@ export const EXAMPLES: Readonly<Record<string, readonly string[]>> = {
313
316
  specs: ["ahub specs check --require-fresh", "ahub specs covers src/cli/help.ts"], worktrees: ["ahub worktrees tidy"], "--project": ["ahub --project ../other-repo status"],
314
317
  projects: ["ahub projects --json"], "--live-test": ["ahub --live-test status"], setup: ["ahub setup --agents claude,codex"], init: ["ahub init --profile dev --sdlc advise --dry-run --json"],
315
318
  instructed: ["ahub instructed run", "ahub instructed run task assign 12 claude"],
316
- help: ["ahub help task"], completion: ["ahub completion zsh"],
319
+ help: ["ahub help task"], version: ["ahub version"], "--version": ["ahub --version"], completion: ["ahub completion zsh"],
317
320
  up: ["ahub up --no-console"], console: ["ahub console --panels"], pet: ["ahub pet --short"],
318
321
  sdlc: ["ahub sdlc status 12", "ahub sdlc explain 12 --json"], backlog: ["ahub backlog list --full", "ahub backlog return 12 3 waiting on a spec"],
319
322
  status: ["ahub status --verbose"], logs: ["ahub logs -f"], doctor: ["ahub doctor --json"], agents: ["ahub agents --json"],
323
+ kill: ["ahub kill"], down: ["ahub down"], tail: ["ahub tail"],
320
324
  reset: ["ahub reset"], restart: ["ahub restart --dry-run"], upgrade: ["ahub upgrade --dry-run"], recovery: ["ahub recovery status"],
321
325
  role: ["ahub role list"], stop: ["ahub stop pi"], peer: ["ahub peer takeover codex"], models: ["ahub models status"],
322
326
  say: ["ahub say @codex please rebase on main"], watch: ["ahub watch kimi"], permission: ["ahub permission codex ask-when-needed"],
@@ -425,7 +429,7 @@ export const FLAG_DESCRIPTIONS: Readonly<Record<string, string>> = {
425
429
  "--force": "void other machines' claims", "--no-open": "print the link, do not open it", "--settings": "open with a settings session", "--stop": "stop the dashboard manager", "--hook": "run as a Claude Code hook; never blocks",
426
430
  // a flag one command uses for something other than its own entry
427
431
  "--all": "include everything, not the default subset", "status --all": "every registered project", "ui --all": "the unified project dashboard", "reset --all": "archive the state directory instead", "queue --all": "include rows already settled",
428
- "learn --all": "include decided candidates", "research --all": "every registered project", "goal --all": "include completed goals", "sdlc --mode": "off or advise", "sdlc --profile": "audit depth: quick or standard",
432
+ "learn --all": "include decided candidates", "learn --accepted": "the followed checklist lines and their status", "research --all": "every registered project", "goal --all": "include completed goals", "sdlc --mode": "off or advise", "sdlc --profile": "audit depth: quick or standard",
429
433
  "sdlc --since": "git ref, or a date for metrics", "memory --since": "only entries since this ISO time", "memory --label": "name for this machine", "bench --memory": "memory state: off, claude-mem, native or both",
430
434
  "task --model": "model label the verdict was given under", "room --action": "accept or discard the application", "room --label": "label for your member", "room --confirm": "member fingerprint prefix",
431
435
  "worktrees --confirm": "fingerprint of the preview to run", "board --label": "only issues with this label", "board --milestone": "only issues of this milestone", "board --repo": "repository to import from", "goal --milestone": "milestone of the goal (repeatable)",
@@ -439,7 +443,44 @@ export function flagDescription(command: string, flag: string): string | undefin
439
443
  return FLAG_DESCRIPTIONS[`${command} ${flag}`] ?? FLAG_DESCRIPTIONS[flag];
440
444
  }
441
445
 
442
- const DESCRIPTION = 34;
446
+ /**
447
+ * #1654 T2: a usage line broken only between its bracket groups. A word is an atom, and so is a whole `[...]`, `(...)` or `<...>` group however many spaces it holds; atoms fill a line greedily.
448
+ * A group wider than a whole line is the one case that falls back to the plain word wrap, so nothing is ever dropped. `hang` is the continuation indent, as in `wrap`.
449
+ */
450
+ function wrapUsage(usage: string, width: number, hang = 4): string[] {
451
+ const atoms: string[] = [];
452
+ let depth = 0, current = "";
453
+ for (const char of usage.trim()) {
454
+ if (char === "[" || char === "(" || char === "<") depth++;
455
+ else if ((char === "]" || char === ")" || char === ">") && depth) depth--;
456
+ if (/\s/.test(char) && !depth) { if (current) atoms.push(current); current = ""; continue; }
457
+ current += char;
458
+ }
459
+ if (current) atoms.push(current);
460
+ const lines: string[] = [];
461
+ let line = "";
462
+ const room = (indent: number) => width - indent;
463
+ for (const atom of atoms) {
464
+ const indent = lines.length ? hang : 0;
465
+ if (!line) { line = atom; continue; }
466
+ if (Bun.stringWidth(line + " " + atom) <= room(indent)) { line += " " + atom; continue; }
467
+ lines.push(line); line = atom;
468
+ }
469
+ if (line) lines.push(line);
470
+ // a group wider than the width cannot be kept whole: the plain word wrap breaks it inside the room it has, and every part gets the same indent
471
+ return lines.flatMap((text, index) => {
472
+ const indent = index ? hang : 0;
473
+ return (Bun.stringWidth(text) <= room(indent) ? [text] : wrap(text, room(indent), 2)).map(part => " ".repeat(indent) + part);
474
+ });
475
+ }
476
+
477
+ /** The words that name a form inside `ahub <command>`: `status` for `ahub sdlc status [task] | explain <task>`. Empty when the form has none (a bare command, or one that starts with an argument). */
478
+ function formLabel(usage: string): string {
479
+ const rest = usage.replace(COMMAND, "").trim().split(/\s+/);
480
+ const words: string[] = [];
481
+ for (const word of rest) { if (!/^[a-z][a-z0-9-]*$/.test(word)) break; words.push(word); }
482
+ return words.join(" ");
483
+ }
443
484
  /**
444
485
  * `ahub help <command>` in the standard's shape (#1504): the usage forms, a short description, each flag on one line, examples, then the long text unchanged
445
486
  * (every usage form with its whole description) so nothing a form or flag says is lost. Lines are wrapped within `width`.
@@ -451,7 +492,7 @@ function renderCommandHelp(width: number, ascii: boolean, command: string, model
451
492
  report.section("Usage");
452
493
  for (const entry of entries) {
453
494
  const prefix = COMMAND.exec(entry.usage)?.[0] ?? "";
454
- const text = wrap(entry.usage, width - 2, 4);
495
+ const text = wrapUsage(entry.usage, width - 2, 4);
455
496
  report.append(text.map((line, index): Span[] => index === 0 ? [{ text: " " }, { text: prefix, role: "accent" }, { text: line.slice(prefix.length) }] : [{ text: " " + line }]));
456
497
  }
457
498
  const row = helpOverviewRows(model).find(item => item.name.split("|").includes(command));
@@ -480,16 +521,13 @@ function renderCommandHelp(width: number, ascii: boolean, command: string, model
480
521
  report.section("Examples");
481
522
  for (const example of examples) report.append(wrap(example, width - 2, 4).map((line, index): Span[] => [{ text: index === 0 ? " " : " " }, { text: line, role: index === 0 ? "accent" : "value" }]));
482
523
  }
524
+ // #1654 T2: Details says what each form does and no longer repeats the usage (the Usage section above has every form whole) or the group name. A form is named by its leading words.
483
525
  report.section("Details");
484
- let section = "";
485
526
  for (const entry of entries) {
486
- if (entry.section !== section) { section = entry.section; report.append([[{ text: ` ${entry.section}`, tone: "strong" }]]); }
487
- const prefix = COMMAND.exec(entry.usage)?.[0] ?? "";
488
- const usage = wrap(entry.usage, width - 4, 0);
489
- const description = wrap(entry.description, width - DESCRIPTION, 0);
490
- const first: Span[] = [{ text: " " }, { text: prefix, tone: "info" }, { text: usage[0]!.slice(prefix.length) }];
491
- if (usage.length === 1 && 2 + Bun.stringWidth(usage[0]!) + 2 <= DESCRIPTION) first.push({ text: " ".repeat(DESCRIPTION - 2 - Bun.stringWidth(usage[0]!)) + description.shift() });
492
- report.append([first, ...usage.slice(1).map((text): Span[] => [{ text: ` ${text}` }]), ...description.map((text): Span[] => [{ text: " ".repeat(DESCRIPTION) + text }])]);
527
+ const label = formLabel(entry.usage);
528
+ if (entries.length > 1 && label) report.append([[{ text: ` ${label}`, tone: "strong" }]]);
529
+ const indent = entries.length > 1 && label ? 4 : 2;
530
+ report.append(wrap(entry.description, width - indent, 0).map((text): Span[] => [{ text: " ".repeat(indent) + text }]));
493
531
  }
494
532
  return report.lines();
495
533
  }
@@ -41,6 +41,16 @@ const choice = <T extends string>(id: string, flag: string, values: readonly T[]
41
41
  throw new Error(`${flag}: "${text.slice(0, 48)}" is not ${values.join(", ")}; nothing was written`);
42
42
  };
43
43
 
44
+ /** #1645 T4: the commented `[risk]` example a newly created sdlc.toml carries, so the tier table is discoverable without a project being opted in. */
45
+ const RISK_SCAFFOLD = [
46
+ "# Minimum review by risk tier (#1645): globs that make a change high, or that keep it low. A path no pattern names is medium, and a",
47
+ "# path under [security] is always high. With this table commented out no tier is derived and every review stays as it is today.",
48
+ "# [risk]",
49
+ '# high = ["src/hub/sdlc-merge.ts", "src/local/**"]',
50
+ '# low = ["docs/**", "*.md"]',
51
+ "",
52
+ ].join("\n");
53
+
44
54
  export const INIT_SETTINGS: readonly InitSettingDef[] = [
45
55
  { id: "start.agents", flags: [{ flag: "--agents" }], file: "config.local.json", path: ["start", "agents"], allowed: `${START_AGENTS_ALLOWED.join(", ")} or none`, describe: "agents ahub up starts",
46
56
  parse: text => {
@@ -244,6 +254,11 @@ export function planInitSettings(request: InitSettingsRequest, texts: InitSettin
244
254
  next[file] = current[file]!;
245
255
  rows.push({ key: row.id, file, ...(held === undefined ? {} : { from: held }), to } as InitSettingRow);
246
256
  }
257
+ // #1645 T4: a newly created sdlc.toml carries the `[risk]` table as a commented example, so the tier feature is discoverable without a project being on.
258
+ // Written once, after every key this plan sets, because a comment block in the middle would push a later top-level key below it. Comments only, so the
259
+ // file parses exactly as it did before, and only on creation: a file a person already holds is never rewritten by `ahub init`.
260
+ const sdlc = next["sdlc.toml"];
261
+ if (texts["sdlc.toml"] === null && sdlc) next["sdlc.toml"] = `${sdlc}${sdlc.endsWith("\n") ? "" : "\n"}${RISK_SCAFFOLD}`;
247
262
  // #1408 T2: the role choices, judged against the config.json this plan produces and the local file; each peer whose roles change is written as one explicit list.
248
263
  if (ROLE_KEYS.some(key => Object.hasOwn(request.values, key))) {
249
264
  const changes = planRoles(request.values, parsed("config.json"), parsed("config.local.json"));
@@ -1,7 +1,7 @@
1
1
  // Human output for `ahub intake` (#334, #511a). Pure: parsed hub-tool JSON in, spans out, no I/O. `--json` is the caller's branch and prints the same text.
2
2
  // A private request arrives from the hub as a stub (`[pii]` title and detail); this module shows that stub and never asks for more.
3
- import { blank, grid, heading, pair, s } from "./sdlc-output.ts";
4
- import type { Span } from "./console-state.ts";
3
+ import { grid, s } from "./sdlc-output.ts";
4
+ import { Report, plural, type Span } from "./console-state.ts";
5
5
 
6
6
  const list = (value: unknown): any[] => Array.isArray(value) ? value : [];
7
7
  const dash = (value: unknown) => value === undefined || value === null || value === "" ? "-" : String(value);
@@ -14,20 +14,20 @@ const HOW: Record<string, string> = {
14
14
  };
15
15
 
16
16
  /** `ahub intake "<text>"`: the draft, who is splitting it, and the children if the hub split it. */
17
- export function renderIntake(result: unknown, columns?: number): Span[][] {
17
+ export function renderIntake(result: unknown, columns?: number, _now = Date.now(), ascii = false): Span[][] {
18
18
  const r = result as any, draft = r?.draft, children = list(r?.children);
19
- const out: Span[][] = [...heading(`Intake draft #${draft?.id ?? "?"}`, columns)];
20
- out.push(...pair("title", dash(draft?.title), columns, 8), ...pair("state", "draft: held until you approve it", columns, 8, "attention"), ...pair("split", HOW[r?.split] ?? dash(r?.split), columns, 8));
21
- if (r?.reason) out.push(...pair("because", String(r.reason), columns, 8, "attention"));
22
- if (children.length) out.push(blank, [s(`${children.length} draft part${children.length === 1 ? "" : "s"}`, "muted")], ...grid(["ID", "CLASS", "AFTER", "TITLE"], children.map((c: any) => [s(`#${c.id}`, "taskRef"), s(dash(c.profileClass ?? c.class)), s(ids(c.deps)), s(dash(c.title))]), columns));
23
- out.push(blank, [s(`approve with ahub intake approve ${draft?.id ?? "<id>"}, or discard with ahub intake discard ${draft?.id ?? "<id>"}`, "muted")]);
24
- return out;
19
+ const out = new Report(columns, ascii).titled("ahub", "Intake draft", `#${draft?.id ?? "?"}`, true);
20
+ out.section("Draft").kv([["title", dash(draft?.title)], ["state", "draft: held until you approve it"], ["split", HOW[r?.split] ?? dash(r?.split)]]);
21
+ if (r?.reason) out.bullet("warn", `because: ${String(r.reason)}`);
22
+ if (children.length) out.section(plural(children.length, "draft part")).append(grid(["ID", "CLASS", "AFTER", "TITLE"], children.map((c: any) => [s(`#${c.id}`, "taskRef"), s(dash(c.profileClass ?? c.class)), s(ids(c.deps)), s(dash(c.title))]), columns));
23
+ out.note(`approve with ahub intake approve ${draft?.id ?? "<id>"}, or discard with ahub intake discard ${draft?.id ?? "<id>"}`);
24
+ return out.lines();
25
25
  }
26
26
 
27
27
  /** `ahub intake approve|discard <id>`: every card the command changed. */
28
- export function renderIntakeChange(op: "approve" | "discard", result: unknown, columns?: number): Span[][] {
28
+ export function renderIntakeChange(op: "approve" | "discard", result: unknown, columns?: number, _now = Date.now(), ascii = false): Span[][] {
29
29
  const rows = list(result);
30
- const out: Span[][] = [...heading(op === "approve" ? `Intake approved: ${rows.length} card${rows.length === 1 ? "" : "s"} released to the backlog` : `Intake discarded: ${rows.length} card${rows.length === 1 ? "" : "s"} cancelled`, columns)];
31
- out.push(...grid(["ID", "STATE", "TITLE"], rows.map((c: any) => [s(`#${c.id}`, "taskRef"), s(dash(c.state), c.state === "cancelled" ? "muted" : undefined), s(dash(c.title))]), columns));
32
- return out;
30
+ const out = new Report(columns, ascii).titled("ahub", op === "approve" ? `Intake approved: ${plural(rows.length, "card")} released to the backlog` : `Intake discarded: ${plural(rows.length, "card")} cancelled`);
31
+ out.section("Cards", String(rows.length)).append(grid(["ID", "STATE", "TITLE"], rows.map((c: any) => [s(`#${c.id}`, "taskRef"), s(dash(c.state), c.state === "cancelled" ? "muted" : undefined), s(dash(c.title))]), columns));
32
+ return out.lines();
33
33
  }
package/src/cli/launch.ts CHANGED
@@ -11,6 +11,7 @@ import { peerChildEnv, processTable } from "../hub/child-process.ts";
11
11
  import { definitionOf } from "../adapters/registry.ts";
12
12
  import type { InstancesConfig } from "../hub/instances.ts";
13
13
  import { kimiAcpCommand } from "../adapters/definitions/native-daemon-kimi.ts";
14
+ import { warnLine } from "./warn-line.ts";
14
15
  export const CLAUDE_CHANNEL = "plugin:agent-hub@agent-hub";
15
16
 
16
17
  export { retainedLaunchWarning } from "../adapters/definitions/native-cli-retained.ts";
@@ -263,13 +264,13 @@ export async function runClaudeLaunch(launch: Launch, options: { cwd: string; en
263
264
  const child = spawn(launch.cmd, launch.args, { cwd: options.cwd, env: options.env, stdio: "inherit" });
264
265
  child.once("spawn", () => {
265
266
  if (!options.record || !child.pid) return;
266
- const unavailable = (reason: string) => console.error(`Native identity and crash cleanup disabled for this launch; managed hook record stays current. ${reason}.`);
267
+ const unavailable = (reason: string) => warnLine(`Native identity and crash cleanup disabled for this launch: ${reason}; the managed hook record stays current`);
267
268
  if (!direct) { unavailable("native executable is a script or an unverified interpreter"); return; }
268
269
  if (!options.record.launcherSignature) { unavailable("launcher identity could not be verified"); return; }
269
270
  const signature = processSignature(child.pid);
270
271
  if (!signature) { unavailable("native process identity could not be verified"); return; }
271
272
  childSignature = signature;
272
- attestation = recordClaudeNative(options.stateDir, options.record, child.pid, signature, warning => console.error(warning)).catch(() => undefined);
273
+ attestation = recordClaudeNative(options.stateDir, options.record, child.pid, signature, warning => warnLine(warning)).catch(() => undefined);
273
274
  });
274
275
  child.once("error", error => resolveResult({ status: null, signal: null, error }));
275
276
  child.once("exit", async (status, signal) => {
@@ -1,38 +1,57 @@
1
1
  // Human output for `ahub learn` (#514b). Pure: parsed hub-tool JSON in, spans out, no I/O. `--json` is the caller's branch and prints the same text.
2
2
  // Ids, counts, the key parts and the one line the hub itself generates are all it shows: the card's own text is never echoed (a card is data to the parser, not to this printer).
3
- import { blank, grid, heading, pair, s } from "./sdlc-output.ts";
4
- import type { Span } from "./console-state.ts";
3
+ import { grid, s } from "./sdlc-output.ts";
4
+ import { Report, type Span } from "./console-state.ts";
5
5
 
6
6
  const list = (value: unknown): any[] => Array.isArray(value) ? value : [];
7
7
  const dash = (value: unknown) => value === undefined || value === null || value === "" ? "-" : String(value);
8
8
 
9
- /** `ahub learn list [--all]`: one row per candidate, and what each command would do. */
10
- export function renderLearnList(result: unknown, columns?: number, all = false): Span[][] {
9
+ /** `ahub learn list [--all]`: one row per candidate, and what each command would do. `--accepted` (#1642 T2) shows the followed lines instead. */
10
+ export function renderLearnList(result: unknown, columns?: number, all = false, accepted = false, ascii = false): Span[][] {
11
+ if (accepted || (result as any)?.view === "accepted") return renderLearnAccepted(result, columns, ascii);
11
12
  const rows = list(result);
12
13
  const open = rows.filter(row => row.status === "open").length;
13
- const out: Span[][] = [...heading(all ? `Review checklist candidates: ${open} open, ${rows.length - open} decided` : `Review checklist candidates: ${open} open`, columns)];
14
- if (!rows.length) {
15
- out.push(blank, [s(all ? "no candidate has been filed" : "no open candidate; pass --all to include decided ones", "muted")]);
16
- return out;
17
- }
18
- out.push(...grid(["ID", "STATUS", "PROFILE/CLASS", "CRITERION", "TASKS", "LINE TO ADD"], rows.map((row: any) => [
14
+ const out = new Report(columns, ascii).titled("ahub", all ? `Review checklist candidates: ${open} open, ${rows.length - open} decided` : `Review checklist candidates: ${open} open`);
15
+ if (!rows.length) return out.note(all ? "no candidate has been filed" : "no open candidate; pass --all to include decided ones").lines();
16
+ out.section("Candidates", String(rows.length)).append(grid(["ID", "STATUS", "PROFILE/CLASS", "CRITERION", "TASKS", "LINE TO ADD"], rows.map((row: any) => [
19
17
  s(`#${row.id}`, "taskRef"), s(dash(row.status), row.status === "open" ? "attention" : "muted"), s(`${dash(row.profile)}/${dash(row.class)}`), s(dash(row.criterion)), s(String(list(row.tasks).length)), s(dash(row.line)),
20
18
  ]), columns));
21
- if (open) out.push(blank, [s("accept writes the line to .agenthub/config.local.json (ahub settings undo puts it back); reject closes the card. Nothing else changes.", "muted")]);
22
- return out;
19
+ if (open) out.note("accept writes the line to .agenthub/config.local.json (ahub settings undo puts it back); reject closes the card. Nothing else changes.");
20
+ return out.lines();
21
+ }
22
+
23
+ /** `ahub learn list --accepted` (#1642 T2): what each accepted line did, its sample size, and the checklist's own size. */
24
+ function renderLearnAccepted(result: unknown, columns?: number, ascii = false): Span[][] {
25
+ const r = (result ?? {}) as any, rows = list(r.followed), size = (r.checklist ?? {}) as any;
26
+ const shown = `${dash(size.lines)}/${dash(size.max)} lines, ${dash(size.characters)} characters`;
27
+ const out = new Report(columns, ascii).titled("ahub", `Followed checklist lines: ${rows.length} (checklist ${shown})`);
28
+ if (!rows.length) return out.note("no accepted line is followed: ahub learn accept on a candidate starts one").lines();
29
+ out.section("Followed", String(rows.length)).append(grid(["STATUS", "PROFILE/CLASS", "CRITERION", "SINCE", "BEFORE", "REMOVAL"], rows.map((row: any) => [
30
+ s(dash(row.status), row.status === "worse" || row.status === "no-change" ? "attention" : "muted"), s(`${dash(row.profile)}/${dash(row.class)}`), s(dash(row.criterion)),
31
+ s(`${dash(row.since?.unmet)}/${dash(row.since?.reviewed)}`), s(`${dash(row.before?.unmet)}/${dash(row.before?.reviewed)}`), s(row.removal ? `#${row.removal.id}` : "-", row.removal ? "taskRef" : "muted"),
32
+ ]), columns));
33
+ out.note(`insufficient until ${dash(r.minReviewed)} reviewed tasks since acceptance; a no-change or worse line with that many asks for one removal card. ${dash(r.untracked)} checklist line(s) were not added by ahub learn accept (untracked, never followed).`);
34
+ return out.lines();
23
35
  }
24
36
 
25
37
  /** `ahub learn accept|reject <id>`: what was decided, and for accept exactly what was written and where. */
26
- export function renderLearnChange(op: "accept" | "reject", result: unknown, columns?: number): Span[][] {
38
+ export function renderLearnChange(op: "accept" | "reject", result: unknown, columns?: number, _now = Date.now(), ascii = false): Span[][] {
27
39
  const r = (result ?? {}) as any;
28
40
  const card = op === "accept" ? r.card : r;
29
- const out: Span[][] = [...heading(op === "accept" ? `Candidate #${dash(card?.id)} accepted` : `Candidate #${dash(card?.id)} rejected and closed`, columns)];
30
- if (op === "reject") return [...out, ...pair("written", "nothing", columns, 8, "muted")];
41
+ if (op === "reject") return new Report(columns, ascii).titled("ahub", `Candidate #${dash(card?.id)} rejected and closed`).section("Result").kv([["written", "nothing"]]).lines();
31
42
  const a = r.accepted ?? {};
32
- if (a.alreadyAccepted) return [...heading(`Candidate #${dash(card?.id)} was already accepted`, columns), ...pair("profile", `${dash(a.profile)}/${dash(a.class)}`, columns, 8), ...pair("criterion", a.criterion, columns, 8), ...pair("written", "nothing: it was accepted before (ahub settings undo still puts back that write if it is the latest)", columns, 8, "muted")];
33
- out.push(...pair("profile", `${dash(a.profile)}/${dash(a.class)}`, columns, 8), ...pair("criterion", a.criterion, columns, 8), ...pair("line", a.line, columns, 8),
34
- ...pair("file", `${dash(a.file)} (this machine only; the shared config is untouched)`, columns, 8), ...pair("now", a.alreadyPresent ? `the checklist already had this line: nothing was written` : `${dash(a.lines)} lines in the checklist`, columns, 8),
35
- ...pair("applies", dash(a.applies), columns, 8, "attention"));
36
- if (a.undo) out.push(blank, [s(`put it back with ${a.undo}`, "muted")]);
37
- return out;
43
+ if (a.alreadyAccepted) return new Report(columns, ascii).titled("ahub", `Candidate #${dash(card?.id)} was already accepted`).section("Candidate").kv([["profile", `${dash(a.profile)}/${dash(a.class)}`], ["criterion", a.criterion], ["written", "nothing: it was accepted before (ahub settings undo still puts back that write if it is the latest)"]]).lines();
44
+ const out = new Report(columns, ascii).titled("ahub", `Candidate #${dash(card?.id)} accepted`);
45
+ const rows: [string, unknown][] = [["profile", `${dash(a.profile)}/${dash(a.class)}`], ["criterion", a.criterion]];
46
+ if (a.kind === "removal") {
47
+ // #1642 T3: a removal card takes one line out; the undo restores the file the settings writer kept.
48
+ rows.push(["removed", "1 checklist line"], ["file", `${dash(a.file)} (this machine only; the shared config is untouched)`], ["now", `${dash(a.lines)} lines in the checklist`], ["applies", dash(a.applies)]);
49
+ } else {
50
+ rows.push(["line", a.line], ["file", `${dash(a.file)} (this machine only; the shared config is untouched)`], ["now", a.alreadyPresent ? `the checklist already had this line: nothing was written` : `${dash(a.lines)} lines in the checklist`],
51
+ ["before", `${dash(a.before?.unmet)}/${dash(a.before?.reviewed)} tasks named it unmet in the window before acceptance`], ["applies", dash(a.applies)]);
52
+ }
53
+ out.section("Accepted").kv(rows);
54
+ if (a.alreadyPresent) out.note("nothing was written");
55
+ if (a.undo) out.note(`put it back with ${a.undo}`);
56
+ return out.lines();
38
57
  }