@quolu/lattice 0.63.0 → 0.63.2
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/LICENSE +147 -147
- package/README.ja.md +378 -378
- package/README.md +303 -303
- package/bin/lattice-mcp.mjs +0 -0
- package/bin/lattice-scripted-adapter.mjs +0 -0
- package/bin/lattice-scripted-worker.mjs +0 -0
- package/bin/lattice-work-order-adapter.mjs +0 -0
- package/bin/lattice.mjs +3 -1
- package/docs/bridge-setup.md +248 -248
- package/docs/schemas/lattice.executor_packet.v1.schema.json +57 -57
- package/docs/schemas/lattice.executor_receipt.v1.schema.json +66 -66
- package/docs/schemas/lattice.phase_todo_revision.v3.schema.json +360 -360
- package/docs/schemas/lattice.plan_create_input.v1.schema.json +56 -56
- package/docs/schemas/lattice.plan_create_input.v2.schema.json +72 -72
- package/docs/schemas/lattice.plan_create_input.v3.schema.json +81 -81
- package/docs/schemas/lattice.plan_create_input.v4.schema.json +357 -85
- package/docs/schemas/lattice.plan_scope_review.v1.schema.json +55 -55
- package/docs/schemas/lattice.run_request.v1.schema.json +238 -238
- package/docs/schemas/lattice.runtime_adapter_capabilities.v2.schema.json +55 -55
- package/docs/schemas/lattice.runtime_adapter_registration_input.v1.schema.json +78 -78
- package/docs/schemas/lattice.runtime_adapter_registration_input.v2.schema.json +86 -86
- package/docs/schemas/lattice.todo_extraction.v2.schema.json +298 -298
- package/docs/schemas/lattice.todo_extraction.v3.schema.json +150 -150
- package/docs/schemas/lattice.todo_extraction.v4.schema.json +161 -161
- package/docs/schemas/lattice.todo_revision.v2.schema.json +260 -260
- package/docs/schemas/lattice.todo_revision_set.v3.schema.json +363 -363
- package/docs/schemas/lattice.todo_structure_binding.v1.schema.json +47 -47
- package/docs/schemas/lattice.todo_structure_realization.v1.schema.json +55 -55
- package/docs/schemas/lattice.todo_structure_set.v1.schema.json +264 -264
- package/package.json +109 -109
- package/sensor/LICENSE +21 -21
- package/sensor/NOTICE +19 -19
- package/sensor/dist/bin/lattice-sensor.js +9 -9
- package/sensor/dist/db/index.js +24 -24
- package/sensor/dist/db/migrations.js +41 -41
- package/sensor/dist/db/queries.js +164 -164
- package/sensor/dist/db/schema.sql +205 -205
- package/sensor/dist/directory.js +5 -5
- package/sensor/dist/extraction/wasm/tree-sitter-c_sharp.wasm +0 -0
- package/sensor/dist/extraction/wasm/tree-sitter-cfml.wasm +0 -0
- package/sensor/dist/extraction/wasm/tree-sitter-cfquery.wasm +0 -0
- package/sensor/dist/extraction/wasm/tree-sitter-cfscript.wasm +0 -0
- package/sensor/dist/extraction/wasm/tree-sitter-cobol.wasm +0 -0
- package/sensor/dist/extraction/wasm/tree-sitter-erlang.wasm +0 -0
- package/sensor/dist/extraction/wasm/tree-sitter-go.wasm +0 -0
- package/sensor/dist/extraction/wasm/tree-sitter-java.wasm +0 -0
- package/sensor/dist/extraction/wasm/tree-sitter-javascript.wasm +0 -0
- package/sensor/dist/extraction/wasm/tree-sitter-nix.wasm +0 -0
- package/sensor/dist/extraction/wasm/tree-sitter-pascal.wasm +0 -0
- package/sensor/dist/extraction/wasm/tree-sitter-python.wasm +0 -0
- package/sensor/dist/extraction/wasm/tree-sitter-tsx.wasm +0 -0
- package/sensor/dist/extraction/wasm/tree-sitter-typescript.wasm +0 -0
- package/sensor/dist/extraction/wasm/tree-sitter-vbnet.wasm +0 -0
- package/sensor/dist/mcp/liveness-watchdog.js +53 -53
- package/sensor/dist/mcp/server-instructions.js +95 -95
- package/sensor/package.json +56 -56
- package/src/project-cli.mjs +164 -24
- package/src/todo-authoring-input.mjs +35 -5
- package/src/todo-cli.mjs +2 -2
- package/src/todo-store.mjs +52 -21
package/README.md
CHANGED
|
@@ -1,303 +1,303 @@
|
|
|
1
|
-
<p align="center">
|
|
2
|
-
<img src=".github/og.png" alt="Lattice — several viable routes emerging through an apparently blocked mountain valley" width="100%">
|
|
3
|
-
<br>
|
|
4
|
-
<sub><em>This image represents several viable paths emerging from terrain that first appeared blocked, as autonomous executors begin moving in coordination.</em></sub>
|
|
5
|
-
</p>
|
|
6
|
-
|
|
7
|
-
# Lattice
|
|
8
|
-
|
|
9
|
-
[](https://www.npmjs.com/package/@quolu/lattice)
|
|
10
|
-
[](https://github.com/kitepon/Lattice/actions/workflows/ci.yml)
|
|
11
|
-
[](LICENSE)
|
|
12
|
-
[](https://nodejs.org/)
|
|
13
|
-
[](#patent)
|
|
14
|
-
|
|
15
|
-
**English** · [日本語](README.ja.md)
|
|
16
|
-
|
|
17
|
-
> **Stop serializing work that only looks like it conflicts.**
|
|
18
|
-
> Lattice is a schedulability compiler for multi-agent development. It observes the real
|
|
19
|
-
> boundaries of your codebase, proves which tasks can run in parallel, and — when two tasks
|
|
20
|
-
> genuinely collide — **refactors the seam between them and recompiles the plan** so they can
|
|
21
|
-
> run in parallel after all.
|
|
22
|
-
|
|
23
|
-
Built and maintained by [Quo](https://x.com/QLyun35332) at [kitepon.dev](https://kitepon.dev/en).
|
|
24
|
-
|
|
25
|
-
## Why
|
|
26
|
-
|
|
27
|
-
Give three coding agents three tasks and the usual outcome is one of two failures:
|
|
28
|
-
|
|
29
|
-
- **You serialize too much.** "These both touch `renderer.ts`, so run them one at a time."
|
|
30
|
-
Often they touch *different symbols* in that file and could have run together.
|
|
31
|
-
- **You serialize too little.** Nothing declared a dependency, so you run them in parallel and
|
|
32
|
-
discover the collision after both have written conflicting code.
|
|
33
|
-
|
|
34
|
-
Both failures come from the same gap: *nobody actually measured the boundary.* Dependency
|
|
35
|
-
arrows in a task list are a claim about intent, not evidence about code.
|
|
36
|
-
|
|
37
|
-
Lattice closes that gap with a different move. It does not just **detect** the conflict — it
|
|
38
|
-
**removes** it. When two tasks contend for one file, Lattice derives a cut, applies it in an
|
|
39
|
-
isolated worktree, verifies the transform against five acceptance conditions, and recompiles the
|
|
40
|
-
plan against the transformed source. The conflict edge disappears because the shared surface
|
|
41
|
-
stopped being shared.
|
|
42
|
-
|
|
43
|
-
## What it actually does
|
|
44
|
-
|
|
45
|
-
```
|
|
46
|
-
declare boundaries → compile independence → conflict?
|
|
47
|
-
├─ no → run in parallel
|
|
48
|
-
└─ yes → propose a seam
|
|
49
|
-
→ transform in an isolated worktree
|
|
50
|
-
→ verify (5 conditions)
|
|
51
|
-
→ land + recompile → run in parallel
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
**A real example, from this repository.** Two tasks both needed to change
|
|
55
|
-
`src/seam-commit.mjs`. Lattice compiled the declarations, reported `conflict_count: 1` with
|
|
56
|
-
`severability: code_seam`, proposed a cut, and applied it in an isolated worktree. After all
|
|
57
|
-
five acceptance conditions passed, the file was split into one owned surface per task plus a
|
|
58
|
-
shared and a residual surface. Recompiling reported `conflict_count: 0` and placed both tasks in
|
|
59
|
-
the same parallel group.
|
|
60
|
-
|
|
61
|
-
Nobody hand-refactored that file. The product cut it so the work could parallelize.
|
|
62
|
-
|
|
63
|
-
### Task memory travels with the task
|
|
64
|
-
|
|
65
|
-
Every newly authored ToDo carries an initial Markdown design memo. Empty text and a file reference are
|
|
66
|
-
not accepted; an agent with no plan must explicitly write `NO_PLAN`. Lattice asks:
|
|
67
|
-
“あなたがこのToDoに対して、何も考えていないならば、設計メモに `NO_PLAN` と書いてください”.
|
|
68
|
-
A normal `lattice todo show` and every successful `lattice todo start` return that memo automatically.
|
|
69
|
-
|
|
70
|
-
After work begins, an agent can append decisions, rejected approaches, findings, cautions, and open
|
|
71
|
-
questions. These remain a separate, append-only `note_context`, with origin, correction state, chain
|
|
72
|
-
head, overflow, and the full-history command.
|
|
73
|
-
|
|
74
|
-
```bash
|
|
75
|
-
lattice todo note --plan <key> --task <id> --message "Use the existing parser; do not add a fallback"
|
|
76
|
-
lattice todo show --plan <key> --task <id> --json
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
The selected ToDo's detail pane shows the initial design memo and the append-only note bodies, plus the
|
|
80
|
-
status of each prerequisite and dependent ToDo (pending, in progress, done, blocked) and whether the ToDo
|
|
81
|
-
can run in parallel. Note bodies are carried by every rendered surface, including HTML served outside the
|
|
82
|
-
repository. Static per-project HTML is not generated; `lattice todo gantt serve` and the shared dashboard
|
|
83
|
-
read the store dynamically.
|
|
84
|
-
|
|
85
|
-
### Check a ToDo's dataflow before and after implementation
|
|
86
|
-
|
|
87
|
-
A code-changing plan can explicitly opt into logical dataflow inspection after the plan is defined.
|
|
88
|
-
Non-code plans such as publishing or operations are left unchanged. Saving a planned source does not
|
|
89
|
-
enable the feature. Only an authoritative compile on a clean worktree that returns `consistent` emits
|
|
90
|
-
an immutable binding for that exact plan version.
|
|
91
|
-
|
|
92
|
-
```bash
|
|
93
|
-
lattice todo structure --schema --json
|
|
94
|
-
lattice todo structure input --plan <key> --input structure.json --dry-run --json
|
|
95
|
-
lattice todo structure input --plan <key> --input structure.json
|
|
96
|
-
lattice todo structure compile --plan <key> --input .lattice/todo/structure/<key>.json
|
|
97
|
-
lattice todo structure --plan <key> --json
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
The verdict is three-valued: `consistent | inconsistent | unknown`. Unknown is never treated as success.
|
|
101
|
-
Findings identify the relevant task, data port, code anchor, and commit, and include the next action.
|
|
102
|
-
The planned form remains immutable; implementation changes are appended as per-task realizations. A graph
|
|
103
|
-
task in an enabled plan cannot complete without a fresh realization. After every task is done, Lattice
|
|
104
|
-
recompiles the final HEAD and requires a fresh, consistent finalization before the terminal phase can close.
|
|
105
|
-
|
|
106
|
-
```bash
|
|
107
|
-
lattice todo structure realize --plan <key> --task <id> --input realization.json
|
|
108
|
-
lattice todo done --plan <key> --task <id> --evidence evidence.json
|
|
109
|
-
lattice todo structure finalize --plan <key> --json
|
|
110
|
-
```
|
|
111
|
-
|
|
112
|
-
The dynamic dashboard exposes this as a separate **Structure inspection** pane. It shows task, data, code,
|
|
113
|
-
external contract, and commit-provenance nodes; planned, realized, and effective forms; findings; and
|
|
114
|
-
freshness. Dataflow edges are never mixed into the process-dependency diagram. Normal reads and dashboard
|
|
115
|
-
renders use saved artifacts without silently running the sensor. Plans that do not opt in retain their
|
|
116
|
-
existing lifecycle and do not gain a structure pane.
|
|
117
|
-
|
|
118
|
-
### The five acceptance conditions
|
|
119
|
-
|
|
120
|
-
A transform is adopted only when **all five** hold. One missing condition rejects it:
|
|
121
|
-
|
|
122
|
-
| Condition | Meaning |
|
|
123
|
-
|---|---|
|
|
124
|
-
| `behavior_equivalent` | The original path's public export surface is preserved, and no moved code references a symbol that stayed behind without a binding (severed-reference net) |
|
|
125
|
-
| `focused_tests_passed` | The affected tests actually pass against the transformed source |
|
|
126
|
-
| `sensor_fresh` | The structure index was rebuilt and covers the new surfaces |
|
|
127
|
-
| `overlap_reduced` | The target conflict is gone **and** plan-wide conflict pairs did not increase |
|
|
128
|
-
| `parallelism_improved` | The number of execution waves went down |
|
|
129
|
-
|
|
130
|
-
### Runtime, not just planning
|
|
131
|
-
|
|
132
|
-
Complete separation is not obtainable at planning time — dynamic dispatch, runtime-resolved
|
|
133
|
-
paths, and external state always leave residue. That is the design, not a deficiency: Lattice
|
|
134
|
-
carries a second stage at runtime.
|
|
135
|
-
|
|
136
|
-
While work executes, Lattice observes **what was actually changed**, not what was declared. When
|
|
137
|
-
it sees a task writing outside its declared scope, or into another running task's scope, it
|
|
138
|
-
raises a runtime conflict — and can either hold one side while the other commits, or transform
|
|
139
|
-
the seam and resume both. Both treatments are exercised end-to-end against a live store in the
|
|
140
|
-
integration suite.
|
|
141
|
-
|
|
142
|
-
Two projection surfaces support that decision without scoring anyone. `lattice run seam profile`
|
|
143
|
-
(and `todo seam-profile` at plan time) reports the countable anatomy of a cut — cross references,
|
|
144
|
-
shared module state with read/write distinction, shared imports, cycles — with declared blind
|
|
145
|
-
spots, and never persists into any digested artifact. And every machine-transform rejection is
|
|
146
|
-
classified by a **certainty gate**: the machine only transforms what it can do with certainty,
|
|
147
|
-
and each refusal says whether fixing the declaration suffices or the seam should be handed to
|
|
148
|
-
the operating AI.
|
|
149
|
-
|
|
150
|
-
## Install
|
|
151
|
-
|
|
152
|
-
```bash
|
|
153
|
-
npm install -g @quolu/lattice
|
|
154
|
-
```
|
|
155
|
-
|
|
156
|
-
Requires **Node.js 22.13 or newer, except 25.x** (`engines: >=22.13 <25 || >=26`; Node 25's V8
|
|
157
|
-
turboshaft WASM JIT breaks the bundled sensor, so it is blocked with a banner). The structure sensor ships inside the package — there is nothing
|
|
158
|
-
else to install, and Lattice never falls back to a sensor on your `PATH`.
|
|
159
|
-
|
|
160
|
-
## Quick start
|
|
161
|
-
|
|
162
|
-
Every project begins with typed discovery. Never guess from directory layout:
|
|
163
|
-
|
|
164
|
-
```bash
|
|
165
|
-
lattice status --json
|
|
166
|
-
```
|
|
167
|
-
|
|
168
|
-
`state` is one of `uninitialized | ready | active_run | invalid`, and `next_action` gives the
|
|
169
|
-
canonical next command. Then index the codebase and declare boundaries:
|
|
170
|
-
|
|
171
|
-
```bash
|
|
172
|
-
lattice sensor init . --json
|
|
173
|
-
```
|
|
174
|
-
|
|
175
|
-
Write a draft declaring what each task owns, then let the tool supply the parts you cannot
|
|
176
|
-
hand-write — fresh observations, provenance wiring, canonical bytes:
|
|
177
|
-
|
|
178
|
-
```bash
|
|
179
|
-
lattice todo independence witness scaffold --plan <key> --input draft.json
|
|
180
|
-
lattice todo independence compile --plan <key> --input .lattice/todo/witness/<key>.json
|
|
181
|
-
lattice todo independence --plan <key> --json
|
|
182
|
-
```
|
|
183
|
-
|
|
184
|
-
If the verdict reports a conflict with `severability: code_seam`, ask for a cut and apply it:
|
|
185
|
-
|
|
186
|
-
```bash
|
|
187
|
-
lattice todo seam-proposal compile --plan <key>
|
|
188
|
-
lattice todo seam-proposal apply --plan <key> # isolated worktree, five conditions
|
|
189
|
-
lattice todo seam-proposal land --plan <key> --names names.json
|
|
190
|
-
```
|
|
191
|
-
|
|
192
|
-
`lattice todo status --json` exposes `dispatch_frontier`: every ready task is the default
|
|
193
|
-
parallel set. Starting one of them does not require `--parallel-frontier` or
|
|
194
|
-
`--override-reason`. Those flags record intent; they are not gates.
|
|
195
|
-
`--serial-confirmed` and `--serialization-reviewed` are accepted only for compatibility.
|
|
196
|
-
If an independence record exists but the task is undeclared or stale, `todo start`
|
|
197
|
-
fails with `INDEPENDENCE_UNVERIFIED`. `independence compile` fails with
|
|
198
|
-
`INDEPENDENCE_READY_UNDECLARED` when `next_ready` is missing from the witness.
|
|
199
|
-
|
|
200
|
-
```bash
|
|
201
|
-
lattice todo start --plan <key> --task <id>
|
|
202
|
-
```
|
|
203
|
-
|
|
204
|
-
Full CLI surface: `lattice --help`, then
|
|
205
|
-
`lattice <plan|run|event|todo|sensor|factory-diagnostics|runtime-errors|bridge|hooks> --help`.
|
|
206
|
-
|
|
207
|
-
## Design principles
|
|
208
|
-
|
|
209
|
-
**The operating AI is part of the apparatus.** Lattice is driven by an AI agent, and that agent
|
|
210
|
-
is not outside the system — it is a component of it. So Lattice supplies only what the AI
|
|
211
|
-
*cannot* produce for itself: structure observation, contracts, verification, records, and
|
|
212
|
-
version boundaries. Estimation, judgment, and naming remain the AI's job. You will not find an
|
|
213
|
-
LLM call inside this product; adding one would duplicate a capability already present at the
|
|
214
|
-
point of use.
|
|
215
|
-
|
|
216
|
-
**Unknown is never rounded to "no conflict."** If a boundary was not verified, the verdict says
|
|
217
|
-
`missing`, not "independent." The absence of a dependency edge is not evidence of independence.
|
|
218
|
-
|
|
219
|
-
**Fail closed, and say why.** Every rejection carries a typed reason and a next action. A
|
|
220
|
-
transform that cannot be verified is not adopted. A finding that cannot be independently
|
|
221
|
-
re-derived is not recorded.
|
|
222
|
-
|
|
223
|
-
**Heavy audit is on by default.** A plan without explicit phases still carries an implicit
|
|
224
|
-
terminal audit: every task being done means `gate_ready` — *awaiting audit* — not finished. The
|
|
225
|
-
live dependency diagram refuses to fold such a plan away, because folding is how the product
|
|
226
|
-
says "closed", and nothing gets there without an evidence-bound `phase accept`. Creation is never
|
|
227
|
-
rejected over it; the requirement is reported instead. And the audit gate never touches dispatch:
|
|
228
|
-
phases order reviews, the ToDo DAG orders work
|
|
229
|
-
([ADR 0147](docs/adr/0147-audit-is-on-by-default.md)).
|
|
230
|
-
|
|
231
|
-
**History closes unaudited, never audited.** Work that finished long ago cannot be audited — the
|
|
232
|
-
code under review has already moved. Demanding an audit there produces either a false finding
|
|
233
|
-
(pointing at a later, intentional change) or a rubber stamp. So there is a third terminal state,
|
|
234
|
-
`closed_unaudited`: recorded with a reason, folded away like finished work, and **structurally
|
|
235
|
-
incapable of passing as `accepted`** — phase-accept dependencies unlock on `accepted` alone. The
|
|
236
|
-
bulk entry point never runs by itself, and the machine never infers "old enough to skip"; a human
|
|
237
|
-
decides what gets audited and what becomes history
|
|
238
|
-
([ADR 0148](docs/adr/0148-history-closes-unaudited-not-audited.md)).
|
|
239
|
-
|
|
240
|
-
## Patent
|
|
241
|
-
|
|
242
|
-
The design in this repository is the subject of a Japanese patent application:
|
|
243
|
-
|
|
244
|
-
| | |
|
|
245
|
-
|---|---|
|
|
246
|
-
| Application number | 特願2026-178950 (JP 2026-178950) |
|
|
247
|
-
| Filing date | 2026-07-27 |
|
|
248
|
-
| Title | 情報処理装置、ソフトウェア開発制御方法及びプログラム<br>(Information processing apparatus, software development control method, and program) |
|
|
249
|
-
| Claims | 12 |
|
|
250
|
-
|
|
251
|
-
Noncommercial use is permitted under the [License](#license) below.
|
|
252
|
-
**A separate commercial license is required for commercial use.**
|
|
253
|
-
|
|
254
|
-
## Ownership boundary
|
|
255
|
-
|
|
256
|
-
This repository owns the plan/ToDo/run store, the bundled sensor, schemas, migrations,
|
|
257
|
-
releases, and diagnostics. [dotagents](https://github.com/kitepon-rgb/dotagents) is the
|
|
258
|
-
internal toolchain behind kitepon.dev and owns cross-product installation and host integration.
|
|
259
|
-
|
|
260
|
-
- Product philosophy: [PLAN.md](PLAN.md)
|
|
261
|
-
- Public contract: [docs/00_product-contract.md](docs/00_product-contract.md)
|
|
262
|
-
- Immutable decisions: [docs/adr/](docs/adr/)
|
|
263
|
-
- Document map: [docs/README.md](docs/README.md)
|
|
264
|
-
|
|
265
|
-
## Development
|
|
266
|
-
|
|
267
|
-
```bash
|
|
268
|
-
npm test # product test gate
|
|
269
|
-
npm run check # syntax + control-character gate
|
|
270
|
-
npm run ci # full gate
|
|
271
|
-
```
|
|
272
|
-
|
|
273
|
-
The full gate includes checks that are unusual and deliberate:
|
|
274
|
-
|
|
275
|
-
- **`check:cli-surface`** — every shipped command must have help text *and* be exercised through
|
|
276
|
-
a CLI entry point by a test. Shipping a command nobody ever ran is treated as a defect.
|
|
277
|
-
- **`check:open-questions`** — every unresolved question in an ADR must carry an explicit firing
|
|
278
|
-
condition, so "deferred" is never indistinguishable from "forgotten."
|
|
279
|
-
- **`check:reachability`** — every module must be reachable from a product entry point, or be
|
|
280
|
-
declared a research artifact with a reason.
|
|
281
|
-
|
|
282
|
-
Detailed operational notes (dashboard, bridge, actor environment, store transactions) are in
|
|
283
|
-
[README.ja.md](README.ja.md) and [docs/](docs/).
|
|
284
|
-
|
|
285
|
-
## License
|
|
286
|
-
|
|
287
|
-
**[PolyForm Noncommercial License 1.0.0](LICENSE)** — free for noncommercial use.
|
|
288
|
-
|
|
289
|
-
- **Free:** personal projects, study and research, hobby and amateur work, charities,
|
|
290
|
-
educational institutions, public research organizations, and government institutions.
|
|
291
|
-
- **Permission required:** commercial use. That includes use inside a company's paid work or products,
|
|
292
|
-
regardless of whether Lattice itself is redistributed.
|
|
293
|
-
|
|
294
|
-
**For commercial use**, a separate commercial license is required.
|
|
295
|
-
Enquiries can be made by email at [kitepon@gmail.com](mailto:kitepon@gmail.com). Whether a
|
|
296
|
-
license is granted, and on what terms, is decided case by case.
|
|
297
|
-
|
|
298
|
-
The bundled structure sensor in [`sensor/`](sensor/) is third-party work absorbed into this
|
|
299
|
-
repository and remains under the **MIT License**. Its upstream origin and attribution are
|
|
300
|
-
recorded in [`sensor/NOTICE`](sensor/NOTICE); the license text is
|
|
301
|
-
[`sensor/LICENSE`](sensor/LICENSE). The terms above do not modify it.
|
|
302
|
-
|
|
303
|
-
© 2026 quolu (kitepon-rgb)
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src=".github/og.png" alt="Lattice — several viable routes emerging through an apparently blocked mountain valley" width="100%">
|
|
3
|
+
<br>
|
|
4
|
+
<sub><em>This image represents several viable paths emerging from terrain that first appeared blocked, as autonomous executors begin moving in coordination.</em></sub>
|
|
5
|
+
</p>
|
|
6
|
+
|
|
7
|
+
# Lattice
|
|
8
|
+
|
|
9
|
+
[](https://www.npmjs.com/package/@quolu/lattice)
|
|
10
|
+
[](https://github.com/kitepon/Lattice/actions/workflows/ci.yml)
|
|
11
|
+
[](LICENSE)
|
|
12
|
+
[](https://nodejs.org/)
|
|
13
|
+
[](#patent)
|
|
14
|
+
|
|
15
|
+
**English** · [日本語](README.ja.md)
|
|
16
|
+
|
|
17
|
+
> **Stop serializing work that only looks like it conflicts.**
|
|
18
|
+
> Lattice is a schedulability compiler for multi-agent development. It observes the real
|
|
19
|
+
> boundaries of your codebase, proves which tasks can run in parallel, and — when two tasks
|
|
20
|
+
> genuinely collide — **refactors the seam between them and recompiles the plan** so they can
|
|
21
|
+
> run in parallel after all.
|
|
22
|
+
|
|
23
|
+
Built and maintained by [Quo](https://x.com/QLyun35332) at [kitepon.dev](https://kitepon.dev/en).
|
|
24
|
+
|
|
25
|
+
## Why
|
|
26
|
+
|
|
27
|
+
Give three coding agents three tasks and the usual outcome is one of two failures:
|
|
28
|
+
|
|
29
|
+
- **You serialize too much.** "These both touch `renderer.ts`, so run them one at a time."
|
|
30
|
+
Often they touch *different symbols* in that file and could have run together.
|
|
31
|
+
- **You serialize too little.** Nothing declared a dependency, so you run them in parallel and
|
|
32
|
+
discover the collision after both have written conflicting code.
|
|
33
|
+
|
|
34
|
+
Both failures come from the same gap: *nobody actually measured the boundary.* Dependency
|
|
35
|
+
arrows in a task list are a claim about intent, not evidence about code.
|
|
36
|
+
|
|
37
|
+
Lattice closes that gap with a different move. It does not just **detect** the conflict — it
|
|
38
|
+
**removes** it. When two tasks contend for one file, Lattice derives a cut, applies it in an
|
|
39
|
+
isolated worktree, verifies the transform against five acceptance conditions, and recompiles the
|
|
40
|
+
plan against the transformed source. The conflict edge disappears because the shared surface
|
|
41
|
+
stopped being shared.
|
|
42
|
+
|
|
43
|
+
## What it actually does
|
|
44
|
+
|
|
45
|
+
```
|
|
46
|
+
declare boundaries → compile independence → conflict?
|
|
47
|
+
├─ no → run in parallel
|
|
48
|
+
└─ yes → propose a seam
|
|
49
|
+
→ transform in an isolated worktree
|
|
50
|
+
→ verify (5 conditions)
|
|
51
|
+
→ land + recompile → run in parallel
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
**A real example, from this repository.** Two tasks both needed to change
|
|
55
|
+
`src/seam-commit.mjs`. Lattice compiled the declarations, reported `conflict_count: 1` with
|
|
56
|
+
`severability: code_seam`, proposed a cut, and applied it in an isolated worktree. After all
|
|
57
|
+
five acceptance conditions passed, the file was split into one owned surface per task plus a
|
|
58
|
+
shared and a residual surface. Recompiling reported `conflict_count: 0` and placed both tasks in
|
|
59
|
+
the same parallel group.
|
|
60
|
+
|
|
61
|
+
Nobody hand-refactored that file. The product cut it so the work could parallelize.
|
|
62
|
+
|
|
63
|
+
### Task memory travels with the task
|
|
64
|
+
|
|
65
|
+
Every newly authored ToDo carries an initial Markdown design memo. Empty text and a file reference are
|
|
66
|
+
not accepted; an agent with no plan must explicitly write `NO_PLAN`. Lattice asks:
|
|
67
|
+
“あなたがこのToDoに対して、何も考えていないならば、設計メモに `NO_PLAN` と書いてください”.
|
|
68
|
+
A normal `lattice todo show` and every successful `lattice todo start` return that memo automatically.
|
|
69
|
+
|
|
70
|
+
After work begins, an agent can append decisions, rejected approaches, findings, cautions, and open
|
|
71
|
+
questions. These remain a separate, append-only `note_context`, with origin, correction state, chain
|
|
72
|
+
head, overflow, and the full-history command.
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
lattice todo note --plan <key> --task <id> --message "Use the existing parser; do not add a fallback"
|
|
76
|
+
lattice todo show --plan <key> --task <id> --json
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
The selected ToDo's detail pane shows the initial design memo and the append-only note bodies, plus the
|
|
80
|
+
status of each prerequisite and dependent ToDo (pending, in progress, done, blocked) and whether the ToDo
|
|
81
|
+
can run in parallel. Note bodies are carried by every rendered surface, including HTML served outside the
|
|
82
|
+
repository. Static per-project HTML is not generated; `lattice todo gantt serve` and the shared dashboard
|
|
83
|
+
read the store dynamically.
|
|
84
|
+
|
|
85
|
+
### Check a ToDo's dataflow before and after implementation
|
|
86
|
+
|
|
87
|
+
A code-changing plan can explicitly opt into logical dataflow inspection after the plan is defined.
|
|
88
|
+
Non-code plans such as publishing or operations are left unchanged. Saving a planned source does not
|
|
89
|
+
enable the feature. Only an authoritative compile on a clean worktree that returns `consistent` emits
|
|
90
|
+
an immutable binding for that exact plan version.
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
lattice todo structure --schema --json
|
|
94
|
+
lattice todo structure input --plan <key> --input structure.json --dry-run --json
|
|
95
|
+
lattice todo structure input --plan <key> --input structure.json
|
|
96
|
+
lattice todo structure compile --plan <key> --input .lattice/todo/structure/<key>.json
|
|
97
|
+
lattice todo structure --plan <key> --json
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
The verdict is three-valued: `consistent | inconsistent | unknown`. Unknown is never treated as success.
|
|
101
|
+
Findings identify the relevant task, data port, code anchor, and commit, and include the next action.
|
|
102
|
+
The planned form remains immutable; implementation changes are appended as per-task realizations. A graph
|
|
103
|
+
task in an enabled plan cannot complete without a fresh realization. After every task is done, Lattice
|
|
104
|
+
recompiles the final HEAD and requires a fresh, consistent finalization before the terminal phase can close.
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
lattice todo structure realize --plan <key> --task <id> --input realization.json
|
|
108
|
+
lattice todo done --plan <key> --task <id> --evidence evidence.json
|
|
109
|
+
lattice todo structure finalize --plan <key> --json
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
The dynamic dashboard exposes this as a separate **Structure inspection** pane. It shows task, data, code,
|
|
113
|
+
external contract, and commit-provenance nodes; planned, realized, and effective forms; findings; and
|
|
114
|
+
freshness. Dataflow edges are never mixed into the process-dependency diagram. Normal reads and dashboard
|
|
115
|
+
renders use saved artifacts without silently running the sensor. Plans that do not opt in retain their
|
|
116
|
+
existing lifecycle and do not gain a structure pane.
|
|
117
|
+
|
|
118
|
+
### The five acceptance conditions
|
|
119
|
+
|
|
120
|
+
A transform is adopted only when **all five** hold. One missing condition rejects it:
|
|
121
|
+
|
|
122
|
+
| Condition | Meaning |
|
|
123
|
+
|---|---|
|
|
124
|
+
| `behavior_equivalent` | The original path's public export surface is preserved, and no moved code references a symbol that stayed behind without a binding (severed-reference net) |
|
|
125
|
+
| `focused_tests_passed` | The affected tests actually pass against the transformed source |
|
|
126
|
+
| `sensor_fresh` | The structure index was rebuilt and covers the new surfaces |
|
|
127
|
+
| `overlap_reduced` | The target conflict is gone **and** plan-wide conflict pairs did not increase |
|
|
128
|
+
| `parallelism_improved` | The number of execution waves went down |
|
|
129
|
+
|
|
130
|
+
### Runtime, not just planning
|
|
131
|
+
|
|
132
|
+
Complete separation is not obtainable at planning time — dynamic dispatch, runtime-resolved
|
|
133
|
+
paths, and external state always leave residue. That is the design, not a deficiency: Lattice
|
|
134
|
+
carries a second stage at runtime.
|
|
135
|
+
|
|
136
|
+
While work executes, Lattice observes **what was actually changed**, not what was declared. When
|
|
137
|
+
it sees a task writing outside its declared scope, or into another running task's scope, it
|
|
138
|
+
raises a runtime conflict — and can either hold one side while the other commits, or transform
|
|
139
|
+
the seam and resume both. Both treatments are exercised end-to-end against a live store in the
|
|
140
|
+
integration suite.
|
|
141
|
+
|
|
142
|
+
Two projection surfaces support that decision without scoring anyone. `lattice run seam profile`
|
|
143
|
+
(and `todo seam-profile` at plan time) reports the countable anatomy of a cut — cross references,
|
|
144
|
+
shared module state with read/write distinction, shared imports, cycles — with declared blind
|
|
145
|
+
spots, and never persists into any digested artifact. And every machine-transform rejection is
|
|
146
|
+
classified by a **certainty gate**: the machine only transforms what it can do with certainty,
|
|
147
|
+
and each refusal says whether fixing the declaration suffices or the seam should be handed to
|
|
148
|
+
the operating AI.
|
|
149
|
+
|
|
150
|
+
## Install
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
npm install -g @quolu/lattice
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
Requires **Node.js 22.13 or newer, except 25.x** (`engines: >=22.13 <25 || >=26`; Node 25's V8
|
|
157
|
+
turboshaft WASM JIT breaks the bundled sensor, so it is blocked with a banner). The structure sensor ships inside the package — there is nothing
|
|
158
|
+
else to install, and Lattice never falls back to a sensor on your `PATH`.
|
|
159
|
+
|
|
160
|
+
## Quick start
|
|
161
|
+
|
|
162
|
+
Every project begins with typed discovery. Never guess from directory layout:
|
|
163
|
+
|
|
164
|
+
```bash
|
|
165
|
+
lattice status --json
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
`state` is one of `uninitialized | ready | active_run | invalid`, and `next_action` gives the
|
|
169
|
+
canonical next command. Then index the codebase and declare boundaries:
|
|
170
|
+
|
|
171
|
+
```bash
|
|
172
|
+
lattice sensor init . --json
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
Write a draft declaring what each task owns, then let the tool supply the parts you cannot
|
|
176
|
+
hand-write — fresh observations, provenance wiring, canonical bytes:
|
|
177
|
+
|
|
178
|
+
```bash
|
|
179
|
+
lattice todo independence witness scaffold --plan <key> --input draft.json
|
|
180
|
+
lattice todo independence compile --plan <key> --input .lattice/todo/witness/<key>.json
|
|
181
|
+
lattice todo independence --plan <key> --json
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
If the verdict reports a conflict with `severability: code_seam`, ask for a cut and apply it:
|
|
185
|
+
|
|
186
|
+
```bash
|
|
187
|
+
lattice todo seam-proposal compile --plan <key>
|
|
188
|
+
lattice todo seam-proposal apply --plan <key> # isolated worktree, five conditions
|
|
189
|
+
lattice todo seam-proposal land --plan <key> --names names.json
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
`lattice todo status --json` exposes `dispatch_frontier`: every ready task is the default
|
|
193
|
+
parallel set. Starting one of them does not require `--parallel-frontier` or
|
|
194
|
+
`--override-reason`. Those flags record intent; they are not gates.
|
|
195
|
+
`--serial-confirmed` and `--serialization-reviewed` are accepted only for compatibility.
|
|
196
|
+
If an independence record exists but the task is undeclared or stale, `todo start`
|
|
197
|
+
fails with `INDEPENDENCE_UNVERIFIED`. `independence compile` fails with
|
|
198
|
+
`INDEPENDENCE_READY_UNDECLARED` when `next_ready` is missing from the witness.
|
|
199
|
+
|
|
200
|
+
```bash
|
|
201
|
+
lattice todo start --plan <key> --task <id>
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
Full CLI surface: `lattice --help`, then
|
|
205
|
+
`lattice <plan|run|event|todo|sensor|factory-diagnostics|runtime-errors|bridge|hooks> --help`.
|
|
206
|
+
|
|
207
|
+
## Design principles
|
|
208
|
+
|
|
209
|
+
**The operating AI is part of the apparatus.** Lattice is driven by an AI agent, and that agent
|
|
210
|
+
is not outside the system — it is a component of it. So Lattice supplies only what the AI
|
|
211
|
+
*cannot* produce for itself: structure observation, contracts, verification, records, and
|
|
212
|
+
version boundaries. Estimation, judgment, and naming remain the AI's job. You will not find an
|
|
213
|
+
LLM call inside this product; adding one would duplicate a capability already present at the
|
|
214
|
+
point of use.
|
|
215
|
+
|
|
216
|
+
**Unknown is never rounded to "no conflict."** If a boundary was not verified, the verdict says
|
|
217
|
+
`missing`, not "independent." The absence of a dependency edge is not evidence of independence.
|
|
218
|
+
|
|
219
|
+
**Fail closed, and say why.** Every rejection carries a typed reason and a next action. A
|
|
220
|
+
transform that cannot be verified is not adopted. A finding that cannot be independently
|
|
221
|
+
re-derived is not recorded.
|
|
222
|
+
|
|
223
|
+
**Heavy audit is on by default.** A plan without explicit phases still carries an implicit
|
|
224
|
+
terminal audit: every task being done means `gate_ready` — *awaiting audit* — not finished. The
|
|
225
|
+
live dependency diagram refuses to fold such a plan away, because folding is how the product
|
|
226
|
+
says "closed", and nothing gets there without an evidence-bound `phase accept`. Creation is never
|
|
227
|
+
rejected over it; the requirement is reported instead. And the audit gate never touches dispatch:
|
|
228
|
+
phases order reviews, the ToDo DAG orders work
|
|
229
|
+
([ADR 0147](docs/adr/0147-audit-is-on-by-default.md)).
|
|
230
|
+
|
|
231
|
+
**History closes unaudited, never audited.** Work that finished long ago cannot be audited — the
|
|
232
|
+
code under review has already moved. Demanding an audit there produces either a false finding
|
|
233
|
+
(pointing at a later, intentional change) or a rubber stamp. So there is a third terminal state,
|
|
234
|
+
`closed_unaudited`: recorded with a reason, folded away like finished work, and **structurally
|
|
235
|
+
incapable of passing as `accepted`** — phase-accept dependencies unlock on `accepted` alone. The
|
|
236
|
+
bulk entry point never runs by itself, and the machine never infers "old enough to skip"; a human
|
|
237
|
+
decides what gets audited and what becomes history
|
|
238
|
+
([ADR 0148](docs/adr/0148-history-closes-unaudited-not-audited.md)).
|
|
239
|
+
|
|
240
|
+
## Patent
|
|
241
|
+
|
|
242
|
+
The design in this repository is the subject of a Japanese patent application:
|
|
243
|
+
|
|
244
|
+
| | |
|
|
245
|
+
|---|---|
|
|
246
|
+
| Application number | 特願2026-178950 (JP 2026-178950) |
|
|
247
|
+
| Filing date | 2026-07-27 |
|
|
248
|
+
| Title | 情報処理装置、ソフトウェア開発制御方法及びプログラム<br>(Information processing apparatus, software development control method, and program) |
|
|
249
|
+
| Claims | 12 |
|
|
250
|
+
|
|
251
|
+
Noncommercial use is permitted under the [License](#license) below.
|
|
252
|
+
**A separate commercial license is required for commercial use.**
|
|
253
|
+
|
|
254
|
+
## Ownership boundary
|
|
255
|
+
|
|
256
|
+
This repository owns the plan/ToDo/run store, the bundled sensor, schemas, migrations,
|
|
257
|
+
releases, and diagnostics. [dotagents](https://github.com/kitepon-rgb/dotagents) is the
|
|
258
|
+
internal toolchain behind kitepon.dev and owns cross-product installation and host integration.
|
|
259
|
+
|
|
260
|
+
- Product philosophy: [PLAN.md](PLAN.md)
|
|
261
|
+
- Public contract: [docs/00_product-contract.md](docs/00_product-contract.md)
|
|
262
|
+
- Immutable decisions: [docs/adr/](docs/adr/)
|
|
263
|
+
- Document map: [docs/README.md](docs/README.md)
|
|
264
|
+
|
|
265
|
+
## Development
|
|
266
|
+
|
|
267
|
+
```bash
|
|
268
|
+
npm test # product test gate
|
|
269
|
+
npm run check # syntax + control-character gate
|
|
270
|
+
npm run ci # full gate
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
The full gate includes checks that are unusual and deliberate:
|
|
274
|
+
|
|
275
|
+
- **`check:cli-surface`** — every shipped command must have help text *and* be exercised through
|
|
276
|
+
a CLI entry point by a test. Shipping a command nobody ever ran is treated as a defect.
|
|
277
|
+
- **`check:open-questions`** — every unresolved question in an ADR must carry an explicit firing
|
|
278
|
+
condition, so "deferred" is never indistinguishable from "forgotten."
|
|
279
|
+
- **`check:reachability`** — every module must be reachable from a product entry point, or be
|
|
280
|
+
declared a research artifact with a reason.
|
|
281
|
+
|
|
282
|
+
Detailed operational notes (dashboard, bridge, actor environment, store transactions) are in
|
|
283
|
+
[README.ja.md](README.ja.md) and [docs/](docs/).
|
|
284
|
+
|
|
285
|
+
## License
|
|
286
|
+
|
|
287
|
+
**[PolyForm Noncommercial License 1.0.0](LICENSE)** — free for noncommercial use.
|
|
288
|
+
|
|
289
|
+
- **Free:** personal projects, study and research, hobby and amateur work, charities,
|
|
290
|
+
educational institutions, public research organizations, and government institutions.
|
|
291
|
+
- **Permission required:** commercial use. That includes use inside a company's paid work or products,
|
|
292
|
+
regardless of whether Lattice itself is redistributed.
|
|
293
|
+
|
|
294
|
+
**For commercial use**, a separate commercial license is required.
|
|
295
|
+
Enquiries can be made by email at [kitepon@gmail.com](mailto:kitepon@gmail.com). Whether a
|
|
296
|
+
license is granted, and on what terms, is decided case by case.
|
|
297
|
+
|
|
298
|
+
The bundled structure sensor in [`sensor/`](sensor/) is third-party work absorbed into this
|
|
299
|
+
repository and remains under the **MIT License**. Its upstream origin and attribution are
|
|
300
|
+
recorded in [`sensor/NOTICE`](sensor/NOTICE); the license text is
|
|
301
|
+
[`sensor/LICENSE`](sensor/LICENSE). The terms above do not modify it.
|
|
302
|
+
|
|
303
|
+
© 2026 quolu (kitepon-rgb)
|
package/bin/lattice-mcp.mjs
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/bin/lattice.mjs
CHANGED
|
@@ -40,7 +40,9 @@ if (help !== null) {
|
|
|
40
40
|
booleans: ['serialization-reviewed'],
|
|
41
41
|
});
|
|
42
42
|
if (flags === null) {
|
|
43
|
-
|
|
43
|
+
// usage違反は受け取った引数をそのまま返す。他surfaceと同じ契約で、
|
|
44
|
+
// 何を打って弾かれたのかが読める(固定文言だと --input の欠落が見えない)。
|
|
45
|
+
process.stderr.write(`lattice: unsupported command or arguments: ${args.join(' ')}\n`);
|
|
44
46
|
process.exitCode = 2;
|
|
45
47
|
} else {
|
|
46
48
|
const { projectCliFailure, runPlanCreate } = await import('../src/project-cli.mjs');
|