@davesheffer/hunch 1.32.7 → 1.33.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +102 -206
- package/dist/cli/index.js +2 -0
- package/dist/cli/integrations.js +4 -1
- package/dist/cli/serve.js +28 -2
- package/dist/cli/state.d.ts +3 -0
- package/dist/cli/state.js +150 -0
- package/dist/cli/update.js +6 -2
- package/dist/client/state.d.ts +82 -14
- package/dist/client/state.js +16 -2
- package/dist/client/stateProof.d.ts +4 -0
- package/dist/client/stateProof.js +17 -0
- package/dist/constitution/behaviorEvaluator.js +1 -1
- package/dist/constitution/schema.d.ts +2 -2
- package/dist/core/automaticReviewMemory.d.ts +5 -0
- package/dist/core/conventionDelivery.d.ts +8 -0
- package/dist/core/conventionDelivery.js +52 -0
- package/dist/core/fieldProvenance.d.ts +8 -0
- package/dist/core/fieldProvenance.js +72 -0
- package/dist/core/recordVisibility.d.ts +9 -0
- package/dist/core/recordVisibility.js +25 -0
- package/dist/core/stateCanonical.d.ts +3 -0
- package/dist/core/stateCanonical.js +34 -0
- package/dist/core/stateContract.d.ts +122 -7
- package/dist/core/stateContract.js +26 -31
- package/dist/core/stateDelivery.d.ts +3 -3
- package/dist/core/stateDelivery.js +10 -1
- package/dist/core/stateHttp.d.ts +280 -0
- package/dist/core/stateHttp.js +17 -0
- package/dist/core/stateProof.d.ts +13 -0
- package/dist/core/stateProof.js +34 -0
- package/dist/core/stateRecords.d.ts +127 -0
- package/dist/core/stateRecords.js +48 -0
- package/dist/core/types.d.ts +146 -4
- package/dist/core/types.js +8 -2
- package/dist/extractors/git.js +3 -10
- package/dist/integrations/health.d.ts +2 -1
- package/dist/integrations/health.js +53 -16
- package/dist/mcp/server.js +10 -4
- package/dist/serve/app.d.ts +2 -0
- package/dist/serve/app.js +71 -30
- package/dist/serve/config.d.ts +16 -0
- package/dist/serve/config.js +27 -7
- package/dist/serve/operator.d.ts +4 -0
- package/dist/serve/operator.js +223 -0
- package/dist/serve/stateProof.d.ts +15 -0
- package/dist/serve/stateProof.js +105 -0
- package/dist/store/changeLedger.d.ts +6 -0
- package/dist/store/hunchStore.d.ts +4 -2
- package/dist/store/hunchStore.js +18 -19
- package/dist/store/stateAccess.d.ts +13 -0
- package/dist/store/stateAccess.js +85 -0
- package/dist/store/stateBinding.d.ts +13 -18
- package/dist/store/stateBinding.js +161 -52
- package/dist/store/stateCapture.js +10 -2
- package/dist/store/stateError.d.ts +12 -0
- package/dist/store/stateError.js +12 -0
- package/dist/store/statePartition.d.ts +9 -0
- package/dist/store/statePartition.js +30 -0
- package/package.json +6 -2
- package/server.json +3 -3
package/README.md
CHANGED
|
@@ -1,289 +1,185 @@
|
|
|
1
1
|
# Hunch
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## A shared record for AI agents: what was decided, what happened, and what still needs doing.
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/@davesheffer/hunch)
|
|
6
6
|
[](https://github.com/davesheffer/hunch)
|
|
7
7
|
[](LICENSE)
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
A new agent session should not mean explaining the project all over again. A second agent should be able to check a recorded decision, see the evidence behind completed work, and find an outstanding commitment.
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
Hunch keeps that record in Git and makes the relevant parts available to your agents. It started with **engineering memory**: why code exists, which approach failed before, and which rules a change must preserve. It also ships a **state server** for sharing decisions, action records, and commitments across authorized organization, team, user, and repository scopes.
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
The goal is simple: agents working from the same maintained record, with sources they can inspect. Hunch supplies memory and checks; the assistant still does the work.
|
|
14
14
|
|
|
15
|
-
##
|
|
15
|
+
## Start with your coding assistant
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
- **Git is the source of truth.** Every fact is a JSON file under `.hunch/`, every change a commit: diffable, PR-reviewable, revertable, mergeable, never locked in a vendor database. SQLite is only a derived index.
|
|
20
|
-
- **Refusal, not convergence.** One live decision per topic. A second contradicting record is refused at write time with the incumbent named, and a supersede target must still be open. Diverging writes are not merged later.
|
|
21
|
-
- **Organization drawers with a key per agent.** Repository, user, team and organization partitions; the bearer key resolves the principal and decides visibility before anything is looked up.
|
|
22
|
-
- **Receipts and commitments are facts.** What was actually done in an external system, verified or not, and who owes what by when, readable by any agent with the key.
|
|
23
|
-
- **Never Twice.** A human correction becomes an enforced rule, not a one-session memory. Nothing blocks until a human deliberately trusts a precise rule and opts into strict enforcement.
|
|
24
|
-
- **The code spoke.** Decisions, constraints and bug lineage are checked against the code deterministically, with no model in the block path. No state-layer peer has it.
|
|
25
|
-
|
|
26
|
-
## Start in five minutes
|
|
27
|
-
|
|
28
|
-
Requires Node 22.13+ and a Git repository.
|
|
17
|
+
Requires **Node 22.13+** and a Git repository.
|
|
29
18
|
|
|
30
19
|
```bash
|
|
31
20
|
npm i -g @davesheffer/hunch
|
|
32
21
|
cd your-repo
|
|
33
22
|
hunch init
|
|
34
|
-
hunch backfill --since 90d # optional:
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
Reload your coding assistant, then ask a normal question:
|
|
38
|
-
|
|
39
|
-
> Why is this built this way?
|
|
40
|
-
|
|
41
|
-
`hunch init` indexes the repository, installs local lifecycle hooks and connects supported assistants without replacing their existing configuration. The next session receives the relevant story with its sources, not a giant transcript or generic prompt wall.
|
|
42
|
-
|
|
43
|
-
Lifecycle coverage depends on the harness; MCP connectivity alone does not establish automatic grounding or enforcement.
|
|
44
|
-
|
|
45
|
-
To update Hunch and configured harness pins for the current repository:
|
|
46
|
-
|
|
47
|
-
```sh
|
|
48
|
-
hunch update
|
|
23
|
+
hunch backfill --since 90d # optional: draft memory from recent history
|
|
49
24
|
```
|
|
50
25
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
Check integrations after upgrading Hunch or switching assistants:
|
|
26
|
+
Reload your assistant, then ask:
|
|
54
27
|
|
|
55
|
-
|
|
56
|
-
hunch integrations check
|
|
57
|
-
hunch integrations repair-pins
|
|
58
|
-
hunch integrations check --harness claude --probe --require mcp
|
|
59
|
-
hunch integrations check --harness codex --require context,edit-blocking
|
|
60
|
-
```
|
|
28
|
+
> Why is this built this way, and what should I preserve when changing it?
|
|
61
29
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
Codex CLI 0.153+ gets a native lifecycle adapter (`.codex/hooks.json`: session orientation, prompt task IDs from `turn_id`, `apply_patch` pre-edit grounding and strict denial, native `Bash`/`PowerShell` post-tool observation, Stop cards); project-layer hooks load only for a trusted project and must be trusted once in Codex with `/hooks`. Failure capture is certified only by an explicit failed-tool lifecycle event; a successful `PostToolUse` observation does not prove it. The opt-in `--probe` verifies a fresh MCP process, not whether an existing host session or model actually followed the memory.
|
|
65
|
-
|
|
66
|
-
Use `hunch integrations check` in CI to prevent pin drift; add `--require` for capabilities your workflow cannot operate without.
|
|
67
|
-
|
|
68
|
-
## One evidence loop, not another model
|
|
69
|
-
|
|
70
|
-
```text
|
|
71
|
-
Git history + ADRs + corrections + tests + repository conventions
|
|
72
|
-
│
|
|
73
|
-
▼
|
|
74
|
-
Hunch's evidence graph
|
|
75
|
-
/ │ \
|
|
76
|
-
engineering memory Project DNA reviewed landscape
|
|
77
|
-
\ │ /
|
|
78
|
-
▼
|
|
79
|
-
role-shaped, budgeted context delivery
|
|
80
|
-
│
|
|
81
|
-
▼
|
|
82
|
-
Claude / Codex / Cursor / any MCP agent
|
|
83
|
-
│
|
|
84
|
-
▼
|
|
85
|
-
deterministic change receipt
|
|
86
|
-
```
|
|
30
|
+
`hunch init` indexes the code, configures supported assistant integrations, and adds memory instructions while preserving existing settings. For Codex hooks, review and trust the commands in `/hooks`, then start a new session. **Memory is advisory by default.** Blocking requires an explicitly trusted rule and strict enforcement.
|
|
87
31
|
|
|
88
|
-
Hunch
|
|
32
|
+
Hunch works with Claude Code, Codex, Cursor, VS Code/Copilot, Windsurf, Antigravity, and other MCP clients. Automatic context and hook coverage vary by assistant; a connected MCP server alone does not prove they are running. [Check your integration](https://www.hunchmemory.com/docs#update).
|
|
89
33
|
|
|
90
|
-
## What
|
|
34
|
+
## What you get today
|
|
91
35
|
|
|
92
|
-
|
|
|
36
|
+
| Need | How Hunch helps |
|
|
93
37
|
| --- | --- |
|
|
94
|
-
|
|
|
95
|
-
|
|
|
96
|
-
|
|
|
97
|
-
|
|
|
98
|
-
|
|
|
99
|
-
|
|
|
100
|
-
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
Project DNA is Hunch's evidence-bound model of **how a repository communicates and works**. It is not a persona, does not impersonate a maintainer and does not turn frequent behavior into policy.
|
|
107
|
-
|
|
108
|
-
The deterministic baseline reads an exact Git revision, bounded commit history and committed convention files. The current release can also accept bounded, caller-authorized pull-request/review evidence. Every evidence batch is validated and sealed; raw collaboration text does not enter the profile.
|
|
109
|
-
|
|
110
|
-
Each trait keeps its category, confidence, freshness, repository revision and evidence hash. Hunch can include only the relevant DNA in normal context, explain how an artifact matches repository conventions and show profile change between revisions.
|
|
111
|
-
|
|
112
|
-
```bash
|
|
113
|
-
hunch dna inspect
|
|
114
|
-
hunch dna context
|
|
115
|
-
hunch dna diff <older-ref> <newer-ref>
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
DNA may shape orientation, terminology and advisory Project Match checks. It cannot create or override a decision, constraint, finding, conformance rule, policy or permission.
|
|
119
|
-
|
|
120
|
-
Read the [Project DNA contract](docs/project-dna.md) and broader [Project DNA vision](docs/project-dna-engine.md).
|
|
38
|
+
| Stop explaining old decisions | Saves decisions, rejected alternatives, bug history, corrections, and open findings with their sources. |
|
|
39
|
+
| Understand a change before making it | Connects memory to code symbols and dependencies; shows affected code and recorded architectural intent. |
|
|
40
|
+
| Keep agents informed across sessions | Delivers a focused brief for a task through MCP and supported lifecycle hooks. |
|
|
41
|
+
| Check the rules your team chose | Evaluates supported constraints and code relationships without a model in the blocking path. |
|
|
42
|
+
| See what happened during a task | Separates delivered memory, the agent's reported use, rule results, and observed command results in a contribution report. |
|
|
43
|
+
| Share project memory with teammates | Keeps repository memory in Git, with an optional dedicated private memory repository. |
|
|
44
|
+
| Share work state across agents | Serves authorized records through HTTP, MCP, the state CLI, and typed TypeScript and Python clients. |
|
|
45
|
+
| Inspect what the agents know | A read-only browser view shows current records, commitments, completed work and writer-supplied citations. |
|
|
46
|
+
| Keep access and conventions explicit | Optional per-record audiences, key-bound credentials and sourced conventions use the same state contract. |
|
|
47
|
+
|
|
48
|
+
For example, a team fixes a logout bug by keeping sessions on the server. Months later, an agent proposes removing that code. Hunch can surface the original reason and rejected alternative before the edit. A supported, trusted rule can flag the conflict; strict mode can block it. Recording the lesson and configuring the integration are what make this possible.
|
|
121
49
|
|
|
122
50
|
## Day-to-day
|
|
123
51
|
|
|
124
52
|
| Command | Use it for |
|
|
125
53
|
| --- | --- |
|
|
126
|
-
| `hunch context "<task>" --profile builder` | Get a
|
|
127
|
-
| `hunch why <file-or-symbol>` |
|
|
128
|
-
| `hunch structure [target]` | Inspect indexed
|
|
129
|
-
| `hunch findings [scope]` |
|
|
130
|
-
| `hunch
|
|
131
|
-
| `hunch
|
|
132
|
-
| `hunch
|
|
133
|
-
| `hunch
|
|
134
|
-
| `hunch
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
| `hunch now` | See recent memory and live decision-backed roadmap |
|
|
138
|
-
| `hunch escalations` | See questions that genuinely require a human answer |
|
|
139
|
-
| `hunch doctor` | Diagnose setup, provider, index or overlay problems |
|
|
140
|
-
|
|
141
|
-
When you are ready for deterministic enforcement:
|
|
54
|
+
| `hunch context "<task>" --profile builder` | Get a focused brief before starting |
|
|
55
|
+
| `hunch why <file-or-symbol>` | Understand decisions and past bugs behind code |
|
|
56
|
+
| `hunch structure [target]` | Inspect indexed files and symbols |
|
|
57
|
+
| `hunch findings [scope]` | See known gaps that still need work |
|
|
58
|
+
| `hunch impact origin/main` | See what a branch could affect |
|
|
59
|
+
| `hunch check --working` | Check current changes against recorded rules |
|
|
60
|
+
| `hunch conform` | Check supported architectural relationships |
|
|
61
|
+
| `hunch now` | Read recent decisions and the recorded roadmap |
|
|
62
|
+
| `hunch doctor` | Diagnose setup and storage problems |
|
|
63
|
+
|
|
64
|
+
For enforcement after reviewing and trusting the relevant rules:
|
|
142
65
|
|
|
143
66
|
```bash
|
|
144
67
|
hunch firmness strict
|
|
145
68
|
hunch check --staged --strict
|
|
146
69
|
```
|
|
147
70
|
|
|
148
|
-
|
|
71
|
+
Generated notes, observed habits, and imported documents do not silently gain blocking authority.
|
|
149
72
|
|
|
150
|
-
##
|
|
151
|
-
|
|
152
|
-
Repository memory solves one version of a larger problem, and since 1.25.0 Hunch ships the larger one.
|
|
73
|
+
## Update without losing your settings
|
|
153
74
|
|
|
154
|
-
|
|
75
|
+
From each repository that uses Hunch:
|
|
155
76
|
|
|
156
|
-
|
|
77
|
+
```bash
|
|
78
|
+
hunch update
|
|
79
|
+
```
|
|
157
80
|
|
|
158
|
-
|
|
81
|
+
Or ask your agent to **“update Hunch.”** The command installs the latest release, aligns configured integration pins, repairs known legacy launch commands, and refreshes Hunch instructions. It preserves unrelated settings and intentionally disabled hooks.
|
|
159
82
|
|
|
160
|
-
|
|
83
|
+
- A standalone npm project keeps Hunch in its existing dependency section at an exact version. Without a repository dependency, the global CLI is updated. Add `--global` to update both.
|
|
84
|
+
- For other package managers or workspaces, update the dependency with that package manager, then run `hunch integrations repair-pins`.
|
|
85
|
+
- Restart or reconnect active assistants. In Codex, open `/hooks` to review and trust changed commands, then start a new session. A changed version pin changes the command and requires renewed trust.
|
|
161
86
|
|
|
162
|
-
|
|
87
|
+
Verify the setup:
|
|
163
88
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
- repository/user/team/org DNA;
|
|
170
|
-
- derived current state with exact dependencies/invalidation.
|
|
89
|
+
```bash
|
|
90
|
+
hunch integrations check
|
|
91
|
+
hunch integrations check --harness codex --probe --require mcp
|
|
92
|
+
hunch integrations check --harness codex --require context
|
|
93
|
+
```
|
|
171
94
|
|
|
172
|
-
|
|
95
|
+
The first command checks configuration. The probe starts a fresh MCP process and reads memory. The context check requires observed hook delivery on the expected version, so run it after the new assistant session begins. `--require` fails when the named capability is not verified; none of these checks proves that a model followed the advice.
|
|
173
96
|
|
|
174
|
-
|
|
97
|
+
## See what Hunch contributed
|
|
175
98
|
|
|
176
|
-
|
|
177
|
-
Hunch deterministic state
|
|
178
|
-
↑ ↓
|
|
179
|
-
agent -> deterministic action gate -> connector -> source system
|
|
180
|
-
```
|
|
99
|
+
Task reports answer: what memory reached this task, what did the agent say it used, and what checks actually ran?
|
|
181
100
|
|
|
182
|
-
|
|
101
|
+
The normal agent instructions request a completion card with a link to a local evidence report. You can also inspect reports directly:
|
|
183
102
|
|
|
184
|
-
|
|
103
|
+
```bash
|
|
104
|
+
hunch task list
|
|
105
|
+
hunch report <task-id> --html
|
|
106
|
+
```
|
|
185
107
|
|
|
186
|
-
|
|
108
|
+
A delivered lesson, an agent's claim, and a passing test are different evidence. Hunch keeps them separate. Automatic presentation depends on the host following the task lifecycle; missing evidence stays unverified. [Read the reporting guide](docs/task-reports.md).
|
|
187
109
|
|
|
188
|
-
|
|
110
|
+
## Share one living repository memory with your team
|
|
189
111
|
|
|
190
|
-
|
|
191
|
-
delivery envelope's receipt, `write` with provenance and an idempotency key, `subscribe` to a
|
|
192
|
-
strictly ordered change stream) over five new record facets: action receipts, commitments,
|
|
193
|
-
derived state that names what it rests on, external entities and their relationships. Ids are
|
|
194
|
-
derived from a record's facts, a replay returns the original, a second live decision on a topic is
|
|
195
|
-
refused with the incumbent named, and derived state without dependencies is not state. Each scope
|
|
196
|
-
keeps a git-native change ledger under `.hunch/changes/`; organization, team and user partitions
|
|
197
|
-
are homed in an overlay, never in a repository. The MCP server binds it as `nuryel_capabilities`,
|
|
198
|
-
`nuryel_read`, `nuryel_write` and `nuryel_subscribe`; every other transport will call the same
|
|
199
|
-
store binding. Contract and evidence: [docs/nuryel-state-contract.md](docs/nuryel-state-contract.md).
|
|
112
|
+
One maintainer connects a dedicated private Git repository:
|
|
200
113
|
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
Hunch Memory service into Hunch.
|
|
114
|
+
```bash
|
|
115
|
+
hunch shared --repo git@github.com:acme/project-hunch-memory.git
|
|
116
|
+
git add .gitignore .hunch/team.json
|
|
117
|
+
git commit -m "chore: connect shared Hunch memory"
|
|
118
|
+
git push
|
|
119
|
+
```
|
|
208
120
|
|
|
209
|
-
|
|
121
|
+
Teammates install Hunch, pull the code, and run `hunch init`. Normal Git access controls the shared repository. Credentials, local clone paths, and private overlays stay out of the committed pointer. Use `hunch shared --sync` to retry synchronization; add `--no-auto-commit` when captures should wait for explicit sync.
|
|
210
122
|
|
|
211
|
-
|
|
123
|
+
This shares a project's engineering memory. The state server below adds authenticated access across multiple scopes.
|
|
212
124
|
|
|
213
|
-
|
|
125
|
+
## Deterministic organizational state
|
|
214
126
|
|
|
215
|
-
|
|
127
|
+
A coding agent needs to know why a module exists. An operations agent may need to know whether a customer action was completed or who owes the next follow-up. Both need a maintained record they can check.
|
|
216
128
|
|
|
217
|
-
|
|
129
|
+
Hunch ships `hunch serve`: a self-hosted HTTP service for organization, team, user, and repository records. A configured identity determines which scopes an agent may access. Optional record audiences further restrict access; optional key-bound credentials require proof from the configured private key on each request.
|
|
218
130
|
|
|
219
|
-
|
|
131
|
+
Open `/operator` on your server to inspect current records, completed work and commitments in a read-only browser view. Writer-supplied citations can point to an exact summary field or text passage and its recorded sources. They show traceability; they do not prove that a source supports a claim.
|
|
220
132
|
|
|
221
|
-
The
|
|
133
|
+
Agents can use the same contract through MCP, `hunch state read|write|records|subscribe`, the `@davesheffer/hunch/state` TypeScript client, or the [Python client](docs/python-state-client.md). The Python package is built and tested from this repository; it is not yet published to PyPI. [Scoped conventions](docs/scoped-conventions.md) let a person record sourced user, team or organization preferences. Those preferences remain advisory and do not silently become blocking rules.
|
|
222
134
|
|
|
223
|
-
|
|
135
|
+
Records can describe decisions, action outcomes, commitments, entities, relationships, and summaries that name their dependencies. Actions retain their status, including unknown or unverified outcomes. Repeated writes have stable identities, conflicting current decisions are refused, and confirmed human records receive protections against agent overwrites. These are defined checks on structured records; Hunch cannot establish every fact in the outside world on its own.
|
|
224
136
|
|
|
225
|
-
|
|
226
|
-
npm i -g @davesheffer/hunch@1.32.2
|
|
227
|
-
hunch shared --repo git@github.com:acme/project-hunch-memory.git
|
|
228
|
-
git add .gitignore .hunch/team.json
|
|
229
|
-
git commit -m "chore: connect shared Hunch memory"
|
|
230
|
-
git push
|
|
231
|
-
```
|
|
137
|
+
This is what **deterministic state** means here: explicit rules govern the stored record, rather than having each agent reconstruct it from scratch. Git holds the durable data; SQLite is a rebuildable index. The server binds to loopback and requires deployment and agent integration by its operator. Hunch does not provide a managed CRM or email connector service.
|
|
232
138
|
|
|
233
|
-
|
|
139
|
+
[Set up and understand the state server](docs/deterministic-state.md) · [State contract and client reference](docs/nuryel-state-contract.md) · [Upgrade to 1.33](docs/upgrade-1.33.md)
|
|
234
140
|
|
|
235
|
-
|
|
236
|
-
npm i -g @davesheffer/hunch@1.32.2
|
|
237
|
-
git pull
|
|
238
|
-
hunch init
|
|
239
|
-
hunch doctor
|
|
240
|
-
```
|
|
141
|
+
### The vision, and what is still being tested
|
|
241
142
|
|
|
242
|
-
The
|
|
143
|
+
The vision is continuity across people, tools, and agents: an operations agent records a customer issue, a coding agent finds the relevant decision and fixes the cause, and the operations agent closes the commitment using evidence of the fix.
|
|
243
144
|
|
|
244
|
-
|
|
145
|
+
The underlying memory and state tools ship today. The broader claim—that different agents reliably use that shared state and avoid contradictory work—is still being measured in the Sofia pilot. Simulated results and a limited live pilot are not proof of that outcome across organizations. The [roadmap](ROADMAP.md) tracks the remaining acceptance gates.
|
|
245
146
|
|
|
246
|
-
|
|
147
|
+
**Hunch remains the product name.** The `nuryel.state/1` protocol and `nuryel_*` tool names are existing technical identifiers; a possible future rename is undecided.
|
|
247
148
|
|
|
248
|
-
##
|
|
149
|
+
## Project DNA: help the agent understand how the project works
|
|
249
150
|
|
|
250
|
-
|
|
251
|
-
- **Hosted state is a roadmap extension, not a shipped claim.** Organization/team/user state will require authenticated scope/visibility, idempotency and durability while preserving git-native truth.
|
|
252
|
-
- **Private when needed.** `hunch private --repo <url>` keeps sensitive repository reasoning in a separate overlay; public CI/documentation remain public-only.
|
|
253
|
-
- **Human authority.** Observations, generated drafts, imported ADRs, discovered landscape records and proved policy candidates do not silently become trusted truth.
|
|
254
|
-
- **Deterministic core.** Indexing, retrieval receipts, currentness, conformance, Project DNA discovery and policy evaluation do not require a model.
|
|
255
|
-
- **Agents own execution.** Hunch state does not silently grant connector permissions, send messages or become a source-system proxy.
|
|
256
|
-
- **No surprise synthesis bill.** Optional drafting can use a selected Claude Code, Codex or Cursor subscription CLI, a local OpenAI-compatible endpoint or deterministic fallback. Public remote endpoints require explicit opt-in.
|
|
257
|
-
- **Traceable releases.** npm packages and the VS Code extension are content-addressed, verified against public registries and tied back to exact source tags.
|
|
151
|
+
Project DNA describes observed repository conventions: terminology, contribution habits, review expectations, and engineering patterns. Engineering memory records decisions and their reasons. Both can inform a task, but frequent behavior does not become policy.
|
|
258
152
|
|
|
259
|
-
|
|
153
|
+
```bash
|
|
154
|
+
hunch dna inspect
|
|
155
|
+
hunch dna context
|
|
156
|
+
hunch dna diff <older-ref> <newer-ref>
|
|
157
|
+
```
|
|
260
158
|
|
|
261
|
-
|
|
159
|
+
Profiles retain their revision, sources, confidence, and freshness. [Project DNA contract](docs/project-dna.md) · [Broader DNA vision](docs/project-dna-engine.md)
|
|
262
160
|
|
|
263
|
-
|
|
264
|
-
- **v1.21 — Project DNA.** Hunch gained deterministic, revision-specific repository profiles, bounded DNA context delivery, explainable Project Match checks and auditable profile deltas.
|
|
265
|
-
- **v1.22 — authorized collaboration evidence.** Hosts can contribute bounded PR/review evidence to Project DNA through a typed, sealed contract without raw collaboration persistence or policy-authority change.
|
|
266
|
-
- **v1.23 — native change proof and proof-carrying evidence work.** Exact Git change identity, graph before/after, decisions/constraints, blast radius and Change Gate result can be bound into a sealed evidence artifact without granting authority.
|
|
267
|
-
- **v1.25 – v1.30 — the state layer.** `nuryel.state/1` as code, `hunch serve` partitions, union reads, subject identity by external reference, replay determinism, human corrections outranking agent writes.
|
|
268
|
-
- **v1.32 — see what Hunch contributed.** Task contribution reports: what was delivered, what the agent reports it applied, what a rule verified, what a command observed; concise card, local evidence view.
|
|
161
|
+
## Your data and your authority
|
|
269
162
|
|
|
270
|
-
|
|
163
|
+
- Repository use is local-first and needs no hosted Hunch account. Shared memory uses Git access; the optional state server uses configured identities and grants.
|
|
164
|
+
- `hunch private --repo <url>` keeps sensitive project reasoning in a private overlay. Public exports and CI should use public-only views.
|
|
165
|
+
- Drafting can use a selected coding-assistant subscription, a local endpoint, or the deterministic fallback. Public metered endpoints require explicit opt-in. [Synthesis and billing](https://www.hunchmemory.com/docs#synthesis).
|
|
166
|
+
- Agents keep responsibility for external actions and connector permissions. A stored record does not authorize an email, deployment, or CRM change.
|
|
167
|
+
- npm and editor releases use separate publication gates with package integrity and provenance checks.
|
|
271
168
|
|
|
272
169
|
## Learn more
|
|
273
170
|
|
|
274
171
|
- [Full documentation](https://www.hunchmemory.com/docs)
|
|
275
172
|
- [Copy-paste cookbook](https://www.hunchmemory.com/cookbook)
|
|
276
|
-
- [
|
|
277
|
-
- [Keep agent launches with the initiating provider](docs/agent-origin.md)
|
|
173
|
+
- [Task contribution reports](docs/task-reports.md)
|
|
278
174
|
- [Deterministic organizational state](docs/deterministic-state.md)
|
|
279
175
|
- [Project DNA](docs/project-dna.md)
|
|
280
176
|
- [Native change proof](docs/change-proof.md)
|
|
281
|
-
- [
|
|
282
|
-
- [
|
|
177
|
+
- [Engineering Landscape](docs/engineering-landscape.md)
|
|
178
|
+
- [Review memory](docs/review-memory.md)
|
|
179
|
+
- [Agent-origin handling](docs/agent-origin.md)
|
|
180
|
+
- [Autonomy ladder](docs/autonomy-ladder.md)
|
|
283
181
|
- [Autonomous development](docs/autonomous-development.md)
|
|
284
|
-
- [
|
|
285
|
-
- [Engineering Landscape Graph](docs/engineering-landscape.md)
|
|
286
|
-
- [Hunch roadmap](ROADMAP.md)
|
|
182
|
+
- [Changelog](CHANGELOG.md) · [Roadmap](ROADMAP.md)
|
|
287
183
|
- [VS Code extension](vscode-extension/README.md)
|
|
288
184
|
- [Architecture benchmark](bench/architectural-conformance.md)
|
|
289
185
|
- [Contributing](CONTRIBUTING.md)
|
package/dist/cli/index.js
CHANGED
|
@@ -26,6 +26,7 @@ import { looksLikeCorrection, CORRECTION_NUDGE } from "../core/correction.js";
|
|
|
26
26
|
import { HUNCH_VERSION } from "../core/version.js";
|
|
27
27
|
import { registerIntegrationCommands } from "./integrations.js";
|
|
28
28
|
import { registerTaskReportCommands } from "./taskReport.js";
|
|
29
|
+
import { registerStateCommands } from "./state.js";
|
|
29
30
|
import { registerServeCommands } from "./serve.js";
|
|
30
31
|
import { registerUpdateCommand } from "./update.js";
|
|
31
32
|
import { registerReviewMemoryCommands } from "./reviewMemory.js";
|
|
@@ -164,6 +165,7 @@ registerIntegrationCommands(program, () => {
|
|
|
164
165
|
});
|
|
165
166
|
registerTaskReportCommands(program, () => { const { store, root } = storeFor(); return { store, root }; });
|
|
166
167
|
registerServeCommands(program);
|
|
168
|
+
registerStateCommands(program);
|
|
167
169
|
registerUpdateCommand(program);
|
|
168
170
|
registerReviewMemoryCommands(program, (records, repository, privateOnly) => {
|
|
169
171
|
const { store, root } = storeFor();
|
package/dist/cli/integrations.js
CHANGED
|
@@ -26,11 +26,14 @@ export function registerIntegrationCommands(program, refreshGrounding) {
|
|
|
26
26
|
process.exitCode = 1;
|
|
27
27
|
});
|
|
28
28
|
integrations.command("repair-pins")
|
|
29
|
-
.description("Align
|
|
29
|
+
.description("Align pins, repair known Hunch launch commands and refresh instructions; preserves other settings and does not enable hooks")
|
|
30
30
|
.action(() => {
|
|
31
31
|
const root = findRoot();
|
|
32
32
|
const files = repairIntegrationPins(root);
|
|
33
33
|
console.log(files.length ? `Updated ${files.length} integration file(s): ${files.join(", ")}. Reconnect active MCP sessions.` : "Integration pins already aligned.");
|
|
34
|
+
if (files.includes(".codex/hooks.json")) {
|
|
35
|
+
console.log("Codex: open /hooks to review and trust the changed commands, then start a new session. Command changes require renewed trust; Hunch does not grant it automatically.");
|
|
36
|
+
}
|
|
34
37
|
const grounding = refreshGrounding();
|
|
35
38
|
if (grounding.length)
|
|
36
39
|
console.log(`Updated Hunch instructions: ${grounding.join(", ")}. Reconnect the agent to load task reporting instructions.`);
|
package/dist/cli/serve.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { readFileSync, statSync } from 'node:fs';
|
|
2
|
+
import { proofPublicKey } from '../core/stateProof.js';
|
|
1
3
|
import { resolve } from "node:path";
|
|
2
4
|
import { createServeApp } from "../serve/app.js";
|
|
3
|
-
import { initServeConfig, partitionFor, readServeConfig } from "../serve/config.js";
|
|
5
|
+
import { initServeConfig, partitionFor, readServeConfig, writeServeConfig } from "../serve/config.js";
|
|
4
6
|
import { compactLedger } from "../store/changeLedger.js";
|
|
5
7
|
import { HunchStore } from "../store/hunchStore.js";
|
|
6
8
|
import { hunchPaths } from "../core/paths.js";
|
|
@@ -32,11 +34,23 @@ export function registerServeCommands(program) {
|
|
|
32
34
|
// reverse proxy that terminates TLS and auth of its own. Folded-in decision from Hunch Memory.
|
|
33
35
|
app.listen(port, "127.0.0.1", () => {
|
|
34
36
|
console.log(`hunch ${HUNCH_VERSION} serving nuryel.state/1 on http://127.0.0.1:${port} — ${config.partitions.map((p) => scopePath(p.scope)).join(", ")} (${config.principals.length} principal(s))`);
|
|
37
|
+
console.log(`Shared state view: http://127.0.0.1:${port}/operator`);
|
|
35
38
|
});
|
|
36
39
|
const stop = () => { app.close(() => { app.closeStores(); process.exit(0); }); };
|
|
37
40
|
process.on("SIGINT", stop);
|
|
38
41
|
process.on("SIGTERM", stop);
|
|
39
42
|
});
|
|
43
|
+
serve.command("revoke")
|
|
44
|
+
.description("Revoke a principal credential; current servers reload the config before each request")
|
|
45
|
+
.requiredOption("--principal <id>", "principal whose credential to revoke")
|
|
46
|
+
.action((opts) => {
|
|
47
|
+
const { file, ...config } = readServeConfig(resolve(serve.opts().config ?? DEFAULT_CONFIG));
|
|
48
|
+
if (!config.principals.some(p => p.id === opts.principal))
|
|
49
|
+
throw new Error('principal is not configured');
|
|
50
|
+
config.principals = config.principals.filter(p => p.id !== opts.principal);
|
|
51
|
+
writeServeConfig(file, config);
|
|
52
|
+
console.log(JSON.stringify({ revoked: opts.principal }));
|
|
53
|
+
});
|
|
40
54
|
serve.command("compact")
|
|
41
55
|
.description("Compact a served partition's change ledger: keep the newest N events, move the floor up; subscribers below the floor resynchronize")
|
|
42
56
|
.requiredOption("--partition <kind:id>", "the partition whose ledger to compact")
|
|
@@ -105,6 +119,8 @@ export function registerServeCommands(program) {
|
|
|
105
119
|
.requiredOption("--root <dir>", "directory whose .hunch/ holds the partition (created if missing)")
|
|
106
120
|
.option("--config <file>", `serve config to create or extend; default ${DEFAULT_CONFIG}`)
|
|
107
121
|
.option("--principal <id>", "principal to add or rotate, granted this partition")
|
|
122
|
+
.option("--proof-key-file <file>", "bind this token to an Ed25519 public PEM or JWK key")
|
|
123
|
+
.option("--public-origin <origin>", "external HTTPS origin of the reverse proxy; required for key-bound tokens")
|
|
108
124
|
.option("--kind <kind>", "principal kind: human | agent | service", "agent")
|
|
109
125
|
.option("--grant <kind:id...>", "additional partitions to grant the principal (must be served by this config)")
|
|
110
126
|
.option("--port <n>", "port to record in a new config")
|
|
@@ -120,10 +136,20 @@ export function registerServeCommands(program) {
|
|
|
120
136
|
const port = parent.port ?? opts.port;
|
|
121
137
|
const scope = parseScopeArg(opts.partition);
|
|
122
138
|
const grants = [scope, ...(opts.grant ?? []).map(parseScopeArg)];
|
|
139
|
+
let proofKey;
|
|
140
|
+
if (opts.proofKeyFile) {
|
|
141
|
+
if (!opts.principal)
|
|
142
|
+
throw new Error('--proof-key-file requires --principal');
|
|
143
|
+
const stat = statSync(opts.proofKeyFile);
|
|
144
|
+
if (!stat.isFile() || stat.size > 8192)
|
|
145
|
+
throw new Error('public proof key must be a regular file of at most 8 KiB');
|
|
146
|
+
proofKey = proofPublicKey(readFileSync(opts.proofKeyFile, 'utf8'));
|
|
147
|
+
}
|
|
123
148
|
const result = initServeConfig({
|
|
124
149
|
file: configFile, scope, root: resolve(opts.root),
|
|
125
|
-
...(opts.principal ? { principal: { id: opts.principal, kind: opts.kind, grants } } : {}),
|
|
150
|
+
...(opts.principal ? { principal: { id: opts.principal, kind: opts.kind, grants, proofKey } } : {}),
|
|
126
151
|
...(port ? { port: Number(port) } : {}),
|
|
152
|
+
...(opts.publicOrigin ? { publicOrigin: opts.publicOrigin } : {}),
|
|
127
153
|
});
|
|
128
154
|
if (opts.json) {
|
|
129
155
|
console.log(JSON.stringify({ config: configFile, partition: result.partition, token: result.token }));
|