changeledger 0.6.4 → 0.8.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/AGENTS.md +15 -8
- package/bin/changeledger.mjs +136 -44
- package/package.json +1 -1
- package/src/check.mjs +106 -5
- package/src/commands/agent.mjs +44 -4
- package/src/commands/context.mjs +95 -15
- package/src/commands/graduate.mjs +20 -8
- package/src/commands/view.mjs +29 -4
- package/src/contract.mjs +11 -6
- package/src/lifecycle.mjs +19 -2
- package/src/metrics.mjs +9 -6
- package/src/viewer/domain.mjs +16 -6
- package/src/viewer/public/app-state.js +15 -0
- package/src/viewer/public/app.js +115 -13
- package/src/viewer/public/styles.css +205 -14
- package/src/viewer/public/view-parts.js +52 -0
- package/templates/contract/close.md +7 -1
- package/templates/contract/core.md +33 -21
- package/templates/contract/delegation.md +2 -1
- package/templates/contract/implement.md +23 -9
- package/templates/contract/readiness.md +5 -2
- package/templates/contract/review.md +5 -0
- package/templates/contract/validation.md +16 -2
|
@@ -3,14 +3,18 @@
|
|
|
3
3
|
Documents under `.changeledger/` are the source of truth. Code is their
|
|
4
4
|
reflection. Work is planned and documented before code is written.
|
|
5
5
|
|
|
6
|
-
##
|
|
6
|
+
## Read complete context before acting
|
|
7
7
|
|
|
8
|
-
Running `changeledger context` is discovery, not compliance by itself.
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
Running `changeledger context` is discovery, not compliance by itself. Capture the first invocation completely in one pass
|
|
9
|
+
and read through the `CHANGELEDGER CONTEXT END` line, then follow the current mode. Never request a preview, summary
|
|
10
|
+
or voluntary line, byte or token cap; if the tool exposes an output budget,
|
|
11
|
+
reserve enough for the whole response. A missing END after this deliberate full
|
|
12
|
+
capture is exceptional recovery: stop and re-run with a larger capture before
|
|
13
|
+
planning or acting on the partial output.
|
|
14
|
+
|
|
15
|
+
While the complete core remains available in the active conversation, a new
|
|
16
|
+
human message alone does not trigger a reload. Load only the specialized mode or
|
|
17
|
+
change-id context required by a real task or lifecycle transition.
|
|
14
18
|
|
|
15
19
|
1. Work starts with conversation. Read-only investigation may clarify a request,
|
|
16
20
|
but create no change or implementation artifact until there is enough clarity
|
|
@@ -20,15 +24,16 @@ modifying files.
|
|
|
20
24
|
agent decides how to divide and execute work within that authorized scope.
|
|
21
25
|
3. Capture every authorized change in `.changeledger/changes/`. The document
|
|
22
26
|
wins when code and documentation disagree.
|
|
23
|
-
4. Never implement a `draft`. After approval,
|
|
24
|
-
non-main branch and commit the approved change document before code.
|
|
27
|
+
4. Never implement a `draft`. After approval, implement one change at a time on
|
|
28
|
+
a non-main branch and commit the approved change document before code.
|
|
25
29
|
5. Keep lifecycle, tasks, ownership and Log current while working.
|
|
26
30
|
6. For types that require review, use a fresh clean-context reviewer before
|
|
27
31
|
human validation.
|
|
28
|
-
7.
|
|
32
|
+
7. `in-validation` stops only that change; the agent never accepts on the human's behalf, but may start another approved change unless it or its `depends_on` chain (direct or transitive) reaches an `in-validation` change.
|
|
29
33
|
8. After human acceptance, reload `changeledger context <id>` for the `done`
|
|
30
|
-
change, then graduate persistent truth
|
|
31
|
-
`changeledger graduate <id> --skip [reason]`; archive
|
|
34
|
+
change, then graduate persistent truth (a new spec is a two-step `--new`
|
|
35
|
+
then `--into`) or run `changeledger graduate <id> --skip [reason]`; archive
|
|
36
|
+
only after that decision.
|
|
32
37
|
|
|
33
38
|
If no approved or in-progress change applies, do not silently edit repository
|
|
34
39
|
files. Create or update a change, or ask the human whether a purely operational,
|
|
@@ -44,7 +49,8 @@ optional and preferred for error-prone operations such as timestamps, lifecycle
|
|
|
44
49
|
transitions and task markers.
|
|
45
50
|
|
|
46
51
|
Delegate only with a clear boundary and benefit. Each delegation prompt states
|
|
47
|
-
ownership, expected output and integration criterion;
|
|
52
|
+
at least ownership, expected output and integration criterion; the task context
|
|
53
|
+
carries the full prompt contract. Coding agents must know
|
|
48
54
|
they share the codebase and must not revert others' work. Do not over-shard or
|
|
49
55
|
overlap write surfaces without an explicit integration plan. Size the model to
|
|
50
56
|
the task's difficulty and risk.
|
|
@@ -58,6 +64,7 @@ in-progress → in-validation → done [no review required]
|
|
|
58
64
|
in-review → in-progress [review retry]
|
|
59
65
|
in-review → blocked → in-progress [review escalation]
|
|
60
66
|
in-validation → in-progress [human rejection]
|
|
67
|
+
done → in-progress [human reopen before durable closure]
|
|
61
68
|
(draft | approved | in-progress | blocked) → discarded
|
|
62
69
|
```
|
|
63
70
|
|
|
@@ -67,22 +74,26 @@ in-validation → in-progress [human rejection]
|
|
|
67
74
|
- `in-review`: independent review required.
|
|
68
75
|
- `in-validation`: stop and wait for human acceptance or rejection.
|
|
69
76
|
- `blocked`: an impediment or decision needs resolution.
|
|
70
|
-
- `done`:
|
|
77
|
+
- `done`: the human accepted the complete result; provisional until durable closure.
|
|
71
78
|
- `discarded`: terminal tombstone; never reopen it.
|
|
72
79
|
|
|
73
80
|
`changeledger status <id> <status>` enforces agent-owned transitions and does not accept `done` or `discarded`.
|
|
74
|
-
The viewer owns `draft → approved` and `in-validation → done|in-progress
|
|
75
|
-
agent performs
|
|
81
|
+
The viewer owns `draft → approved` and `in-validation → done|in-progress`, plus
|
|
82
|
+
eligible `done → in-progress` with a reason; the agent performs other moves. Use
|
|
76
83
|
`changeledger discard <id> "<reason>"`: the discard reason is required and
|
|
77
|
-
logged, and dependencies remain resolvable. `
|
|
78
|
-
|
|
84
|
+
logged, and dependencies remain resolvable. `discarded` never reopens. A `done`
|
|
85
|
+
change can reopen only to finish its original scope before graduation/skip,
|
|
86
|
+
archive or release; after durable closure, later work needs a new change.
|
|
79
87
|
|
|
80
88
|
## Context modes
|
|
81
89
|
|
|
82
90
|
Valid modes: implement, review, spec, release.
|
|
83
91
|
|
|
84
|
-
|
|
85
|
-
context
|
|
92
|
+
Escalate to a mode before acting. Before documenting, run
|
|
93
|
+
`changeledger context spec`. Before executing, run `changeledger context
|
|
94
|
+
implement` or `changeledger context <change-id>`. Run each only after reading
|
|
95
|
+
the complete base output. Every mode and change-id context extends the core
|
|
96
|
+
context already read; it never repeats it.
|
|
86
97
|
|
|
87
98
|
- `changeledger context spec`: author or refine a change.
|
|
88
99
|
- `changeledger context implement`: execute an approved change.
|
|
@@ -98,4 +109,5 @@ Prefer structured CLI queries before scanning files:
|
|
|
98
109
|
- `changeledger graduate --pending`: find accepted changes whose graduation decision is unresolved.
|
|
99
110
|
|
|
100
111
|
Run `changeledger help` or `changeledger <command> --help` for exact CLI syntax.
|
|
101
|
-
Structure is always English
|
|
112
|
+
Structure is always English. Each context delivers the effective policy that
|
|
113
|
+
applies to its task, so you never read `.changeledger/config.yml` raw to operate.
|
|
@@ -21,7 +21,8 @@ owns, what it returns and how the result integrates.
|
|
|
21
21
|
- Verification may be delegated when it catches risk without merely repeating
|
|
22
22
|
the implementer's work.
|
|
23
23
|
- Configured review is special: a fresh clean-context subagent is a correctness
|
|
24
|
-
requirement, not an optimization
|
|
24
|
+
requirement, not an optimization — and read-only: it reports, the
|
|
25
|
+
orchestrator alone records the verdict.
|
|
25
26
|
|
|
26
27
|
## Do not over-shard
|
|
27
28
|
|
|
@@ -17,10 +17,17 @@ to a work branch or ask the human before continuing. Inspect the worktree first.
|
|
|
17
17
|
unrelated changes exist, do not include them silently; ask the human whether to
|
|
18
18
|
stash, commit, ignore or include them before changing the worktree.
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
Implement one change at a time
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
After `approved → in-progress`, create a baseline commit of the approved change
|
|
21
|
+
document before code. Implement one change at a time, even while another
|
|
22
|
+
already-delivered change waits in `in-validation`.
|
|
23
|
+
|
|
24
|
+
Commit completed units with their tasks and Log when later work could obscure
|
|
25
|
+
attribution. Do not create a dedicated commit for a lifecycle-only transition.
|
|
26
|
+
Coalesce it with the nearest meaningful commit; for example, include
|
|
27
|
+
`in-progress → in-review` with the final implementation unit. Do not wait until
|
|
28
|
+
the end to reconstruct mixed diffs. If a handoff precedes the next
|
|
29
|
+
meaningful commit, one consolidated checkpoint persists pending state; record
|
|
30
|
+
why and never create one per transition.
|
|
24
31
|
|
|
25
32
|
Commit messages use the canonical shape:
|
|
26
33
|
|
|
@@ -44,25 +51,32 @@ Useful mutation commands:
|
|
|
44
51
|
- `changeledger task <id> done|block <n> [reason]`
|
|
45
52
|
- `changeledger log <id> "<message>"`
|
|
46
53
|
- `changeledger owner <id> <name|->`
|
|
54
|
+
- `changeledger review <id> pass|fail`
|
|
47
55
|
- `changeledger check [id]`
|
|
48
56
|
|
|
49
57
|
When implementation and every task are complete, move to `in-review` if the
|
|
50
|
-
type requires independent review
|
|
58
|
+
type requires independent review, loading `changeledger context review`
|
|
59
|
+
once first — it stays valid for the rest of the cycle, do not reload it just
|
|
60
|
+
to record the verdict unless context was lost (compaction, a new session) —
|
|
61
|
+
and recording the delegate's verdict yourself with `review <id> pass|fail`
|
|
62
|
+
(never `log`+`status`). Otherwise move to `in-validation` and stop — its
|
|
63
|
+
closing has no CLI, only the human does it.
|
|
51
64
|
|
|
52
65
|
## Correction isolation
|
|
53
66
|
|
|
54
67
|
After review `fail --retry`, keep the candidate correction uncommitted while a
|
|
55
68
|
fresh clean-context reviewer checks it. If it fails again, iterate on that same
|
|
56
69
|
diff. Do not start another task or change while a correction waits: the
|
|
57
|
-
worktree is its isolation boundary. After `pass`, commit the confirmed correction
|
|
58
|
-
|
|
70
|
+
worktree is its isolation boundary. After `pass`, commit the confirmed correction,
|
|
71
|
+
tests and ledger before human validation; this is meaningful correction evidence,
|
|
72
|
+
not a status-only commit.
|
|
59
73
|
|
|
60
74
|
After human rejection (`in-validation → in-progress`), run
|
|
61
75
|
`changeledger context <id>` before modifying implementation; keep the correction
|
|
62
76
|
uncommitted until the human confirms it fixes the reported failure. Do not start
|
|
63
77
|
another task or change while a correction waits; iterate on
|
|
64
|
-
the same diff if it does not. After human acceptance, graduate or record a skip
|
|
65
|
-
|
|
78
|
+
the same diff if it does not. After human acceptance, graduate or record a skip
|
|
79
|
+
and include correction plus ledger in the final closure commit.
|
|
66
80
|
|
|
67
81
|
These exceptions prevent false fix attempts from becoming permanent history;
|
|
68
82
|
they do not relax intermediate commits for already verified units.
|
|
@@ -37,6 +37,9 @@ evidence in the task instead of listing every possible manual phrase in config.
|
|
|
37
37
|
|
|
38
38
|
`changeledger check` reports missing Given/When/Then, uncovered or unknown CRs,
|
|
39
39
|
tasks without traceability and CR-bearing tasks without configured target and
|
|
40
|
-
verification.
|
|
41
|
-
`in-progress
|
|
40
|
+
verification. Every diagnostic is a warning in `draft`. In `approved` or
|
|
41
|
+
`in-progress`, readiness defects (missing Given/When/Then, unknown criterion
|
|
42
|
+
references, CR-bearing tasks without target and verification) are errors, while
|
|
43
|
+
coverage gaps (uncovered criteria, non-support tasks without a CR) stay
|
|
44
|
+
warnings. Truly operational `(support)` tasks are exempt; observable
|
|
42
45
|
implementation is not.
|
|
@@ -21,6 +21,11 @@ Record exactly one verdict:
|
|
|
21
21
|
- `changeledger review <id> fail --block "<reason>"` — correction requires scope
|
|
22
22
|
or product judgment; move to `blocked` for the human.
|
|
23
23
|
|
|
24
|
+
A review verdict alone needs no commit. A pass leaves `in-validation` for
|
|
25
|
+
closure unless it confirms uncommitted correction; then correction, tests and
|
|
26
|
+
ledger form a commit. Retry keeps the diff isolated. Handoff may use the
|
|
27
|
+
implementation contract's checkpoint.
|
|
28
|
+
|
|
24
29
|
After `fail --retry`, the correction remains uncommitted until another fresh
|
|
25
30
|
reviewer passes it. After the transition, run `changeledger context <id>` before
|
|
26
31
|
modifying implementation. After pass, commit correction + ledger before asking
|
|
@@ -3,8 +3,22 @@
|
|
|
3
3
|
Implementation and required review are complete. Do not modify the result or
|
|
4
4
|
mark it done. Ask the human to test the whole change in the viewer.
|
|
5
5
|
|
|
6
|
+
This stop is scoped to this change: the agent may start the next approved
|
|
7
|
+
change unless its `depends_on` chain, direct or transitive, reaches this or
|
|
8
|
+
another `in-validation` change. If every remaining approved change is
|
|
9
|
+
blocked, it stops entirely and does not invent work or touch delivered
|
|
10
|
+
results.
|
|
11
|
+
|
|
6
12
|
Acceptance reaches `done`. Rejection requires a reason and returns the same
|
|
7
13
|
change to `in-progress`; run `changeledger context <id>` before modifying
|
|
8
14
|
implementation, update Specification/Plan as needed and repeat review when
|
|
9
|
-
configured. The agent never accepts on the human's behalf.
|
|
10
|
-
|
|
15
|
+
configured. The agent never accepts on the human's behalf. Before graduation,
|
|
16
|
+
skip, archive or release, the human may reopen `done` with a reason only to
|
|
17
|
+
complete the original authorized scope; broader behavior needs a new change.
|
|
18
|
+
`discarded` never reopens.
|
|
19
|
+
|
|
20
|
+
The validation transition alone does not require a dedicated commit. After
|
|
21
|
+
acceptance, resolve graduation or skip first; the close overlay then requires one
|
|
22
|
+
final closure commit containing the pending lifecycle Log and graduation truth.
|
|
23
|
+
After rejection, follow correction isolation instead of committing an
|
|
24
|
+
unconfirmed attempt.
|