hubkit-cli 0.2.3__tar.gz → 0.4.1__tar.gz

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 (109) hide show
  1. hubkit_cli-0.4.1/.github/workflows/ci.yml +21 -0
  2. {hubkit_cli-0.2.3 → hubkit_cli-0.4.1}/.gitignore +2 -0
  3. hubkit_cli-0.4.1/CHANGELOG.md +119 -0
  4. {hubkit_cli-0.2.3 → hubkit_cli-0.4.1}/CLAUDE.md +32 -4
  5. {hubkit_cli-0.2.3 → hubkit_cli-0.4.1}/PKG-INFO +39 -3
  6. {hubkit_cli-0.2.3 → hubkit_cli-0.4.1}/README.md +38 -2
  7. {hubkit_cli-0.2.3 → hubkit_cli-0.4.1}/SECURITY.md +5 -3
  8. {hubkit_cli-0.2.3 → hubkit_cli-0.4.1}/SKILL.md +12 -6
  9. hubkit_cli-0.4.1/config.example.toml +189 -0
  10. hubkit_cli-0.4.1/docs/architecture.md +260 -0
  11. hubkit_cli-0.4.1/docs/commands.md +126 -0
  12. hubkit_cli-0.4.1/docs/configuration.md +271 -0
  13. {hubkit_cli-0.2.3 → hubkit_cli-0.4.1}/intents.example.toml +24 -0
  14. hubkit_cli-0.4.1/llms.txt +22 -0
  15. {hubkit_cli-0.2.3 → hubkit_cli-0.4.1}/pyproject.toml +4 -1
  16. hubkit_cli-0.4.1/scripts/hubcore/agentio.py +252 -0
  17. hubkit_cli-0.4.1/scripts/hubcore/cli.py +578 -0
  18. {hubkit_cli-0.2.3 → hubkit_cli-0.4.1}/scripts/hubcore/config.py +24 -3
  19. hubkit_cli-0.4.1/scripts/hubcore/eodclock.py +66 -0
  20. {hubkit_cli-0.2.3 → hubkit_cli-0.4.1}/scripts/hubcore/gate.py +77 -23
  21. hubkit_cli-0.4.1/scripts/hubcore/gatectl.py +180 -0
  22. hubkit_cli-0.4.1/scripts/hubcore/guardwatch.py +208 -0
  23. {hubkit_cli-0.2.3 → hubkit_cli-0.4.1}/scripts/hubcore/hooks.py +123 -14
  24. {hubkit_cli-0.2.3 → hubkit_cli-0.4.1}/scripts/hubcore/inbound.py +13 -9
  25. {hubkit_cli-0.2.3 → hubkit_cli-0.4.1}/scripts/hubcore/install.py +2 -1
  26. {hubkit_cli-0.2.3 → hubkit_cli-0.4.1}/scripts/hubcore/learnings.py +29 -4
  27. {hubkit_cli-0.2.3 → hubkit_cli-0.4.1}/scripts/hubcore/lessons.py +56 -12
  28. hubkit_cli-0.4.1/scripts/hubcore/lifecycle.py +245 -0
  29. hubkit_cli-0.4.1/scripts/hubcore/mergestate.py +83 -0
  30. hubkit_cli-0.4.1/scripts/hubcore/nopr.py +48 -0
  31. {hubkit_cli-0.2.3 → hubkit_cli-0.4.1}/scripts/hubcore/orders.py +20 -7
  32. hubkit_cli-0.4.1/scripts/hubcore/owed.py +547 -0
  33. hubkit_cli-0.4.1/scripts/hubcore/playbooks.py +132 -0
  34. hubkit_cli-0.4.1/scripts/hubcore/preroute.py +73 -0
  35. hubkit_cli-0.4.1/scripts/hubcore/redact.py +106 -0
  36. hubkit_cli-0.4.1/scripts/hubcore/replies.py +207 -0
  37. hubkit_cli-0.4.1/scripts/hubcore/reportcheck.py +55 -0
  38. hubkit_cli-0.4.1/scripts/hubcore/reviewdebt.py +128 -0
  39. hubkit_cli-0.4.1/scripts/hubcore/reviewreport.py +66 -0
  40. hubkit_cli-0.4.1/scripts/hubcore/roster.py +341 -0
  41. {hubkit_cli-0.2.3 → hubkit_cli-0.4.1}/scripts/hubcore/routed.py +95 -25
  42. hubkit_cli-0.4.1/scripts/hubcore/stale.py +56 -0
  43. hubkit_cli-0.4.1/scripts/hubcore/standing.py +30 -0
  44. hubkit_cli-0.4.1/scripts/hubcore/standrules.py +310 -0
  45. {hubkit_cli-0.2.3 → hubkit_cli-0.4.1}/scripts/hubcore/status.py +35 -8
  46. {hubkit_cli-0.2.3 → hubkit_cli-0.4.1}/scripts/hubcore/store.py +4 -0
  47. hubkit_cli-0.4.1/scripts/hubcore/sweeps.py +58 -0
  48. hubkit_cli-0.4.1/scripts/hubcore/threads.py +454 -0
  49. {hubkit_cli-0.2.3 → hubkit_cli-0.4.1}/scripts/hubcore/trust.py +3 -3
  50. {hubkit_cli-0.2.3 → hubkit_cli-0.4.1}/scripts/learn.py +2 -1
  51. {hubkit_cli-0.2.3 → hubkit_cli-0.4.1}/skills/hub-mep/SKILL.md +14 -10
  52. hubkit_cli-0.4.1/skills/hubkit-setup/SKILL.md +64 -0
  53. hubkit_cli-0.4.1/tests/ghkit.py +56 -0
  54. hubkit_cli-0.4.1/tests/run_reverts.py +685 -0
  55. hubkit_cli-0.4.1/tests/test_agent_cli.py +143 -0
  56. hubkit_cli-0.4.1/tests/test_eodclock.py +86 -0
  57. hubkit_cli-0.4.1/tests/test_gate_strength.py +221 -0
  58. {hubkit_cli-0.2.3 → hubkit_cli-0.4.1}/tests/test_hubkit.py +66 -19
  59. {hubkit_cli-0.2.3 → hubkit_cli-0.4.1}/tests/test_install.py +2 -2
  60. hubkit_cli-0.4.1/tests/test_intake_learning.py +216 -0
  61. {hubkit_cli-0.2.3 → hubkit_cli-0.4.1}/tests/test_learning_rules.py +28 -0
  62. {hubkit_cli-0.2.3 → hubkit_cli-0.4.1}/tests/test_lessons.py +54 -3
  63. hubkit_cli-0.4.1/tests/test_lifecycle.py +275 -0
  64. hubkit_cli-0.4.1/tests/test_mergestate.py +90 -0
  65. hubkit_cli-0.4.1/tests/test_playbooks.py +62 -0
  66. hubkit_cli-0.4.1/tests/test_preroute.py +80 -0
  67. hubkit_cli-0.4.1/tests/test_redact_inplace.py +42 -0
  68. hubkit_cli-0.4.1/tests/test_replies.py +200 -0
  69. hubkit_cli-0.4.1/tests/test_reportcheck.py +64 -0
  70. hubkit_cli-0.4.1/tests/test_requests.py +215 -0
  71. {hubkit_cli-0.2.3 → hubkit_cli-0.4.1}/tests/test_review_chain.py +10 -0
  72. hubkit_cli-0.4.1/tests/test_reviewdebt.py +95 -0
  73. hubkit_cli-0.4.1/tests/test_roster.py +205 -0
  74. hubkit_cli-0.4.1/tests/test_stale_nopr.py +127 -0
  75. hubkit_cli-0.4.1/tests/test_standrules.py +202 -0
  76. {hubkit_cli-0.2.3 → hubkit_cli-0.4.1}/tests/test_state_rules.py +16 -2
  77. hubkit_cli-0.4.1/tests/test_threads.py +286 -0
  78. hubkit_cli-0.4.1/tests/test_tool_routing_guards.py +178 -0
  79. {hubkit_cli-0.2.3 → hubkit_cli-0.4.1}/tests/test_watcher.py +1 -1
  80. hubkit_cli-0.2.3/CHANGELOG.md +0 -74
  81. hubkit_cli-0.2.3/config.example.toml +0 -84
  82. hubkit_cli-0.2.3/docs/architecture.md +0 -141
  83. hubkit_cli-0.2.3/docs/commands.md +0 -71
  84. hubkit_cli-0.2.3/docs/configuration.md +0 -165
  85. hubkit_cli-0.2.3/scripts/hubcore/cli.py +0 -327
  86. hubkit_cli-0.2.3/scripts/hubcore/redact.py +0 -89
  87. hubkit_cli-0.2.3/skills/hubkit-setup/SKILL.md +0 -50
  88. hubkit_cli-0.2.3/tests/run_reverts.py +0 -396
  89. {hubkit_cli-0.2.3 → hubkit_cli-0.4.1}/CONTRIBUTING.md +0 -0
  90. {hubkit_cli-0.2.3 → hubkit_cli-0.4.1}/LICENSE +0 -0
  91. {hubkit_cli-0.2.3 → hubkit_cli-0.4.1}/docs/troubleshooting.md +0 -0
  92. {hubkit_cli-0.2.3 → hubkit_cli-0.4.1}/references/design-sources.md +0 -0
  93. {hubkit_cli-0.2.3 → hubkit_cli-0.4.1}/references/research.md +0 -0
  94. {hubkit_cli-0.2.3 → hubkit_cli-0.4.1}/scripts/hubcore/__init__.py +0 -0
  95. {hubkit_cli-0.2.3 → hubkit_cli-0.4.1}/scripts/hubcore/compat.py +0 -0
  96. {hubkit_cli-0.2.3 → hubkit_cli-0.4.1}/scripts/hubcore/ledger.py +0 -0
  97. {hubkit_cli-0.2.3 → hubkit_cli-0.4.1}/scripts/hubcore/slow.py +0 -0
  98. {hubkit_cli-0.2.3 → hubkit_cli-0.4.1}/scripts/hubcore/watcher.py +0 -0
  99. {hubkit_cli-0.2.3 → hubkit_cli-0.4.1}/scripts/hubkit +0 -0
  100. {hubkit_cli-0.2.3 → hubkit_cli-0.4.1}/tests/conftest.py +0 -0
  101. {hubkit_cli-0.2.3 → hubkit_cli-0.4.1}/tests/test_blockers.py +0 -0
  102. {hubkit_cli-0.2.3 → hubkit_cli-0.4.1}/tests/test_compat.py +0 -0
  103. {hubkit_cli-0.2.3 → hubkit_cli-0.4.1}/tests/test_guards2.py +0 -0
  104. {hubkit_cli-0.2.3 → hubkit_cli-0.4.1}/tests/test_inbound.py +0 -0
  105. {hubkit_cli-0.2.3 → hubkit_cli-0.4.1}/tests/test_ledger.py +0 -0
  106. {hubkit_cli-0.2.3 → hubkit_cli-0.4.1}/tests/test_own_work.py +0 -0
  107. {hubkit_cli-0.2.3 → hubkit_cli-0.4.1}/tests/test_peer_reports.py +0 -0
  108. {hubkit_cli-0.2.3 → hubkit_cli-0.4.1}/tests/test_slow.py +0 -0
  109. {hubkit_cli-0.2.3 → hubkit_cli-0.4.1}/tests/test_tool_guards.py +0 -0
@@ -0,0 +1,21 @@
1
+ name: ci
2
+ on:
3
+ pull_request:
4
+ push:
5
+ branches: [main]
6
+ concurrency:
7
+ group: ci-${{ github.ref }}
8
+ cancel-in-progress: true
9
+ jobs:
10
+ check:
11
+ runs-on: ubuntu-latest
12
+ timeout-minutes: 10
13
+ steps:
14
+ - uses: actions/checkout@v4
15
+ - uses: actions/setup-python@v5
16
+ with:
17
+ python-version: "3.14"
18
+ - run: pip install pytest ruff mypy
19
+ - run: ruff check .
20
+ - run: mypy scripts/hubcore scripts/learn.py scripts/hubkit
21
+ - run: python3 -m pytest tests -q -x
@@ -4,3 +4,5 @@ __pycache__/
4
4
  .ruff_cache/
5
5
  .mypy_cache/
6
6
  .coverage*
7
+ dist/
8
+ dist-*/
@@ -0,0 +1,119 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project are recorded here. The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
4
+
5
+ ## [0.4.1] - 2026-11-12
6
+
7
+ First release since 0.2.4; versions 0.3.0 and 0.4.0 were not published separately. This one holds both: the new trackers and checks, and the lifecycle table with the agent-friendly CLI.
8
+
9
+ ### Added
10
+ - Threads (`threads.py`): every record may carry a `thread` (the root ask's id), set automatically (a `For: <ID>` line in a brief; the same PR; the only open ask or shared key words, never a guess between two; what a standing rule opens) or by hand (`hubkit thread link|unlink`). `hubkit mine` prints one entry per thread with its current step, whose court it is in and an indented line per member; `hubkit thread ls|show [--json]`; `mine --json` gains `threads`. When the last step under a root closes the tick alerts with the exact `req done` / `order close` command (hubkit never closes the root); closing a root with open steps warns. New `[threads]` keys.
11
+ - Declared check for work with no PR: a `Done-when:` line in a brief (`routed.done_when_markers`) is stored, the done-report nudge names it, `work done` on that item needs `--note` (exit 3 without), and a non-review brief with no PR and no such line gets a warning (`routed.require_done_when`, `"warn"` or `"off"`).
12
+ - Request intake: a question-form ask with a request verb ("can you delete the old branch?", "please restart X") opens a request (`[requests] polite_ask`; information asks such as "can you tell me why" stay untracked, `info_verbs`); a list of asks (numbered, bulleted, or after a colon) becomes one request with `parts` closed by `req done|drop ID --part N` (`max_parts`); the request keeps the full prompt (`text_chars`) and `req show ID` prints it; `req drop ID --not-a-request` teaches intake and a verb with `false_min` false intakes at `false_ratio` of its opens in `window_days` is muted (`req ls --learned`, `req relearn VERB`); `req add "text"` opens one by hand and counts a miss in `eod`. "fix" and "tidy" are now default request verbs. `req done ID` on a request with open parts is refused (exit 3).
13
+ - Agent-friendly CLI (`agentio.py`): `--json` on `order ls|status`, `work ls`, `req ls`, `mine`, `peers ls`, `inbound ls`, `find`, `digest`, `gate ls`, `standing ls`, `how ls`, `doctor` and the new `next` (one document on stdout, nothing else); `hubkit next` names the single most urgent action with its exact command; every error ends with `NEXT: <command>` (and a `{"error","next","code"}` document under `--json`); `--help` shows examples and the exit codes; README "For agents", `llms.txt`, a verb table in docs/commands.md, and the skills rewritten as command-then-expected-result steps.
14
+ - Exit codes are now stable: 0 ok, 2 bad usage, 3 refused (`order close` without evidence or in a state that forbids it, `work done` on a request), 4 not found (an unknown order, work, request, rule or playbook id). These were exit 2 before; scripts that tested for 2 on a refusal or an unknown id must accept 3 and 4. `order close`, `work done` and the like without an id are now usage errors (2) instead of "no order None".
15
+ - One lifecycle table (`lifecycle.py`) now defines the states, transitions, required proof and clocks of orders, routed work, requests and replies. The four trackers ask it before a write (new refusals: confirm, hold or resume an order in a state that cannot, a chase of a request or routed item in a final state), `hubkit doctor` audits the state files against it, and docs/architecture.md carries it.
16
+ - Standing rules (`hubkit standing ls|add|drop`): the user's instruction saved with their quote, an `approved` trigger (a counting non-author approval at the current head of a tracked PR, optionally per repo or PR) or an `inbound` trigger (a new ask, optionally per person and word), and an action. A firing, once per PR head or message, opens an order or an `active` work item and prints the exact NEXT (a merge carries `--match-head-commit <sha>`; red CI turns it into a hold). hubkit never runs the action. `--until` expires a rule. One status line counts active rules; `mine` lists fired ones not yet acted on. New `[standing]` keys.
17
+ - The user's own review debt (`[review_debt]`): a rate-limited sweep (`gh search prs --review-requested`) finds PRs they reviewed before whose head moved; shown under ON THE USER in `mine` and in the digest, one alert per PR per head, read only.
18
+ - End of day on a clock: `report.eod_time` ("HH:MM") makes the tick write the eod once for the day; `report.eod_check_min` alerts when the file is still missing or writing failed; `hubkit doctor` says whether the clock is on.
19
+ - Stale tracked items: `mine` and the digest mark an open item whose PRs are all merged or closed ("probably stale", with days since last activity); `[stale]` caps the gh reads. Warn only.
20
+ - A routed non-review item with no PR whose owner reported done is nudged (status block, tick alert, once per `routed.stall_min` in the prompt): check the result, then `hubkit work done ID --note ".."`.
21
+ - Adaptive Stop-gate strength: every gate reason has a check id and ends `[check: ID; wrong? hubkit gate false-alarm ID --why "..."]`; `hubkit gate ls|false-alarm|restore|set`; a check with `gate.false_alarm_min` false alarms at `gate.false_alarm_ratio` of its fires in `gate.window_days` downgrades itself to a next-prompt `hubkit WARNING`, a correction within `gate.restore_window_min` restores it, `gate.never_downgrade` (verdict, ci, merge-state) is exempt, and `hubkit doctor` names downgraded checks.
22
+ - Urgent orders held by asking: intents kind flag `no_questions` (hotfix, release in the example) and `[stop_gate] permission_words`; the Stop gate holds a question or "waiting for your go" while such an order is open and not held (`urgent-ask`).
23
+ - Report form: `report.max_lines` and `report.max_code_lines` (off by default) raise warn-only `report-length` and `report-code`.
24
+ - Stated rules: `[corrections] rule_patterns` and `rule_max_chars`; the prompt hook adds a `hubkit RULE` line with the `learn.py add --class standing-rule` command.
25
+ - Tool and routing guards (all warn-only, config-driven): `INLINE-EDIT` (the hub's own Edit/Write/NotebookEdit outside `guards.inline_ok_paths`, once per turn; the matcher now includes `Edit|Write|NotebookEdit`), `NO-ASK-REVIEW` (a review brief on a PR nobody asked about), `WRONG-ACCOUNT` (`[[accounts.rules]]`), `HOST-BUSY` (`guards.hosts`, shown in `hubkit peers ls`), and `REPORT-INCOMPLETE` (`[roles.<role>] report_must_include`).
26
+ - `tools.draft_regex` and `tools.discard_regex` replace the built-in draft words when set.
27
+ - Redaction replaces each secret in place with `[REDACTED]` and keeps the text around it; key names match whole segments (`api_token`, not `author` or `tokenizer`); a bare lowercase 40-hex commit id (or 32-hex id) is kept.
28
+ - Stop gate `hubkit UTC-TIME` (`[report]`): a time stated in UTC while the user's zone is another is held.
29
+ - Pre-tool warnings `NEEDS-ORDER` (`guards.needs_order`) and `UNORDERED-SCHEDULE` (CronCreate, ScheduleWakeup, cron/loop commands) when no typed prompt asks for them; the hook matcher now includes `CronCreate|ScheduleWakeup`.
30
+ - `learn.overlay_max_lines` caps `promote` with a list of rules to merge; `hubkit doctor` prints overlay lines; `hubkit REGRESSED <class>` leads the status block and `learn.py address` on a regressed class needs `--check`.
31
+ - CI workflow (`.github/workflows/ci.yml`).
32
+ - Reply loop: a `reply` item whose PRs are all merged, closed or reviewed at their head is "answer due now" (one alert, one gh read per PR per tick); `hubkit inbound ls` and `inbound replied`; a chat-send command naming the person or message id marks the ask replied (`tools.send_regex`); the age alert learns each person's own median wait (`watcher.reply_floor_min`, `reply_min_samples`); the Stop gate holds a merged/approved/reviewed claim while a reply is owed.
33
+ - Merge state: `routed.pr_info` reads `reviewDecision`, `mergeStateStatus` and review requests; `routed.court(info)`; the Stop gate holds "ready to merge" while GitHub shows changes requested, a review required, a blocked, behind or conflicting branch, or failing CI.
34
+ - Requests: the user's plain asks ("delete the stale branches") open a tracked record, closed only by `hubkit req done ID --evidence ..`; chases are counted and answered from the record, the Stop gate holds a done-claim while an old request has no note, and the overdue limit learns from the time-to-done of past requests. `hubkit mine` lists everything open by whose court it is in.
35
+ - Peer roster (`hubkit peers ls|set|forget`): role and free/busy learned from peers' messages, a per-peer record of jobs, median time and late count, a one-line roster in the status block, and routing warnings for a busy or wrong-role peer while a fitting one is free.
36
+ - Routed hook checks the named PR before more work goes out: already merged, closed, or reviewed at its head.
37
+ - `[roles.<role>] brief_must_include`: the routed hook names a required phrase a brief to that role lacks; `peers ls` counts corrections after briefs to each role.
38
+
39
+ ### Changed
40
+ - `hubkit doctor` no longer warns that no scheduler entry runs `hubkit eod` while `report.eod_time` is set (the tick does it).
41
+ - A typed yes approves a post only when typed after the open `draft:` item was opened or last asked about again (no draft item: unchanged).
42
+ - `hubkit work done` on a `request` item is refused (exit 2); use `hubkit req done ID --evidence`.
43
+
44
+ ## [0.2.4] - 2026-11-09
45
+
46
+ ### Added
47
+ - `hubkit how ls|show|save|match`: playbooks (command -> how -> do). Matching steps are injected on a matching prompt; a NO PLAYBOOK flag and a Stop hold until `how save` runs.
48
+
49
+ ### Fixed
50
+ - Text inside `<pasted_content>` is stripped before order, playbook and draft matching, so pasted text opens no order.
51
+
52
+ ## [0.2.3] - 2026-11-06
53
+
54
+ ### Fixed
55
+ - A job whose title leads with a change verb ("Fix #7 review findings") is not a review item, unless one of its sentences naming the PR leads with a review.
56
+ - The review hard limit (`routed.review_overdue_min`) is raised to the item's own stated `Estimate:` when that is longer.
57
+
58
+ ## [0.2.2] - 2026-11-06
59
+
60
+ ### Fixed
61
+ - A fix job whose change verb and PR number are in different sentences ("Fix the gaps. ... PR #7") is still recognised as a fix job, so its owner pushing to the PR is not counted as a stalled or moved head.
62
+
63
+ ## [0.2.1] - 2026-11-06
64
+
65
+ ### Added
66
+ - `hubkit find WORD [--since]` and, in `digest` and `eod`, the PRs the user's account opened plus what each peer session was asked (`hubcore/ledger.py`; read only on peers, prompts redacted, `gh` failures shown).
67
+
68
+ ### Changed
69
+ - The unpushed-work Stop reason only counts files changed, and commits made, since the turn began; older dirt in the checkout no longer holds a report.
70
+
71
+ ## [0.2.0] - 2026-11-06
72
+
73
+ ### Added
74
+ - Commands: `hubkit digest [--since]`, `hubkit trust record|ls`, `hubkit inbound ingest`, `hubkit work verify`, `learn.py address --check CMD`.
75
+ - The warn-only PreToolUse hook (`hubkit hooks --merge-guard`, matcher `Bash|TaskStop|AskUserQuestion`) now also warns on posts without a typed yes, banned commands, repeated commands, a whole-suite `pytest`, `TaskStop` without a stop word, and a decision card whose first option is not marked (Recommended). The routed hook warns on a brief with no done-when, output or estimate line, on a brief that forbids the fix a blocker needs, and when more than `routed.max_agents` agents hold work.
76
+ - Stop gate reasons: a "tests pass" or "it works" claim in a turn that ran no command, a PR or issue number with no link, an approval while CI at the head is not green, built work not pushed, an ask asked 3 times with no answer, and an unanswered prompt not re-read before "done".
77
+ - Order close: evidence names in a kind's `sha_evidence` must hold a commit sha.
78
+ - Watcher: stale finished agents (`watcher.stale_agent_min`), replies owed to other people (`watcher.reply_owed_min`), and own work not verified for `watcher.verify_stale_min`.
79
+ - `doctor` warns on a hubkit hook registered twice in `settings.json` and on no scheduled `hubkit eod`.
80
+ - Learning loop: `address --check`, an overlay cap of 200 lines, expiry and prose-only lists in `review`, and an ineffective mark on a class that repeats after it was addressed.
81
+ - New tests (336 pass on Linux) and revert entries for each guard.
82
+
83
+ ### Changed
84
+ - Correction patterns in `intents.example.toml` match insults aimed at the hub and no longer fire on one aimed at a tool.
85
+ - A routed item no longer closes on the peer's own "done"; it closes on an artifact (merged or closed PR, or a moved head with CI not failing). A merged or closed PR closes a review item.
86
+ - A one-line resume command may be given in the message as typed (`SKILL.md`).
87
+
88
+ ## [0.1.0]
89
+
90
+ ### Added
91
+ - Install like miseenplace: `uv tool install hubkit-cli` (published on PyPI as 0.1.0), `hubkit skills --install DIR` (hub, hub-mep, hubkit-setup), `hubkit hooks [--skills-dir DIR] [--merge-guard]` prints the settings.json hooks block, and a `hubkit-setup` skill.
92
+ - macOS and Windows support through one platform module (`hubcore/compat.py`); only Linux has been run so far.
93
+ - Blockers (`order block|result`), watcher fixes, peer-report closing, `asks ls`, and warn-only merge guard.
94
+ - Apache-2.0 license, `README.md` rewrite, `docs/` (architecture, configuration, commands, troubleshooting), `CONTRIBUTING.md`, `SECURITY.md`.
95
+ - `pyproject.toml` with package metadata and ruff, mypy and pytest settings.
96
+ - Tests for `learn.py promote-candidates`, `review` and the `address` error path, the entry-point import-failure path, and `doctor --check-clean`.
97
+
98
+ ### Fixed
99
+ - Stop gate and review close: on a PR written by `user.github_login`, a COMMENT review at the head counts (verdict check, item close, queue advance). Other authors' PRs keep the non-author rule.
100
+ - A brief is a review ask only when its first action on the PR is a review; "fix the findings in his review of #N" is not. A head moved by an owner asked to fix the PR raises no re-check alert; a review item still does.
101
+ - PR numbers in examples, quotes and code spans of a brief are not tracked. Acknowledgements that name a PR are not tracked.
102
+ - "waiting on the verdict" and similar awaiting wording no longer trips the verdict check.
103
+ - `order open` never fires from a question, urgent word or not; the prompt hook says so and shows `hubkit order open` for doing it by hand.
104
+ - `order close` requires evidence for every PR named in the order and names the missing ones.
105
+ - A completed agent's task notification closes its routed item. Work ids are never reused after archive (`work.seq`).
106
+ - `doctor` flags a stale or missing `seen/cron` when the crontab runs hubkit (`watchdog.cron_stale_min`).
107
+
108
+ ### Changed
109
+ - `mep: UNVERIFIED` now says that the optional `mep` CLI was not found and how to turn the check off (`[mep] enabled = false`).
110
+ - `doctor --check-clean` no longer scans `.git/` and also scans `.yml` and `.yaml` files.
111
+ - Docstrings and type annotations on public functions; `SKILL.md` and `skills/` reworded for clarity.
112
+ - The learnings file preamble says promoted rules go to the overlay.
113
+
114
+ ### Removed
115
+ - The unused `tools.mep_cursor` config key.
116
+
117
+ ## [0.1.0] - 2026-11-04
118
+
119
+ Initial private version: order clock, routed-work tracking, watchdog, stop gate, status block, end-of-day review and the learn loop.
@@ -7,26 +7,54 @@ Guidance for an agent changing hubkit. Read `README.md` for what it does and `SK
7
7
  ```
8
8
  SKILL.md behaviour contract for the hub session (keep under ~200 lines)
9
9
  README.md operator view docs/ architecture, configuration, commands, troubleshooting
10
+ SECURITY.md what redaction catches and does not CHANGELOG.md release notes (## Unreleased on top)
10
11
  LICENSE (Apache-2.0) pyproject.toml ruff, mypy, pytest settings
11
12
  config.example.toml generic config template intents.example.toml generic intents
12
13
  references/ design notes
14
+ .github/workflows/ci.yml lean CI: ruff, mypy, pytest
13
15
  scripts/hubkit entry point (hooks never raise; an import failure is logged and exits 0)
14
16
  scripts/learn.py learnings log CLI
15
17
  scripts/hubcore/
16
18
  cli.py argparse verbs, doctor
19
+ agentio.py --json views, exit codes (0/2/3/4), NEXT on every error, `hubkit next`, help examples
17
20
  config.py defaults + config loading (DEFAULTS is the full key list)
21
+ compat.py the one place that knows the operating system (processes, locks, scheduler)
18
22
  hooks.py the hook events, bind/unbind, is_hub
23
+ install.py `skills --install` and the `hooks` JSON block
19
24
  orders.py order ledger, intake, evidence-checked close
20
25
  routed.py routed-work items: record/chase/ladder, gh reads, heard-from, close
21
- gate.py Stop-gate reasons
26
+ preroute.py check at routing time that the work is not already done
27
+ roster.py peer roster: role, free/busy, past jobs per peer
28
+ inbound.py asks from other people tracked as reply items
29
+ replies.py reply loop: is the asked PR done, was the person told
30
+ mergestate.py Stop-gate check: "ready to merge" must be mergeable on GitHub
31
+ owed.py tracked requests (the user's plain asks) and the `mine` view
32
+ standrules.py standing rules (`hubkit standing`): fired once per PR head or message, opens an order or work item
33
+ reviewdebt.py the user's own re-reviews (rate-limited gh sweep, read only)
34
+ stale.py open items whose PR is merged or closed are marked probably stale
35
+ nopr.py routed item with no PR whose owner reported done: check it yourself
36
+ threads.py threads: the `thread` field, linking rules, the `mine` fold, settle/root-closed lines, `Done-when:` checks
37
+ eodclock.py `report.eod_time`: the tick writes the day's eod once, alerts on failure
38
+ sweeps.py the one seam where the tick, status block, prompt, mine and digest call the five above
39
+ playbooks.py how a recurring command is done, saved once and replayed
40
+ lifecycle.py the one table of states, transitions, required proof and clocks for orders, routed, requests, replies
41
+ gate.py Stop-gate reasons as (check id, text); urgent-ask
42
+ gatectl.py check modes (hold/warn/off), false alarms, self-downgrade and restore, warning queue
43
+ standing.py stated standing rules in a typed prompt
44
+ lessons.py checks born of repeated corrections; warn-only tool_warning
45
+ guardwatch.py warn-only guards: unasked tickets and recurring work, hub inline edits, wrong account, yes before the draft, one agent per host, unasked review
46
+ reviewreport.py review report completeness (`roles.<role>.report_must_include`)
47
+ reportcheck.py final-message checks: a time stated in UTC for a user in another zone
22
48
  slow.py job records, estimates, usual-time baseline, SLOW check, estimate vs actual
23
49
  watcher.py hub/peer/watch/cron checks, desktop notify, false-alarm excuses, blocked-on link
24
50
  status.py work items, tick/watch, status block, EOD
51
+ ledger.py the day's whole record: the user's PRs, peer prompts; digest and find
52
+ trust.py per-class trust from accepted/edited/rejected proposals
25
53
  store.py state dir, locked/atomic writes, row IO
26
- redact.py secret redaction (every write passes through it)
27
- learnings.py learnings log
54
+ redact.py secret redaction in place (every write passes through it)
55
+ learnings.py learnings log, promote (overlay cap), address, review, regressed
28
56
  tests/conftest.py `env` fixture: scratch state, fake sessions, `env.run`/`env.hook`
29
- tests/test_hubkit.py all tests
57
+ tests/test_*.py one file per area (hubkit = core/orders/routing, plus lessons, guards, tool_guards, slow, watcher, ...)
30
58
  tests/run_reverts.py revert proof
31
59
  ```
32
60
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: hubkit-cli
3
- Version: 0.2.3
3
+ Version: 0.4.1
4
4
  Summary: Session supervisor for Claude Code: hooks-based multi-agent orchestration with order clocks, routed-work tracking, a watchdog and a stop gate, standard library only.
5
5
  Project-URL: Repository, https://github.com/ankitkpandey1/hubkit
6
6
  Project-URL: Documentation, https://github.com/ankitkpandey1/hubkit/tree/main/docs
@@ -22,6 +22,25 @@ Description-Content-Type: text/markdown
22
22
 
23
23
  hubkit adapts to you. When you correct the hub ("I told you to wait for the review"), a hook notices, the hub records the correction as a class of mistake, and a class that repeats is promoted to a written rule in your own overlay file. A rule only counts as fixed after a check that the rule really exists, and it stays on probation until it has held. The words that open an urgent order, the clocks, what "done" means and every other setting live in your config files, not in the code, so the kit bends to how you work. This is a log-and-verify loop around the hub model, not machine learning: hubkit detects, stores and checks; the hub session writes the entries and rules.
24
24
 
25
+ ## For agents
26
+
27
+ hubkit keeps a record outside the model's memory (orders with clocks, requests, routed work, replies owed) and holds a Claude Code hub session to it. You drive it with the CLI below; every read verb has a `--json` form and every error says what to run next.
28
+
29
+ - Install: `uv tool install hubkit-cli`, then `hubkit skills --install ~/.claude/skills`, then follow the `hubkit-setup` skill (it runs unattended and asks only for what it cannot find).
30
+ - Verify: `hubkit doctor`. Success is exit 0 with `bind: live <name>`, `hook-errors.jsonl: 0 rows` and `secret-shaped strings in state (count only): 0` (on a fresh install, before binding, `bind: none or dead` is also fine). `hubkit doctor --json` returns `{"ok", "exit", "lines"}`.
31
+
32
+ The five commands to know first:
33
+
34
+ ```bash
35
+ hubkit next # the one most urgent action now and its exact NEXT command; "nothing is due" when nothing is
36
+ hubkit mine # everything open, grouped by whose court it is in (the user, the hub, peers, other people)
37
+ hubkit status --json # the full status document (orders, work, alerts, mep, hook errors)
38
+ hubkit order ls --json # {"orders": [...]}: every live order with its clock fields
39
+ hubkit doctor # config, bind, hook heartbeats, state health; exit 1 on a problem
40
+ ```
41
+
42
+ `--json` prints one JSON document on stdout and nothing else. Exit codes: 0 ok, 2 bad usage, 3 refused (missing evidence, the state forbids it), 4 not found. Every error prints `error: ...` and a last line `NEXT: <exact command>`; with `--json` it also prints `{"error", "next", "code"}` on stdout. Every verb, whether it reads or writes, and whether it has `--json`: [docs/commands.md](docs/commands.md#verb-table). Machine-readable index: [llms.txt](llms.txt).
43
+
25
44
  ## Why use a Claude Code session supervisor
26
45
 
27
46
  A coordinating Claude Code session routes work to peers and background agents, then forgets. After a context compaction it no longer knows which order was urgent, who was asked to review what, or whether "done" was ever proven. hubkit keeps that record outside the model's memory, gives every order a clock and an evidence check, watches routed work for silence, and blocks the hub from ending a turn while it owes something. Example session:
@@ -43,10 +62,14 @@ In a live hub, the prompt hook opens that order itself from your sentence, and t
43
62
 
44
63
  - **Learns from corrections.** A prompt hook flags correction phrases and repeated instructions. `scripts/learn.py` records, promotes and verifies them. See [docs/architecture.md](docs/architecture.md#the-learn-loop).
45
64
  - **Order clock.** Orders open from your own prompts (never from peer or harness text), each with a first-action limit, a stall limit and a definition of done checked by evidence on close.
65
+ - **Requests and `hubkit mine`.** A plain ask from you ("delete the stale branches") opens a tracked request that closes only with evidence (`hubkit req done`); chases are counted, the Stop gate and watchdog hold the hub to it, and the overdue limit learns from past requests. `hubkit mine` lists everything open by whose court it is in.
66
+ - **Threads.** An ask, the job routed for it, its PR and the reply owed to whoever asked are linked into one thread (`For: <ID>` in a brief links by hand). `hubkit mine` shows one entry per thread with its current step; when the last step closes, hubkit names the command that closes the ask. A question-form ask ("can you delete the old branch?") is tracked too, and a list of asks becomes parts that close one by one (`hubkit req done ID --part N --evidence ".."`). Work with no PR declares its own check with a `Done-when:` line.
46
67
  - **Routed-work tracking.** A hook on `SendMessage` and `Agent` records what the hub asked of whom, one item per (owner, PR). It follows last heard-from, moved heads and GitHub reviews at the PR head.
68
+ - **Standing rules, review debt, stale items.** `hubkit standing add` saves what you said to do every time ("when peer-b approves, merge it"; "route review asks to the reviewer") with your quote; when it fires hubkit opens the order or item and prints the exact NEXT, and the hub does the action. `hubkit mine` also shows the re-reviews you owe and marks open items whose PR is already merged or closed. `report.eod_time` makes the tick write the end-of-day review itself.
69
+ - **Peer roster and pre-route checks.** `hubkit peers` shows each peer's role and free/busy state, learned from its own messages, with its record (jobs done, median time, late). The routed hook warns when work goes to a busy or wrong-role peer while a fitting one is free, when the PR is already merged, closed or reviewed at its head, and when a brief to a role lacks a line the config requires.
47
70
  - **Watchdog and wake-up.** `hubkit tick` (cron) and `hubkit watch` (a background process) raise alerts with back-off; a watch exit wakes an idle hub.
48
- - **Stop gate.** The Stop hook refuses to let the turn end while the hub owes something (no watch running, a stalled item, an unbacked verdict, a question to you that blocks nothing, a "tests pass" claim with no command run, a PR number with no link, an approval on red CI, built work not pushed).
49
- - **Tool guards.** An optional warn-only PreToolUse hook (`hubkit hooks --merge-guard`) warns about an unordered merge, a post without your typed yes, a banned command, stopping an agent and an unmarked decision card. It never denies.
71
+ - **Stop gate.** The Stop hook refuses to let the turn end while the hub owes something (no watch running, a stalled item, an unbacked verdict, a question to you that blocks nothing, a "tests pass" claim with no command run, a PR number with no link, an approval on red CI, a PR called ready to merge while GitHub shows changes requested or a block, a merged PR reported while a person who asked about it is not yet answered, built work not pushed).
72
+ - **Tool guards.** An optional warn-only PreToolUse hook (`hubkit hooks --merge-guard`) warns about an unordered merge, a post without your typed yes (typed after the draft it approves) or from the wrong account, a banned command, stopping an agent, an unmarked decision card, the hub editing files itself, two agents on one host and a review nobody asked for. It never denies.
50
73
  - **Status, digest, end-of-day review.** A status block at session start and on each prompt, a daily archive, `hubkit digest` for when you come back (it also lists the PRs your account opened and what each peer session was asked), `hubkit find WORD` to search orders, work, asks, peer prompts and your PRs, `hubkit eod`, a per-class `hubkit trust` ledger, and `hubkit inbound ingest` to track asks from other people so none goes unanswered.
51
74
 
52
75
  `SKILL.md` is the behaviour contract the hub session reads. This file is the operator view.
@@ -142,14 +165,23 @@ Every key is documented in [docs/configuration.md](docs/configuration.md).
142
165
 
143
166
  | Behaviour | Strength |
144
167
  |---|---|
168
+ | The Stop hook holds the turn on "ready to merge" while GitHub shows changes requested, a review required, a blocked, behind or conflicting branch or failing CI, and on a merged/approved/reviewed PR claim while a reply is owed to the person who asked about it | Enforced (blocks the turn end) |
145
169
  | The Stop hook holds the turn while the hub owes something: no watch running, a stalled item, an unbacked verdict, an unsolved blocker, an item over its estimate, a "done" while your newest prompt is unread, a claim of passing tests with no command run, an approval while CI is not green | Enforced (blocks the turn end) |
170
+ | A final message that states a time in UTC/GMT while `user.timezone` is another zone (`hubkit UTC-TIME`) | Enforced (blocks the turn end) |
171
+ | A final message that asks permission or waits for a go while an urgent order (`no_questions` kind, not held) is open | Enforced (blocks the turn end) |
172
+ | A final message longer than `report.max_lines` or with a code block longer than `report.max_code_lines` (off until set) | Warning only |
173
+ | A Stop-gate check that you mark a false alarm 3 times (`hubkit gate false-alarm ID --why ..`) and that is 30% of its fires in 14 days downgrades itself from blocking to a next-prompt warning; a correction soon after restores it. `verdict`, `ci` and `merge-state` never downgrade. | Adaptive (`hubkit gate ls`) |
174
+ | A typed "from now on ..." style rule: the prompt hook says to save it with `learn.py add --class standing-rule` | Warning only |
146
175
  | An order closes only with the evidence its kind requires | Enforced (the close is refused) |
147
176
  | A learned class counts as fixed only if a rule for it exists (and, with `--check`, its command passes) | Enforced (the address is refused) |
148
177
  | A merge order closes only with the merge commit sha | Enforced (the close is refused) |
149
178
  | A second job sent to a busy owner while an order is open; a brief that bans the action a blocker needs; a brief with no done-when, output or estimate line; more than 4 agents holding work | Warning only |
150
179
  | `gh pr merge` with no live order naming that PR, a post without your typed yes, a banned command, `TaskStop`, a repeated command, a whole-suite `pytest`, an unmarked decision card (`hubkit hook pretool`) | Warning only, never denies |
180
+ | A command matching `guards.needs_order` (for example a ticket-creating one) or a schedule/loop/cron tool or command, with no typed ask of the user in the last `guards.window_min` minutes (`hubkit watch` is exempt) | Warning only, never denies |
151
181
  | `hubkit doctor` warning when your `intents.toml` lacks keys the example has, a hook registered twice, or no scheduled `hubkit eod` | Warning only |
152
182
 
183
+ Every Stop-gate rule is named by a check id and holds the turn once per stop: when the harness has already sent the hub back (`stop_hook_active`), the turn is allowed to end.
184
+
153
185
  Details and exact rules: [SKILL.md](SKILL.md) and [docs/architecture.md](docs/architecture.md#stop-gate-gatepy).
154
186
 
155
187
  ## Documentation
@@ -182,6 +214,10 @@ hubkit has only been run on Linux so far, and the full test suite, ruff and mypy
182
214
  - Redaction matches secret shapes and `key=value` forms. Natural-language secrets ("the password is hunter2") are not caught. See [SECURITY.md](SECURITY.md).
183
215
  - Whether a message to a peer is an ask, a reply or a follow-up is decided by rules in `scripts/hubcore/routed.py`; an unusual message can be misjudged.
184
216
  - The learn loop needs the hub model to act on the `CORRECTION` line; hubkit cannot make it record or write a rule, only refuse to mark a class fixed without one.
217
+ - Whether a typed sentence is an ask is decided from verb lists in `intents.toml`; a casual remark can open a request and an oddly worded ask can be missed. `hubkit req drop ID --not-a-request` and `hubkit req add` correct it, and a verb that keeps misfiring is muted.
218
+ - The checks are proven at hook level by the test suite. No automated test drives a live Claude Code session, so whether the hub model acts on a line it is shown is checked only by use.
219
+ - The watchdog can alert the user on the desktop; it cannot make an idle hub session act.
220
+ - Each new warning is rate-limited on its own, but there is no overall cap on lines per prompt yet.
185
221
  - `skills/hub-mep` describes an optional integration with the `mep` task-list CLI and is of no use without it.
186
222
  - Hooks are written against the Claude Code hook payloads of late 2026; `payload-samples/` in the state dir records the real payload keys so a schema change is visible.
187
223
 
@@ -8,6 +8,25 @@
8
8
 
9
9
  hubkit adapts to you. When you correct the hub ("I told you to wait for the review"), a hook notices, the hub records the correction as a class of mistake, and a class that repeats is promoted to a written rule in your own overlay file. A rule only counts as fixed after a check that the rule really exists, and it stays on probation until it has held. The words that open an urgent order, the clocks, what "done" means and every other setting live in your config files, not in the code, so the kit bends to how you work. This is a log-and-verify loop around the hub model, not machine learning: hubkit detects, stores and checks; the hub session writes the entries and rules.
10
10
 
11
+ ## For agents
12
+
13
+ hubkit keeps a record outside the model's memory (orders with clocks, requests, routed work, replies owed) and holds a Claude Code hub session to it. You drive it with the CLI below; every read verb has a `--json` form and every error says what to run next.
14
+
15
+ - Install: `uv tool install hubkit-cli`, then `hubkit skills --install ~/.claude/skills`, then follow the `hubkit-setup` skill (it runs unattended and asks only for what it cannot find).
16
+ - Verify: `hubkit doctor`. Success is exit 0 with `bind: live <name>`, `hook-errors.jsonl: 0 rows` and `secret-shaped strings in state (count only): 0` (on a fresh install, before binding, `bind: none or dead` is also fine). `hubkit doctor --json` returns `{"ok", "exit", "lines"}`.
17
+
18
+ The five commands to know first:
19
+
20
+ ```bash
21
+ hubkit next # the one most urgent action now and its exact NEXT command; "nothing is due" when nothing is
22
+ hubkit mine # everything open, grouped by whose court it is in (the user, the hub, peers, other people)
23
+ hubkit status --json # the full status document (orders, work, alerts, mep, hook errors)
24
+ hubkit order ls --json # {"orders": [...]}: every live order with its clock fields
25
+ hubkit doctor # config, bind, hook heartbeats, state health; exit 1 on a problem
26
+ ```
27
+
28
+ `--json` prints one JSON document on stdout and nothing else. Exit codes: 0 ok, 2 bad usage, 3 refused (missing evidence, the state forbids it), 4 not found. Every error prints `error: ...` and a last line `NEXT: <exact command>`; with `--json` it also prints `{"error", "next", "code"}` on stdout. Every verb, whether it reads or writes, and whether it has `--json`: [docs/commands.md](docs/commands.md#verb-table). Machine-readable index: [llms.txt](llms.txt).
29
+
11
30
  ## Why use a Claude Code session supervisor
12
31
 
13
32
  A coordinating Claude Code session routes work to peers and background agents, then forgets. After a context compaction it no longer knows which order was urgent, who was asked to review what, or whether "done" was ever proven. hubkit keeps that record outside the model's memory, gives every order a clock and an evidence check, watches routed work for silence, and blocks the hub from ending a turn while it owes something. Example session:
@@ -29,10 +48,14 @@ In a live hub, the prompt hook opens that order itself from your sentence, and t
29
48
 
30
49
  - **Learns from corrections.** A prompt hook flags correction phrases and repeated instructions. `scripts/learn.py` records, promotes and verifies them. See [docs/architecture.md](docs/architecture.md#the-learn-loop).
31
50
  - **Order clock.** Orders open from your own prompts (never from peer or harness text), each with a first-action limit, a stall limit and a definition of done checked by evidence on close.
51
+ - **Requests and `hubkit mine`.** A plain ask from you ("delete the stale branches") opens a tracked request that closes only with evidence (`hubkit req done`); chases are counted, the Stop gate and watchdog hold the hub to it, and the overdue limit learns from past requests. `hubkit mine` lists everything open by whose court it is in.
52
+ - **Threads.** An ask, the job routed for it, its PR and the reply owed to whoever asked are linked into one thread (`For: <ID>` in a brief links by hand). `hubkit mine` shows one entry per thread with its current step; when the last step closes, hubkit names the command that closes the ask. A question-form ask ("can you delete the old branch?") is tracked too, and a list of asks becomes parts that close one by one (`hubkit req done ID --part N --evidence ".."`). Work with no PR declares its own check with a `Done-when:` line.
32
53
  - **Routed-work tracking.** A hook on `SendMessage` and `Agent` records what the hub asked of whom, one item per (owner, PR). It follows last heard-from, moved heads and GitHub reviews at the PR head.
54
+ - **Standing rules, review debt, stale items.** `hubkit standing add` saves what you said to do every time ("when peer-b approves, merge it"; "route review asks to the reviewer") with your quote; when it fires hubkit opens the order or item and prints the exact NEXT, and the hub does the action. `hubkit mine` also shows the re-reviews you owe and marks open items whose PR is already merged or closed. `report.eod_time` makes the tick write the end-of-day review itself.
55
+ - **Peer roster and pre-route checks.** `hubkit peers` shows each peer's role and free/busy state, learned from its own messages, with its record (jobs done, median time, late). The routed hook warns when work goes to a busy or wrong-role peer while a fitting one is free, when the PR is already merged, closed or reviewed at its head, and when a brief to a role lacks a line the config requires.
33
56
  - **Watchdog and wake-up.** `hubkit tick` (cron) and `hubkit watch` (a background process) raise alerts with back-off; a watch exit wakes an idle hub.
34
- - **Stop gate.** The Stop hook refuses to let the turn end while the hub owes something (no watch running, a stalled item, an unbacked verdict, a question to you that blocks nothing, a "tests pass" claim with no command run, a PR number with no link, an approval on red CI, built work not pushed).
35
- - **Tool guards.** An optional warn-only PreToolUse hook (`hubkit hooks --merge-guard`) warns about an unordered merge, a post without your typed yes, a banned command, stopping an agent and an unmarked decision card. It never denies.
57
+ - **Stop gate.** The Stop hook refuses to let the turn end while the hub owes something (no watch running, a stalled item, an unbacked verdict, a question to you that blocks nothing, a "tests pass" claim with no command run, a PR number with no link, an approval on red CI, a PR called ready to merge while GitHub shows changes requested or a block, a merged PR reported while a person who asked about it is not yet answered, built work not pushed).
58
+ - **Tool guards.** An optional warn-only PreToolUse hook (`hubkit hooks --merge-guard`) warns about an unordered merge, a post without your typed yes (typed after the draft it approves) or from the wrong account, a banned command, stopping an agent, an unmarked decision card, the hub editing files itself, two agents on one host and a review nobody asked for. It never denies.
36
59
  - **Status, digest, end-of-day review.** A status block at session start and on each prompt, a daily archive, `hubkit digest` for when you come back (it also lists the PRs your account opened and what each peer session was asked), `hubkit find WORD` to search orders, work, asks, peer prompts and your PRs, `hubkit eod`, a per-class `hubkit trust` ledger, and `hubkit inbound ingest` to track asks from other people so none goes unanswered.
37
60
 
38
61
  `SKILL.md` is the behaviour contract the hub session reads. This file is the operator view.
@@ -128,14 +151,23 @@ Every key is documented in [docs/configuration.md](docs/configuration.md).
128
151
 
129
152
  | Behaviour | Strength |
130
153
  |---|---|
154
+ | The Stop hook holds the turn on "ready to merge" while GitHub shows changes requested, a review required, a blocked, behind or conflicting branch or failing CI, and on a merged/approved/reviewed PR claim while a reply is owed to the person who asked about it | Enforced (blocks the turn end) |
131
155
  | The Stop hook holds the turn while the hub owes something: no watch running, a stalled item, an unbacked verdict, an unsolved blocker, an item over its estimate, a "done" while your newest prompt is unread, a claim of passing tests with no command run, an approval while CI is not green | Enforced (blocks the turn end) |
156
+ | A final message that states a time in UTC/GMT while `user.timezone` is another zone (`hubkit UTC-TIME`) | Enforced (blocks the turn end) |
157
+ | A final message that asks permission or waits for a go while an urgent order (`no_questions` kind, not held) is open | Enforced (blocks the turn end) |
158
+ | A final message longer than `report.max_lines` or with a code block longer than `report.max_code_lines` (off until set) | Warning only |
159
+ | A Stop-gate check that you mark a false alarm 3 times (`hubkit gate false-alarm ID --why ..`) and that is 30% of its fires in 14 days downgrades itself from blocking to a next-prompt warning; a correction soon after restores it. `verdict`, `ci` and `merge-state` never downgrade. | Adaptive (`hubkit gate ls`) |
160
+ | A typed "from now on ..." style rule: the prompt hook says to save it with `learn.py add --class standing-rule` | Warning only |
132
161
  | An order closes only with the evidence its kind requires | Enforced (the close is refused) |
133
162
  | A learned class counts as fixed only if a rule for it exists (and, with `--check`, its command passes) | Enforced (the address is refused) |
134
163
  | A merge order closes only with the merge commit sha | Enforced (the close is refused) |
135
164
  | A second job sent to a busy owner while an order is open; a brief that bans the action a blocker needs; a brief with no done-when, output or estimate line; more than 4 agents holding work | Warning only |
136
165
  | `gh pr merge` with no live order naming that PR, a post without your typed yes, a banned command, `TaskStop`, a repeated command, a whole-suite `pytest`, an unmarked decision card (`hubkit hook pretool`) | Warning only, never denies |
166
+ | A command matching `guards.needs_order` (for example a ticket-creating one) or a schedule/loop/cron tool or command, with no typed ask of the user in the last `guards.window_min` minutes (`hubkit watch` is exempt) | Warning only, never denies |
137
167
  | `hubkit doctor` warning when your `intents.toml` lacks keys the example has, a hook registered twice, or no scheduled `hubkit eod` | Warning only |
138
168
 
169
+ Every Stop-gate rule is named by a check id and holds the turn once per stop: when the harness has already sent the hub back (`stop_hook_active`), the turn is allowed to end.
170
+
139
171
  Details and exact rules: [SKILL.md](SKILL.md) and [docs/architecture.md](docs/architecture.md#stop-gate-gatepy).
140
172
 
141
173
  ## Documentation
@@ -168,6 +200,10 @@ hubkit has only been run on Linux so far, and the full test suite, ruff and mypy
168
200
  - Redaction matches secret shapes and `key=value` forms. Natural-language secrets ("the password is hunter2") are not caught. See [SECURITY.md](SECURITY.md).
169
201
  - Whether a message to a peer is an ask, a reply or a follow-up is decided by rules in `scripts/hubcore/routed.py`; an unusual message can be misjudged.
170
202
  - The learn loop needs the hub model to act on the `CORRECTION` line; hubkit cannot make it record or write a rule, only refuse to mark a class fixed without one.
203
+ - Whether a typed sentence is an ask is decided from verb lists in `intents.toml`; a casual remark can open a request and an oddly worded ask can be missed. `hubkit req drop ID --not-a-request` and `hubkit req add` correct it, and a verb that keeps misfiring is muted.
204
+ - The checks are proven at hook level by the test suite. No automated test drives a live Claude Code session, so whether the hub model acts on a line it is shown is checked only by use.
205
+ - The watchdog can alert the user on the desktop; it cannot make an idle hub session act.
206
+ - Each new warning is rate-limited on its own, but there is no overall cap on lines per prompt yet.
171
207
  - `skills/hub-mep` describes an optional integration with the `mep` task-list CLI and is of no use without it.
172
208
  - Hooks are written against the Claude Code hook payloads of late 2026; `payload-samples/` in the state dir records the real payload keys so a schema change is visible.
173
209
 
@@ -16,8 +16,10 @@ Every write to state passes through `scripts/hubcore/redact.py`. It masks these
16
16
  - JSON web tokens, PEM private key headers
17
17
  - credentials in URLs (`scheme://user:password@host`)
18
18
  - `Bearer ...` and `Authorization:` values
19
- - `name=value` or `name: value` pairs whose name contains password, secret, token, api key, auth, credential or private key
20
- - long (32 or more characters) runs of letters and digits that mix both
19
+ - `name=value` or `name: value` pairs whose name is, or has a segment that is, password, secret, token, api key, auth, credential or private key (`api_token`, `AUTH_TOKEN`, `x-auth-token`); words that merely contain one (`author`, `tokenizer`, `authentication flow:`) are left alone
20
+ - long (32 or more characters) runs of letters and digits that mix both, except a run of pure lowercase hex of exactly 40 characters (a git commit id) or 32 (a dashless uuid / md5), which are kept so notes stay readable. A mixed-case, base64-like or longer run is masked.
21
+
22
+ A match is replaced in place by `[REDACTED]`; the text before and after it is kept.
21
23
 
22
24
  It does **not** catch:
23
25
 
@@ -26,4 +28,4 @@ It does **not** catch:
26
28
  - personal data that is not a secret: names, emails, internal hostnames, ticket text. Those are stored as typed.
27
29
  - anything outside the state directory: your shell history, Claude Code transcripts, `gh` output you paste into a prompt
28
30
 
29
- A 40-hex git sha is kept unredacted only under head and commit fields, so PR heads can be compared. `hubkit doctor` reports a count of secret-shaped strings found in state, never the strings. Treat the state directory as sensitive and do not put it in a git repository (hubkit refuses to).
31
+ A 40-hex git sha is kept wherever it appears, so PR heads can be compared and quotes stay readable (a secret that happens to be exactly 40 lowercase hex characters is the accepted trade-off). `hubkit doctor` reports a count of secret-shaped strings found in state, never the strings. Treat the state directory as sensitive and do not put it in a git repository (hubkit refuses to).
@@ -9,6 +9,10 @@ The hub coordinates. It does not work. Correct behaviour is the default: route f
9
9
 
10
10
  **At session start and after every compaction:** the SessionStart hook prints a `hubkit:` block (live work, open orders with clocks, recent learnings). Read it, then the overlay (`hubkit doctor` prints its path; default `~/.config/hubkit/overlay.md`): the people, accounts, machines and routing that are personal to this user. The overlay wins over this file where they differ. A compaction summary is a hint, not evidence. If the block is missing, run `hubkit status` and `python3 ~/.claude/skills/hub/scripts/learn.py list --last 30`.
11
11
 
12
+ **Start from the record, not from memory:** run `hubkit next` (the one most urgent action, with its exact command) and `hubkit mine` (everything open by whose court it is in). Read verbs take `--json` (one JSON document on stdout). Exit codes: 0 ok, 2 bad usage, 3 refused (missing evidence, the state forbids it), 4 not found; every error ends with `NEXT: <command>`, so run that. One command per tracker: requests `hubkit req ls`, the peer roster `hubkit peers ls`, asks from other people `hubkit inbound ls` (then `hubkit inbound replied ID --note ".."`), Stop-gate checks `hubkit gate ls` (`hubkit gate false-alarm ID --why ".."` when one fired wrongly), standing rules `hubkit standing ls`, playbooks `hubkit how ls`.
13
+
14
+ **Working rules from the user's own corrections.** Start preparation (briefs, fetching, the next step) in parallel with a review instead of after it. When quoting an order, repeat only the user's own words, not a paraphrase. If a start or stop word in the user's message is ambiguous ("go", "hold", "stop"), confirm which they mean before acting. Before answering "is X done", re-read live state (`hubkit order status`, `gh`), never an earlier answer. State a process exactly as the user set it, with their steps and their order. Ask early, in one batch, then keep working on everything else while the user is away.
15
+
12
16
  ## 1. The role
13
17
 
14
18
  Three verbs only: **Brief** (hand complete work to an agent or peer), **Read to decide** (one result, diff or thread), **Decide / report**. Anything else is work, and work goes to someone else.
@@ -41,9 +45,11 @@ A human prompt containing an order word (words come from `intents.toml`; hotfix,
41
45
 
42
46
  - **(a) A blocker on ordered work is the hub's to solve, not to report.** The moment something blocks an open order (no host, a tool down, an agent's report of a failure), start the fix on a free owner, then record it: `hubkit order block <id> --on "<what>" --fix "<action running now>" --holder <who>`, and confirm it ran: `hubkit order result <id> --note "<what came of it>"`. A blocker with no fix, or a fix with no result after `blocker_fix_min` (3), alerts and holds the Stop gate; notes (`order move`) do not reset the idle clock of a blocked order, only a result does. *Enforced in code.*
43
47
  - **(a2) Saying it is blocked is not solving it.** A final message that calls an open order blocked, down, failed or waiting on a host, tool or person is held until a block record with a fix exists (word list: `intents.toml` `[stop_gate]`). *Enforced in code.*
44
- - **(b) An urgent step never queues behind other work on a busy agent.** Send it to a free owner. The routed hook warns when a second job goes to an owner already holding a live job while an order is open. *Warning enforced in code; the choice of owner is prose.*
45
- - **(f) Re-read his words before saying done.** `hubkit asks ls --since 12h` prints his recent prompts one per line; a final message that says done while his newest prompt is newer than the last `work done` and the last `asks ls` is held. *Enforced in code.*
46
- - **(g) A merge is done on his order only.** `hubkit hook pretool` (register it with `hubkit hooks --merge-guard`) warns, never denies, on `gh pr merge` with no live order and none of his typed words naming that PR; the same hook also warns on posts without his typed yes, banned commands, stopping an agent and an unmarked decision card. *Warning only.*
48
+ - **(b) An urgent step never queues behind other work on a busy agent.** Send it to a free owner. The routed hook warns when a second job goes to an owner already holding a live job while an order is open. *Warning enforced in code; the choice of owner is prose.* The peer roster (`hubkit peers ls`, learned from the peers' own messages) names a free fitting peer, best record first; the routed hook also warns when the PR is already merged or closed or already reviewed at its head, and when a role's `brief_must_include` line is missing.
49
+ - **(f2) The user's plain asks are requests.** The prompt hook opens one for an imperative ("delete the stale branches"); close it with `hubkit req done ID --evidence ".."` (note progress with `req note`); a chase on it is answered from the record. A question-form ask ("can you delete X?") and each item of a list also open one, a multi-part ask closes part by part (`req done ID --part N --evidence ".."`); if the hook opened one wrongly run `hubkit req drop ID --not-a-request`, if it missed one run `hubkit req add "<the user's words>"`. `hubkit mine` lists everything open by whose court it is in, one entry per thread (an ask with its routed jobs and replies owed). In a brief add `For: <ID>` to link the job to its ask, and for a job with no PR a line `Done-when: <command, file or URL that shows it>`; when every step under a root is closed hubkit prints the close command, you confirm it. *Enforced in code.*
50
+ - **(f) Re-read the user's words before saying done.** `hubkit asks ls --since 12h` prints the user's recent prompts one per line; a final message that says done while the user's newest prompt is newer than the last `work done` and the last `asks ls` is held. *Enforced in code.*
51
+ - **(f3) Standing rules are stored, not remembered.** When the user says "when X approves, merge it" or "route review asks to the reviewer", save it with their quote: `hubkit standing add --on approved|inbound --quote ".." --action ".."` (`--until DATE` to expire). When it fires (an approval at the head, or a new ask) hubkit opens the order or work item and prints the exact NEXT; you do the action, hubkit never does. `hubkit mine` lists fired rules not yet acted on. Re-reviews the user owes show under ON THE USER; an item marked "probably stale" names a PR already merged or closed: check it, then close it. A routed item with no PR whose owner said done has nothing to check: check the result yourself, then `hubkit work done ID --note ".."`. *Enforced in code (hubkit only warns).*
52
+ - **(g) A merge is done on the user's order only.** `hubkit hook pretool` (register it with `hubkit hooks --merge-guard`) warns, never denies, on `gh pr merge` with no live order and none of the user's typed words naming that PR; the same hook also warns on posts without his typed yes (typed after the draft) or from the wrong account, banned commands, stopping an agent and an unmarked decision card. The hub does not edit files itself (`INLINE-EDIT`): route it with a brief. Do not send a review nobody asked for (`NO-ASK-REVIEW`) or a second agent to a busy host (`HOST-BUSY`); a review report missing required steps (`REPORT-INCOMPLETE`) is sent back before you relay it. *Warning only.*
47
53
  - **(c) An agent's "that is a person's call" is checked, not relayed.** Read what the person already decided (the record, the order's words) before asking or telling anyone it needs them. *Checked in code:* a final message that relays "a person's call" with no Read/Grep/Glob/Bash call in that turn is held at the Stop gate (words: `intents.toml` `[stop_gate] unchecked_words`).
48
54
  - **(d) Before saying something is gone or absent, read the code that writes it.** A missing file, row or log line is proof of nothing until you know what produces it and when. *Checked in code:* a final message that says something is gone, lost or absent, with no lookup in that turn, is held the same way.
49
55
  - **(e) A brief must not forbid the one action that clears the blocker.** Before sending a brief, check its banned-command list against the step the order needs. *Checked in code:* the routed hook warns when a brief's "do not / never" line shares a key word with an open order's blocker or fix.
@@ -56,7 +62,7 @@ A human prompt containing an order word (words come from `intents.toml`; hotfix,
56
62
 
57
63
  - A message naming a PR, or a long one, or a background agent brief that asks for a result, opens an item. A later message to that owner is a chase: it counts (`chased Nx`) and never resets the ask's clock. **Only a new brief (`Done-when`, `Output`) is a new ask.**
58
64
  - A review item closes itself, PR by PR, when a non-author review lands at the PR's current head (on a PR written by `user.github_login`, a COMMENT review with a body counts); a review on an older head never closes it.
59
- - By hand: `hubkit work add --kind routed --owner X --title ".." --pr URL --head SHA`; close with `hubkit work done <id> --note ".."`. A question that really blocks ordered work: `hubkit work add --kind ask --title ".." --note ".."` (his card answer closes it).
65
+ - By hand: `hubkit work add --kind routed --owner X --title ".." --pr URL --head SHA`; close with `hubkit work done <id> --note ".."`. A question that really blocks ordered work: `hubkit work add --kind ask --title ".." --note ".."` (their card answer closes it).
60
66
 
61
67
  ## 5. Before saying anything is pending on the user
62
68
 
@@ -71,7 +77,7 @@ Silence on routed work past `stall_min` (reviews: `review_stall_min`, hard `OVER
71
77
 
72
78
  **Wake-up.** The hub runs `hubkit watch --interval 120 --max-cycles 30` in the background (one at a time). It exits 0 printing `ALERT ..` on a new alert or a backed-off repeat, which wakes you; it exits 3 after its cycles, so re-arm it. Cron runs `hubkit tick --if-bound` as a backstop; overdue orders also reach the hub at its next prompt.
73
79
 
74
- **The Stop hook blocks the turn end** (JSON `decision: block`, shown to you) while: routed work is open and no watch runs; an item needs action; the message ends on a question to the user and no `hubkit work add --kind ask` item exists; or a sentence gives a verdict on a PR of a review item while GitHub shows no counting review at its head (non-author, or a COMMENT with a body on a PR written by `user.github_login`). Follow the `NEXT:` in the reason.
80
+ **The Stop hook blocks the turn end** (JSON `decision: block`, shown to you) while: routed work is open and no watch runs; an item needs action; the message ends on a question to the user and no `hubkit work add --kind ask` item exists; or a sentence gives a verdict on a PR of a review item while GitHub shows no counting review at its head (non-author, or a COMMENT with a body on a PR written by `user.github_login`). A person who asked you for a review is owed the answer: when their PR is merged or reviewed, reply and run `hubkit inbound replied <id> --note "<what you sent>"` (`hubkit inbound ls` shows who asked and what is due); never call a PR ready for the user's merge unless GitHub shows nothing blocking it. Follow the `NEXT:` in the reason. A hold ends `[check: ID; ...]`: if it was wrong, run `hubkit gate false-alarm ID --why "<why>"` (a check wrong often enough downgrades itself to a `hubkit WARNING` line; `hubkit gate ls`). While an urgent order (hotfix, release) is open and not held, never ask permission or wait for a go: act, or record the blocker. A `hubkit RULE` line means the user stated a standing rule: save it with the `learn.py add` command it prints. Keep final messages short, the result first, detail in a file (`report-length`, `report-code` warn). Every Stop-gate rule holds the turn once per stop: when the harness has already sent the hub back (`stop_hook_active`), the turn is allowed to end. Give times in the user's zone, not UTC (`hubkit UTC-TIME` holds a final message that states a UTC time). Do not create tickets or set up recurring work (cron, loops) the user did not ask for: the pre-tool guard warns (`NEEDS-ORDER`, `UNORDERED-SCHEDULE`). A `hubkit REGRESSED <class>` line at the top of the status block means a rule you wrote did not hold: add a `--check` or rewrite it.
75
81
 
76
82
  `hubkit doctor` prints the bind, heartbeat ages (`seen/cron` is touched by every `tick`, so it tells a dead cron from an idle one), hook errors and a count of secret-shaped strings in state (never the strings).
77
83
 
@@ -111,7 +117,7 @@ If a rule here contradicts what the user says now, their latest words win; fix t
111
117
 
112
118
  Everything personal is in `~/.config/hubkit/`: `config.toml` (names, zone, tools, paths, private terms), `intents.toml` (order words, clocks, evidence names), `overlay.md` (rules), `ext/*.py` (optional extensions). Keys: `docs/configuration.md`. This file and the scripts carry no personal names; `hubkit doctor --check-clean` checks that against `private.terms`.
113
119
 
114
- All state writes are redacted (8 token shapes, `key=value` secrets, long base64/hex runs). Natural-language secrets ("the password is hunter2") are not caught. State is in `$XDG_STATE_HOME/hubkit` (override `$HUBKIT_STATE`), refused if inside a git repo or this directory.
120
+ All state writes are redacted in place (each secret becomes `[REDACTED]`, the words around it stay): 8 token shapes, `key=value` secrets by whole key name (`api_token`, not `author`), long base64-like runs. A bare lowercase 40-hex commit id (or 32-hex id) is kept. Natural-language secrets ("the password is hunter2") are not caught. State is in `$XDG_STATE_HOME/hubkit` (override `$HUBKIT_STATE`), refused if inside a git repo or this directory.
115
121
 
116
122
  **Install** (details in `README.md`): hooks in `~/.claude/settings.json` run `hubkit hook <session|prompt|answer|routed|stop|record>`; bind once per hub session with `hubkit bind` (interactive sessions only; liveness is pid plus process start time, so a crashed hub frees the bind, and a resumed hub session re-binds itself without ever taking over a live hub). Hooks no-op in every session that is not the live bound hub and in headless runs, always exit 0, and show or log errors only for the hub. If hubkit fails to import, the hook exits 0 and appends to `import-errors.log` in the state dir. Deny hooks are not part of this version.
117
123