You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
chore(ai): replace learned numbering pipeline with counter file
The old method scanned 719+ files via glob+grep+sort+head every time a
learned summary was created. Replace with plan/learned/.counter holding
the next available number. Commit scripts read it, use it, bump it.
Added make ze-learned-counter for recovery, collision guard in commit
scripts, and updated all skill/rule references.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: .claude/rules/planning.md
+9Lines changed: 9 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -38,10 +38,19 @@ The lifecycle is: `in-progress` -> Review Gate clean -> write learned summary ->
38
38
All three happen in `/ze-implement` step 15, in one commit script the user runs once.
39
39
Leaving a completed spec in `plan/` causes every future session to count it as open work.
40
40
41
+
**The commit script IS the final deliverable.** The user runs it and considers the work
42
+
finished. They will not come back to ask for a "close the spec" step. Therefore:
43
+
- Learned summary, LEARNED-INDEX update, and `git rm plan/<spec>` MUST be in the same
44
+
script that commits the implementation code.
45
+
- Never present the implementation commit first and closure "as a next step."
46
+
- Never split into two scripts or two commits.
47
+
- If the script is missing any of these, the step is incomplete. Go back and include them.
48
+
41
49
| Banned | Why |
42
50
|--------|-----|
43
51
| "I'll close it later" | Later never comes. Other sessions see it as in-progress. |
44
52
| "The user will handle it" | The user asked us to implement. Closure is part of implementation. |
45
53
| "It's just a status change" | A spec in `plan/` with status `done` is worse than `in-progress` -- it is invisible to `/ze-status` staleness checks but still occupies the spec list. |
54
+
| "Run the commit, then I'll prepare closure" | The user will not ask. One script, one run, done. |
46
55
47
56
`/ze-status` flags in-progress specs with clean Review Gates as "completed but not closed."
Copy file name to clipboardExpand all lines: ai/rules/git-safety.md
+4-1Lines changed: 4 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,6 +16,7 @@ cross-commit. Package add + commit into a single user-triggered script.
16
16
4.`chmod +x` every script you hand the user (commit, delete, helper) at creation. User runs it directly (`./tmp/...`), not via `bash`.
17
17
5. Never end an output line with `.`, `,`, `:`, or `)` directly after a path/URL/command -- users copy-paste; trailing punctuation breaks it. Put path on its own line or follow with a space.
18
18
6. Report what was done and what is left. User decides when to commit.
19
+
7. Before writing a commit script, read `.gitignore` and never `git add` ignored paths. Key ignored paths: `CLAUDE.md`, `AGENTS.md`, `.claude/skills/`, `.codex/skills/`, `.agents/skills/`, `tmp/`, `/bin/`. Only add canonical sources (e.g., `ai/skills/`, `ai/INSTRUCTIONS.md`).
19
20
20
21
`git commit`/`git add` inside the script is fine -- the ban is on
21
22
direct AI tool invocations, not on what the script does when the user
Copy file name to clipboardExpand all lines: ai/skills/ze-implement.md
+14-9Lines changed: 14 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -79,25 +79,30 @@ See also: `/ze-audit` (check what exists first), `/ze-review-spec` (post-impl ve
79
79
- If the spec has no Documentation Update Checklist, use `ai/rules/planning.md` "Documentation Update Checklist" as the reference and fill it for the spec.
80
80
- Write the doc updates. Include them in the commit.
81
81
15.**Close spec and present commit (BLOCKING -- do ALL of this BEFORE presenting the commit script):**
82
-
The user expects that running the commit script completes ALL work. Nothing may be left
83
-
over, deferred, or require a second script. Do everything below before showing the script.
82
+
The user runs the commit script and considers the work FINISHED. They will not come back
83
+
to ask "what's next" or "close the spec now." There is no step 16. The script is the
84
+
final deliverable. Everything below MUST be in that single script.
85
+
84
86
a. Write the learned summary to `plan/learned/NNN-<spec-stem>.md` following `plan/learned/METHODOLOGY.md`.
85
-
Number NNN = next unused number. To find it: `for f in plan/learned/[0-9]*.md; do basename "$f"; done | grep -oE '^[0-9]+' | sort -rn | head -1`
86
-
then add 1. Use the extraction recipe: Context from Task + Current Behavior, Decisions from Key Design Decisions + annotations, Consequences from Design Insights + Limitations, Gotchas from Deviations + Mistake Log.
87
+
Number NNN: read `plan/learned/.counter` (contains the next available number).
88
+
Use the extraction recipe: Context from Task + Current Behavior, Decisions from Key Design Decisions + annotations, Consequences from Design Insights + Limitations, Gotchas from Deviations + Mistake Log.
87
89
b. Update `ai/LEARNED-INDEX.md` if the summary contains a structural decision (not just task completion).
88
90
c. Remove your line from `tmp/session/selected-spec`.
89
91
d. List all changes made (files modified/created, tests added, docs updated, issues found and fixed).
90
92
e. Prepare ONE commit script (`tmp/commit-SESSION.sh`) that does EVERYTHING in a single commit:
93
+
- Guard: `if ls plan/learned/NNN-*.md 1>/dev/null 2>&1; then echo "ERROR: NNN already taken, re-read .counter"; exit 1; fi`
91
94
-`git add` all implementation files (code, tests, docs, schema)
92
95
-`git add plan/learned/NNN-<spec-stem>.md`
93
96
-`git add ai/LEARNED-INDEX.md` (if updated)
94
97
-`git rm plan/<spec-name>`
95
-
- Commit message file with both the feature description and the spec closure
96
-
f. Present the commit script to the user.
98
+
- Bump `plan/learned/.counter` to NNN+1 and `git add plan/learned/.counter`
99
+
- Commit message file with both the feature description AND the spec closure
100
+
f. Present the commit script to the user. This is the end.
97
101
98
-
**Why one script, one commit:** the user runs the script and the work is done. No second
99
-
script, no "now run this other thing", no leftover steps. If there are ANY remaining
100
-
actions after the user runs the script, the step is not complete. Go back and include them.
102
+
**Why one script, one commit, no follow-up:** the user will not ask for a second step.
103
+
They will not remember that the spec needs closing. They will not prompt you for the
104
+
learned summary. If closure is not in the script, it will never happen and the spec
105
+
rots in `plan/` forever. Include everything. There is nothing after this step.
Copy file name to clipboardExpand all lines: plan/learned/METHODOLOGY.md
+6Lines changed: 6 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -102,4 +102,10 @@ At spec completion, the Executive Summary (already BLOCKING before commit) maps
102
102
103
103
One additional step: scan Design Insights + Known Limitations for **Consequences** bullets not already covered by the Executive Summary mapping. This takes 30 seconds when context is fresh.
104
104
105
+
## Numbering
106
+
107
+
`plan/learned/.counter` contains the next available number. Read it, use it as NNN, then bump it (write NNN+1) and `git add plan/learned/.counter` in the commit script.
108
+
109
+
If `.counter` is missing or wrong, run `make ze-learned-counter` to rebuild it from the directory.
110
+
105
111
Write the summary to `plan/learned/NNN-<name>.md` instead of moving the full spec to `done/`.
0 commit comments