hubkit-cli 0.1.0__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.
- hubkit_cli-0.1.0/.gitignore +6 -0
- hubkit_cli-0.1.0/CHANGELOG.md +36 -0
- hubkit_cli-0.1.0/CLAUDE.md +55 -0
- hubkit_cli-0.1.0/CONTRIBUTING.md +30 -0
- hubkit_cli-0.1.0/LICENSE +202 -0
- hubkit_cli-0.1.0/PKG-INFO +195 -0
- hubkit_cli-0.1.0/README.md +181 -0
- hubkit_cli-0.1.0/SECURITY.md +29 -0
- hubkit_cli-0.1.0/SKILL.md +125 -0
- hubkit_cli-0.1.0/config.example.toml +84 -0
- hubkit_cli-0.1.0/docs/architecture.md +133 -0
- hubkit_cli-0.1.0/docs/commands.md +66 -0
- hubkit_cli-0.1.0/docs/configuration.md +151 -0
- hubkit_cli-0.1.0/docs/troubleshooting.md +21 -0
- hubkit_cli-0.1.0/intents.example.toml +74 -0
- hubkit_cli-0.1.0/pyproject.toml +62 -0
- hubkit_cli-0.1.0/references/design-sources.md +14 -0
- hubkit_cli-0.1.0/references/research.md +49 -0
- hubkit_cli-0.1.0/scripts/hubcore/__init__.py +1 -0
- hubkit_cli-0.1.0/scripts/hubcore/cli.py +273 -0
- hubkit_cli-0.1.0/scripts/hubcore/compat.py +187 -0
- hubkit_cli-0.1.0/scripts/hubcore/config.py +107 -0
- hubkit_cli-0.1.0/scripts/hubcore/gate.py +145 -0
- hubkit_cli-0.1.0/scripts/hubcore/hooks.py +326 -0
- hubkit_cli-0.1.0/scripts/hubcore/install.py +66 -0
- hubkit_cli-0.1.0/scripts/hubcore/learnings.py +232 -0
- hubkit_cli-0.1.0/scripts/hubcore/lessons.py +168 -0
- hubkit_cli-0.1.0/scripts/hubcore/orders.py +508 -0
- hubkit_cli-0.1.0/scripts/hubcore/redact.py +89 -0
- hubkit_cli-0.1.0/scripts/hubcore/routed.py +1169 -0
- hubkit_cli-0.1.0/scripts/hubcore/slow.py +531 -0
- hubkit_cli-0.1.0/scripts/hubcore/status.py +535 -0
- hubkit_cli-0.1.0/scripts/hubcore/store.py +172 -0
- hubkit_cli-0.1.0/scripts/hubcore/watcher.py +167 -0
- hubkit_cli-0.1.0/scripts/hubkit +37 -0
- hubkit_cli-0.1.0/scripts/learn.py +84 -0
- hubkit_cli-0.1.0/skills/hub-mep/SKILL.md +35 -0
- hubkit_cli-0.1.0/skills/hubkit-setup/SKILL.md +50 -0
- hubkit_cli-0.1.0/tests/conftest.py +116 -0
- hubkit_cli-0.1.0/tests/run_reverts.py +328 -0
- hubkit_cli-0.1.0/tests/test_blockers.py +146 -0
- hubkit_cli-0.1.0/tests/test_compat.py +82 -0
- hubkit_cli-0.1.0/tests/test_hubkit.py +2207 -0
- hubkit_cli-0.1.0/tests/test_install.py +74 -0
- hubkit_cli-0.1.0/tests/test_lessons.py +202 -0
- hubkit_cli-0.1.0/tests/test_peer_reports.py +83 -0
- hubkit_cli-0.1.0/tests/test_slow.py +167 -0
- hubkit_cli-0.1.0/tests/test_watcher.py +336 -0
|
@@ -0,0 +1,36 @@
|
|
|
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
|
+
## [Unreleased]
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
- Install like miseenplace: `uv tool install hubkit-cli` (wheel built and installed in a scratch venv; not published), `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.
|
|
9
|
+
- macOS and Windows support through one platform module (`hubcore/compat.py`); only Linux has been run so far.
|
|
10
|
+
- Blockers (`order block|result`), watcher fixes, peer-report closing, `asks ls`, and warn-only merge guard.
|
|
11
|
+
- Apache-2.0 license, `README.md` rewrite, `docs/` (architecture, configuration, commands, troubleshooting), `CONTRIBUTING.md`, `SECURITY.md`.
|
|
12
|
+
- `pyproject.toml` with package metadata and ruff, mypy and pytest settings.
|
|
13
|
+
- Tests for `learn.py promote-candidates`, `review` and the `address` error path, the entry-point import-failure path, and `doctor --check-clean`.
|
|
14
|
+
|
|
15
|
+
### Fixed
|
|
16
|
+
- 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.
|
|
17
|
+
- 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.
|
|
18
|
+
- PR numbers in examples, quotes and code spans of a brief are not tracked. Acknowledgements that name a PR are not tracked.
|
|
19
|
+
- "waiting on the verdict" and similar awaiting wording no longer trips the verdict check.
|
|
20
|
+
- `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.
|
|
21
|
+
- `order close` requires evidence for every PR named in the order and names the missing ones.
|
|
22
|
+
- A completed agent's task notification closes its routed item. Work ids are never reused after archive (`work.seq`).
|
|
23
|
+
- `doctor` flags a stale or missing `seen/cron` when the crontab runs hubkit (`watchdog.cron_stale_min`).
|
|
24
|
+
|
|
25
|
+
### Changed
|
|
26
|
+
- `mep: UNVERIFIED` now says that the optional `mep` CLI was not found and how to turn the check off (`[mep] enabled = false`).
|
|
27
|
+
- `doctor --check-clean` no longer scans `.git/` and also scans `.yml` and `.yaml` files.
|
|
28
|
+
- Docstrings and type annotations on public functions; `SKILL.md` and `skills/` reworded for clarity.
|
|
29
|
+
- The learnings file preamble says promoted rules go to the overlay.
|
|
30
|
+
|
|
31
|
+
### Removed
|
|
32
|
+
- The unused `tools.mep_cursor` config key.
|
|
33
|
+
|
|
34
|
+
## [0.1.0] - 2026-11-04
|
|
35
|
+
|
|
36
|
+
Initial private version: order clock, routed-work tracking, watchdog, stop gate, status block, end-of-day review and the learn loop.
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# CLAUDE.md
|
|
2
|
+
|
|
3
|
+
Guidance for an agent changing hubkit. Read `README.md` for what it does and `SKILL.md` for the behaviour contract the hub follows.
|
|
4
|
+
|
|
5
|
+
## Layout
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
SKILL.md behaviour contract for the hub session (keep under ~200 lines)
|
|
9
|
+
README.md operator view docs/ architecture, configuration, commands, troubleshooting
|
|
10
|
+
LICENSE (Apache-2.0) pyproject.toml ruff, mypy, pytest settings
|
|
11
|
+
config.example.toml generic config template intents.example.toml generic intents
|
|
12
|
+
references/ design notes
|
|
13
|
+
scripts/hubkit entry point (hooks never raise; an import failure is logged and exits 0)
|
|
14
|
+
scripts/learn.py learnings log CLI
|
|
15
|
+
scripts/hubcore/
|
|
16
|
+
cli.py argparse verbs, doctor
|
|
17
|
+
config.py defaults + config loading (DEFAULTS is the full key list)
|
|
18
|
+
hooks.py the hook events, bind/unbind, is_hub
|
|
19
|
+
orders.py order ledger, intake, evidence-checked close
|
|
20
|
+
routed.py routed-work items: record/chase/ladder, gh reads, heard-from, close
|
|
21
|
+
gate.py Stop-gate reasons
|
|
22
|
+
slow.py job records, estimates, usual-time baseline, SLOW check, estimate vs actual
|
|
23
|
+
watcher.py hub/peer/watch/cron checks, desktop notify, false-alarm excuses, blocked-on link
|
|
24
|
+
status.py work items, tick/watch, status block, EOD
|
|
25
|
+
store.py state dir, locked/atomic writes, row IO
|
|
26
|
+
redact.py secret redaction (every write passes through it)
|
|
27
|
+
learnings.py learnings log
|
|
28
|
+
tests/conftest.py `env` fixture: scratch state, fake sessions, `env.run`/`env.hook`
|
|
29
|
+
tests/test_hubkit.py all tests
|
|
30
|
+
tests/run_reverts.py revert proof
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Run
|
|
34
|
+
|
|
35
|
+
```
|
|
36
|
+
python3 -m pytest tests -q
|
|
37
|
+
ruff check . && mypy scripts/hubcore scripts/learn.py scripts/hubkit
|
|
38
|
+
python3 tests/run_reverts.py # slow (minutes), prints one line per entry, exits 0 only if all are OK
|
|
39
|
+
python3 scripts/hubkit doctor --check-clean
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Use the scratch state the `env` fixture gives. For a manual run set `HUBKIT_STATE` and `HUBKIT_CONFIG` to a scratch directory; never point tests or experiments at the live state dir or the live bind.
|
|
43
|
+
|
|
44
|
+
## Rules
|
|
45
|
+
|
|
46
|
+
- Every behaviour gets a test and a `run_reverts.py` entry: `(name, file, old, new, test)`, where `old` occurs exactly once in `file`, `new` breaks the behaviour, and `test` fails with it. An entry whose pattern is gone or whose test is not collected is reported BROKEN; fix or delete it. Do not edit `scripts/` while a revert run is in progress (it copies them per entry).
|
|
47
|
+
- A test must be able to fail. Only GitHub (`gh`) may be a local stand-in, and only because tests cannot reach it; say so in the test. Use real 40-hex shas for heads.
|
|
48
|
+
- Hooks always exit 0 and print nothing outside the bound hub. Fail loud inside the logic, not silently in the hook.
|
|
49
|
+
- Config keys have defaults in `config.py` `DEFAULTS`; add new keys there and in `config.example.toml`.
|
|
50
|
+
- Python 3.14; `except A, B:` without parentheses is the required form. Type annotations on functions; stdlib only.
|
|
51
|
+
- Keep `SKILL.md`, `README.md` and `docs/` true: when a behaviour or verb changes, change them in the same edit, and check every command and path you write against the code.
|
|
52
|
+
|
|
53
|
+
## No personal data in this directory
|
|
54
|
+
|
|
55
|
+
No person's name, host, company or product term in scripts, tests, skill text or docs. `hubkit doctor --check-clean` scans these files for the terms in `[private] terms` of your config and must report none. Personal rules, names, terms and evidence live in `~/.config/hubkit/` (`config.toml`, `intents.toml`, `overlay.md`, `research/`), never here. Tests use neutral names such as `peer-a`.
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Contributing
|
|
2
|
+
|
|
3
|
+
Thanks for looking. hubkit is small on purpose: standard library only, Python 3.14. Linux is tested; macOS and Windows code exists but is unproven (see the README).
|
|
4
|
+
|
|
5
|
+
## Set up and run the checks
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
git clone https://github.com/ankitkpandey1/hubkit && cd hubkit
|
|
9
|
+
pip install pytest ruff mypy coverage
|
|
10
|
+
python3 -m pytest tests -q # about 2 minutes: real subprocesses
|
|
11
|
+
ruff check .
|
|
12
|
+
mypy scripts/hubcore scripts/learn.py scripts/hubkit
|
|
13
|
+
python3 tests/run_reverts.py # slow; run it when you touch a guarded behaviour
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Tests and experiments use scratch state: set `HUBKIT_STATE` and `HUBKIT_CONFIG` to a temporary directory, or use the `env` fixture. Never point them at a live state directory or a live bind.
|
|
17
|
+
|
|
18
|
+
## Rules
|
|
19
|
+
|
|
20
|
+
- Every behaviour gets a test, and a guard gets a `tests/run_reverts.py` entry `(name, file, old, new, test)`: `old` occurs exactly once in `file`, `new` breaks the behaviour, and `test` fails with it.
|
|
21
|
+
- A test must be able to fail. Do not mock hubkit's own code. Only `gh` may be a local stand-in, because tests cannot reach GitHub; say so in the test. Use real 40-hex shas for heads.
|
|
22
|
+
- Hooks always exit 0 and print nothing outside the bound hub.
|
|
23
|
+
- A new config key needs a default in `scripts/hubcore/config.py` (`DEFAULTS`), an entry in `config.example.toml` and a row in `docs/configuration.md`.
|
|
24
|
+
- Type annotations on functions, a docstring on public ones, standard library only. `except A, B:` without parentheses (PEP 758) is the required form.
|
|
25
|
+
- Keep `SKILL.md`, `README.md` and `docs/` true: change them in the same edit as the behaviour, and check each command and path against the code.
|
|
26
|
+
- No personal names, hosts, companies or product terms in any file. Personal rules and names belong in the user's own `~/.config/hubkit/`. Tests use neutral names such as `peer-a`.
|
|
27
|
+
|
|
28
|
+
## Pull requests
|
|
29
|
+
|
|
30
|
+
Keep a change to one concern. Say what you ran. Add a line to `CHANGELOG.md` under Unreleased. By contributing you agree that your contribution is licensed under the Apache License 2.0, the same as the project.
|
hubkit_cli-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: hubkit-cli
|
|
3
|
+
Version: 0.1.0
|
|
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
|
+
Project-URL: Repository, https://github.com/ankitkpandey1/hubkit
|
|
6
|
+
Project-URL: Documentation, https://github.com/ankitkpandey1/hubkit/tree/main/docs
|
|
7
|
+
Project-URL: Issues, https://github.com/ankitkpandey1/hubkit/issues
|
|
8
|
+
Author: Ankit Kumar Pandey
|
|
9
|
+
License-Expression: Apache-2.0
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: adaptive,agent-coordination,agents,claude-code,hooks,multi-agent,orchestration,supervisor,watchdog
|
|
12
|
+
Requires-Python: >=3.14
|
|
13
|
+
Description-Content-Type: text/markdown
|
|
14
|
+
|
|
15
|
+
# hubkit
|
|
16
|
+
|
|
17
|
+
[](LICENSE)
|
|
18
|
+

|
|
19
|
+

|
|
20
|
+
|
|
21
|
+
**hubkit is a session supervisor for Claude Code: a hooks-based kit for multi-agent orchestration that keeps the one session coordinating your other sessions and agents honest. It gives each order a clock, tracks work routed to peers, blocks a premature "done", and learns from your corrections.**
|
|
22
|
+
|
|
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
|
+
|
|
25
|
+
## Why use a Claude Code session supervisor
|
|
26
|
+
|
|
27
|
+
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:
|
|
28
|
+
|
|
29
|
+
```console
|
|
30
|
+
$ hubkit order open --kind hotfix --quote "hotfix the billing bug now"
|
|
31
|
+
O-261105-bd22 hotfix [open] open 0m, idle 0m, chases 0; done needs: pr_merged,prod_live
|
|
32
|
+
$ hubkit order move O-261105-bd22 --note "PR merged"
|
|
33
|
+
$ hubkit order close O-261105-bd22 --evidence pr_merged=https://github.com/acme/repo/pull/12
|
|
34
|
+
error: close refused: missing evidence 'prod_live'
|
|
35
|
+
$ hubkit order close O-261105-bd22 --evidence pr_merged=https://github.com/acme/repo/pull/12 \
|
|
36
|
+
--evidence prod_live=https://example.com/deploy-log
|
|
37
|
+
O-261105-bd22 closed
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
In a live hub, the prompt hook opens that order itself from your sentence, and the hub only reports "done" after the close succeeds.
|
|
41
|
+
|
|
42
|
+
## What hubkit does for multi-agent coordination
|
|
43
|
+
|
|
44
|
+
- **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
|
+
- **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.
|
|
46
|
+
- **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.
|
|
47
|
+
- **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).
|
|
49
|
+
- **Status, end-of-day review.** A status block at session start and on each prompt, a daily archive, and `hubkit eod`.
|
|
50
|
+
|
|
51
|
+
`SKILL.md` is the behaviour contract the hub session reads. This file is the operator view.
|
|
52
|
+
|
|
53
|
+
## Requirements
|
|
54
|
+
|
|
55
|
+
- Linux. hubkit has only been run on Linux; macOS and Windows code exists but has never been run (see [Platform support](#platform-support)).
|
|
56
|
+
- Python 3.14 or newer (the code uses `except A, B:` without parentheses, PEP 758). Standard library only.
|
|
57
|
+
- [Claude Code](https://code.claude.com), which provides the hooks and the skills directory.
|
|
58
|
+
- Optional: `gh` (GitHub CLI) on `PATH` for PR checks; without it items show "PR unknown". Optional: [`mep`](https://pypi.org/project/miseenplace-cli/) for a personal task list in the status block; without it the block shows `mep: UNVERIFIED (mep CLI not found ...)`, and `[mep] enabled = false` silences that.
|
|
59
|
+
|
|
60
|
+
## Paste this into your agent
|
|
61
|
+
|
|
62
|
+
```text
|
|
63
|
+
Install hubkit with `uv tool install hubkit-cli`, run `hubkit skills --install DIR` with the skills directory
|
|
64
|
+
for your tool, then run the hubkit-setup skill and follow it. Ask me only for things you cannot find out yourself.
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
hubkit runs on Claude Code hooks, so the skills directory is Claude Code's: `~/.claude/skills` (user level) or `.claude/skills` (project level). The PyPI name `hubkit-cli` is free as of 2026-11-06 and is not published yet; until it is, install straight from GitHub with `uv tool install git+https://github.com/ankitkpandey1/hubkit` (or from a clone with `uv tool install ./hubkit`).
|
|
68
|
+
|
|
69
|
+
`hubkit skills --install DIR` copies three skills into `DIR`: `hub` (the rules and the scripts the hooks run), `hub-mep` (optional) and `hubkit-setup` (finds your facts, writes the config, registers the hooks, binds, proves it with `hubkit doctor`). Run it again after an upgrade to refresh the copies. `hubkit hooks --skills-dir DIR` prints the hooks block for `~/.claude/settings.json`.
|
|
70
|
+
|
|
71
|
+
### Install by hand
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
git clone https://github.com/ankitkpandey1/hubkit ~/.claude/skills/hub
|
|
75
|
+
python3 --version # 3.14 or newer
|
|
76
|
+
python3 ~/.claude/skills/hub/scripts/hubkit doctor
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
The directory name must be `hub`: Claude Code finds the skill there, and the hooks and the stop gate use that path. `doctor` prints the config and state paths, the bind and the hook heartbeats; on a fresh install it shows `config: ... (defaults)` and `bind: none or dead`, which is correct.
|
|
80
|
+
|
|
81
|
+
## Claude Code hook setup
|
|
82
|
+
|
|
83
|
+
Add the hooks to `~/.claude/settings.json` (merge with any existing `hooks` block). Each command is a shim that prints a visible line if the script is missing, then runs one hook event:
|
|
84
|
+
|
|
85
|
+
```json
|
|
86
|
+
{
|
|
87
|
+
"hooks": {
|
|
88
|
+
"SessionStart": [{"hooks": [{"type": "command", "command": "[ -f $HOME/.claude/skills/hub/scripts/hubkit ] || echo 'hubkit: script missing'; python3 $HOME/.claude/skills/hub/scripts/hubkit hook session"}]}],
|
|
89
|
+
"UserPromptSubmit": [{"hooks": [{"type": "command", "command": "python3 $HOME/.claude/skills/hub/scripts/hubkit hook prompt"}]}],
|
|
90
|
+
"PostToolUse": [
|
|
91
|
+
{"matcher": "AskUserQuestion", "hooks": [{"type": "command", "command": "python3 $HOME/.claude/skills/hub/scripts/hubkit hook answer"}]},
|
|
92
|
+
{"matcher": "SendMessage|Agent", "hooks": [{"type": "command", "timeout": 6, "command": "python3 $HOME/.claude/skills/hub/scripts/hubkit hook routed"}]}
|
|
93
|
+
],
|
|
94
|
+
"Stop": [{"hooks": [{"type": "command", "command": "python3 $HOME/.claude/skills/hub/scripts/hubkit hook stop"}]}]
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Hooks do nothing, print nothing and exit 0 in every session that is not the bound hub. Then, in the session that is to be the hub (interactive sessions only):
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
python3 ~/.claude/skills/hub/scripts/hubkit bind # --pid N to name the process
|
|
103
|
+
python3 ~/.claude/skills/hub/scripts/hubkit doctor # now shows "bind: live <name>"
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
`hubkit unbind` frees it. For the `hubkit` command used below, add an alias such as `alias hubkit='python3 ~/.claude/skills/hub/scripts/hubkit'`.
|
|
107
|
+
|
|
108
|
+
## Quick start
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
hubkit order open --kind hotfix --quote "hotfix the billing bug now" # or let the prompt hook do it
|
|
112
|
+
hubkit order ls
|
|
113
|
+
hubkit work add --kind active --title "triage the flaky test"
|
|
114
|
+
hubkit status # the status block
|
|
115
|
+
python3 ~/.claude/skills/hub/scripts/learn.py add --class ask-before-merge --gate G5 \
|
|
116
|
+
--quote "I told you to wait for the review" --situation "..." --wrong "..." --right "..." --evidence "..."
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
Optional cron line for the watchdog (a no-op unless a hub is bound or an order is open). hubkit needs Python 3.14; cron's `PATH` can put an older `python3` first (for example `/usr/local/bin`), which fails on the first import and, with output sent to `/dev/null`, leaves no trace except a stale `seen/cron`. Name the interpreter:
|
|
120
|
+
|
|
121
|
+
```
|
|
122
|
+
*/5 * * * * /usr/bin/python3 $HOME/.claude/skills/hub/scripts/hubkit tick --if-bound
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## Configuration files
|
|
126
|
+
|
|
127
|
+
Everything personal lives outside the checkout, in `~/.config/hubkit/`:
|
|
128
|
+
|
|
129
|
+
| File | Purpose |
|
|
130
|
+
|---|---|
|
|
131
|
+
| `config.toml` | Settings. Template: [`config.example.toml`](config.example.toml). Override the path with `$HUBKIT_CONFIG`. No file means generic defaults. |
|
|
132
|
+
| `intents.toml` | Words that open an order, clocks, what "done" needs. Template: [`intents.example.toml`](intents.example.toml). |
|
|
133
|
+
| `overlay.md` | Your own rules (people, accounts, routing). The hub reads it with `SKILL.md`; promoted learnings are written here. |
|
|
134
|
+
| `ext/*.py` | Optional extensions: extra status lines and watchdog checks. |
|
|
135
|
+
| `~/.local/state/hubkit/` | State: orders, work items, alerts, archive, status. Override with `$HUBKIT_STATE`. Refused if inside a git repository. |
|
|
136
|
+
|
|
137
|
+
Every key is documented in [docs/configuration.md](docs/configuration.md).
|
|
138
|
+
|
|
139
|
+
## What hubkit enforces and what it only warns about
|
|
140
|
+
|
|
141
|
+
| Behaviour | Strength |
|
|
142
|
+
|---|---|
|
|
143
|
+
| 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 | Enforced (blocks the turn end) |
|
|
144
|
+
| An order closes only with the evidence its kind requires | Enforced (the close is refused) |
|
|
145
|
+
| A learned class counts as fixed only if a rule for it exists | Enforced (the address is refused) |
|
|
146
|
+
| A second job sent to a busy owner while an order is open; a brief that bans the action a blocker needs | Warning only |
|
|
147
|
+
| `gh pr merge` with no live order naming that PR (the merge guard, `hubkit hook pretool`) | Warning only, never denies |
|
|
148
|
+
| `hubkit doctor` warning when your `intents.toml` lacks keys the example has | Warning only |
|
|
149
|
+
|
|
150
|
+
Details and exact rules: [SKILL.md](SKILL.md) and [docs/architecture.md](docs/architecture.md#stop-gate-gatepy).
|
|
151
|
+
|
|
152
|
+
## Documentation
|
|
153
|
+
|
|
154
|
+
- [docs/architecture.md](docs/architecture.md): hooks, orders, routed work, the stop gate and the learn loop, with a diagram.
|
|
155
|
+
- [docs/configuration.md](docs/configuration.md): every `config.toml` and `intents.toml` key.
|
|
156
|
+
- [docs/commands.md](docs/commands.md): every `hubkit` and `learn.py` verb.
|
|
157
|
+
- [docs/troubleshooting.md](docs/troubleshooting.md): common problems and what to check.
|
|
158
|
+
- [CONTRIBUTING.md](CONTRIBUTING.md), [SECURITY.md](SECURITY.md), [CHANGELOG.md](CHANGELOG.md).
|
|
159
|
+
|
|
160
|
+
## Tests
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
python3 -m pytest tests -q # real subprocesses, scratch state dirs only
|
|
164
|
+
python3 tests/run_reverts.py # each guard reverted in a copy must fail its test (minutes)
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
`run_reverts.py` exits 0 only when every reverted copy fails its test and every listed pattern and test exists. Install `pytest` first (`pip install pytest`).
|
|
168
|
+
|
|
169
|
+
## Platform support
|
|
170
|
+
|
|
171
|
+
All OS-specific code is in one module, `scripts/hubcore/compat.py` (standard library only): process start time and parent (`/proc` on Linux, `ps` on macOS, kernel32 through `ctypes` on Windows), file locks (`flock`, or `msvcrt` on Windows), the scheduler check (`crontab -l`, or `schtasks /query` on Windows) and UTF-8 stdio.
|
|
172
|
+
|
|
173
|
+
| OS | Status |
|
|
174
|
+
|---|---|
|
|
175
|
+
| Linux | Full test suite run and passing here (ruff, mypy, pytest). |
|
|
176
|
+
| macOS | The `ps` code path is exercised on Linux against the real `ps` (`tests/test_compat.py`), and mypy checks it with `--platform darwin`. Never run on a Mac. Not claimed to work until someone runs it there. |
|
|
177
|
+
| Windows | The `ctypes` and `msvcrt` code is type-checked with `--platform win32` only. Never run on Windows. Tests that need a POSIX `sh` shim for `gh`, `crontab` or a notifier are skipped there. Not claimed to work until someone runs it there. There is no default desktop notification on Windows: set `tools.notify_cmd`. |
|
|
178
|
+
|
|
179
|
+
There is no CI. Update this table only from a real run on that OS. On Windows the schedule is a Task Scheduler task whose name or command holds `hubkit` (for example `schtasks /create /sc minute /mo 5 /tn hubkit-tick /tr "python %USERPROFILE%\.claude\skills\hub\scripts\hubkit tick --if-bound"`), and hooks in `settings.json` call `python ...\hubkit hook <event>`.
|
|
180
|
+
|
|
181
|
+
## Limits and known gaps
|
|
182
|
+
|
|
183
|
+
- Python 3.14 only. macOS and Windows are written but unproven; see Platform support.
|
|
184
|
+
- It targets one hub per machine. A second live hub is refused at bind.
|
|
185
|
+
- Order creation takes a blocking `flock` (`scripts/hubcore/orders.py`); a process that holds the lock forever stalls order opens.
|
|
186
|
+
- A hook payload with no `origin` field is treated as human input.
|
|
187
|
+
- Redaction matches secret shapes and `key=value` forms. Natural-language secrets ("the password is hunter2") are not caught. See [SECURITY.md](SECURITY.md).
|
|
188
|
+
- 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.
|
|
189
|
+
- 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.
|
|
190
|
+
- `skills/hub-mep` describes an optional integration with the `mep` task-list CLI and is of no use without it.
|
|
191
|
+
- 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.
|
|
192
|
+
|
|
193
|
+
## License
|
|
194
|
+
|
|
195
|
+
Apache License 2.0. See [LICENSE](LICENSE). Copyright 2026 the hubkit contributors.
|