@erclx/aitk 3.4.0 → 3.6.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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "aitk",
3
3
  "description": "Automated governance, versioning, and discovery tools for Claude Code.",
4
- "version": "3.4.0",
4
+ "version": "3.6.0",
5
5
  "author": {
6
6
  "name": "Eric Le",
7
7
  "url": "https://github.com/erclx"
@@ -40,7 +40,7 @@ No surface carries cross-version sequencing, so report none. A row's `Waiting on
40
40
 
41
41
  A compaction is a moment this skill cannot detect, so the human asks for each side of it and this skill reads the matching runbook when they do.
42
42
 
43
- On a request to write the handoff or save the session, read `${CLAUDE_SKILL_DIR}/references/orchestrator-handoff.md` and follow it. It captures what the session learned, then writes a session map per `${CLAUDE_SKILL_DIR}/../../standards/session.md`, carrying the state of play, the mistakes worth not repeating, and the standing cautions, with the decisions taken under delegated authority added as this role's extension. That capture is the only one this session runs, since the refill sweep reports it as owed rather than paying it. Write nothing to the handoff that the board, a task file, or a groundwork folder already carries.
43
+ On a request to write the handoff or save the session, read `${CLAUDE_SKILL_DIR}/references/orchestrator-handoff.md` and follow it. It sends the generic half to `aitk:session-map`, which captures what the session learned and writes a session map per `${CLAUDE_SKILL_DIR}/../../standards/session.md`, then adds the decisions taken under delegated authority as this role's extension. That capture is the only one this session runs, since the refill sweep reports it as owed rather than paying it. Write nothing to the handoff that the board, a task file, or a groundwork folder already carries.
44
44
 
45
45
  On a request to resume after a compaction, read `${CLAUDE_SKILL_DIR}/references/orchestrator-resume.md`, which reads that file back with the board and the groundwork behind the live work.
46
46
 
@@ -3,9 +3,11 @@ title: Orchestrator handoff runbook
3
3
  description: The two sections an orchestrating session adds over the shared session map, how capture runs from a session that never commits, and the resume invocation the file carries out
4
4
  ---
5
5
 
6
- Write the pre-compaction handoff as orchestrator. Follow `${CLAUDE_SKILL_DIR}/../../standards/session.md` for the filename, the three core sections, the write procedure, and the citation rule. Everything below is the extension this role adds over that core, and none of it belongs to a session holding no delegated authority.
6
+ Write the pre-compaction handoff as orchestrator. Invoke `aitk:session-map` for the generic half, which is the filename, the three core sections, the write procedure, the drift step and the ref it reads, and the citation rule. Everything below is the extension this role adds over that core, and none of it belongs to a session holding no delegated authority.
7
7
 
8
- 1. Run the capture step the core opens with, and tell `aitk:claude-memory-capture` that this session does not commit.
8
+ Settle all three steps below before the door writes, so one write carries the core and the extension together. The door reports the map as written and knows nothing of this role, so its success line ends the generic half rather than this runbook, and a session that stops there ships a map missing both of the things this file exists to add.
9
+
10
+ 1. Tell the door this session does not commit, which is the caveat its capture step takes and passes to `aitk:claude-memory-capture`.
9
11
  2. Add `## Decisions taken under delegated authority` directly after `## State`, holding each decision and why it went that way, so nobody re-proposes it. It sits there rather than after the core because a decision is read against the state it was taken in.
10
12
  3. Close the file with the block below, resolving `${CLAUDE_SKILL_DIR}/references/orchestrator-resume.md` and `${CLAUDE_SKILL_DIR}/references/orchestrator-poll.md` to absolute paths as you write it and pasting each in place of `<RESUME_RUNBOOK>` and `<POLL_RUNBOOK>`:
11
13
 
@@ -25,6 +27,6 @@ The requirement is a resume request to the orchestrator skill with that skill lo
25
27
 
26
28
  Step 1 exists because both other callers of capture are ship-chain skills and this session never ships. Without a call here, the session that receives every operator correction is the one session that records none. A compaction arriving with no warning takes the capture with it, and firing it once per batch of merges leaves the same window open across a long planning stretch, since a sweep runs only on a merge. The refill sweep reports the debt between handoffs so the operator knows one is owed.
27
29
 
28
- Capture is told this session does not commit, so it skips routing and writes memory files alone. A routed fact lands in a context entry, which is a tracked file, and the orchestrator's boundaries forbid writing one from this session. That split is correct rather than a limitation, since a domain fact belongs to the task that owns the surface and goes in that task's Findings, while what this session produces is feedback about how to work.
30
+ Step 1 varies the door rather than replacing it, which is why the door is invoked first and this runbook states only what differs. The generic half moved out whole, the drift step and its ref recovery with it, so nothing here restates a step the door already carries and the two cannot disagree.
29
31
 
30
- The core's drift step answers where the working directory carries `claude/skills/` with history behind it, which is the toolkit repository itself, and refuses by naming the absent tree anywhere else. A project consuming the plugin from a marketplace cache is that second case, so read the refusal as the boundary rather than as a fault.
32
+ Capture is told this session does not commit, so it skips routing and writes memory files alone. A routed fact lands in a context entry, which is a tracked file, and the orchestrator's boundaries forbid writing one from this session. That split is correct rather than a limitation, since a domain fact belongs to the task that owns the surface and goes in that task's Findings, while what this session produces is feedback about how to work.
@@ -15,14 +15,14 @@ A body written around a named tool fails a third way. A session on a surface car
15
15
 
16
16
  The opposite failure is the one that ships silently. A session that takes a preference decision itself produces work the operator did not ask for and never learns a choice was made, because nothing in the output says a fork was passed.
17
17
 
18
- `CLAUDE.md` states both branches of the rule, sending an ordinary judgment call to a pick with the tradeoff in one sentence and a preference-deciding call to the operator. The first branch has the toolkit's `snippets/decision-help.md` behind it, which installs into a project as `.claude/snippets/decision-help.md`, and the second had no surface at all.
18
+ `CLAUDE.md` states both branches of the rule, sending an ordinary judgment call to a pick with the tradeoff in one sentence and a preference-deciding call to the operator. The first branch has the toolkit's `snippets/decision-help.md` behind it, which installs into a project as `.claude/snippets/decision-help.md`. The second branch now states how a question is shaped and where it is put, so this skill inherits both and adds only what a batch needs on top of one question.
19
19
 
20
20
  ## Must
21
21
 
22
22
  - Collect every open decision before asking any of them, so the operator sees the set rather than the first one
23
23
  - Put the whole batch in one turn, since a batch split across turns is the per-decision ask this skill exists to replace
24
- - Give each question two to four options, each carrying what it means and what it costs, with the recommendation ranked first and named as such
25
- - State the behavior first and the tool second, so the body runs on a chat surface carrying no structured question tool
24
+ - Give each question a short axis header and two to four options, taking the shape of an option from `CLAUDE.md` rather than restating it
25
+ - Test the surface rather than the project's instruction file when choosing where the batch goes, so a target whose `CLAUDE.md` predates the rule still reaches the tool and loses only the shape
26
26
  - Cap a batch at four questions and say how many are held, since a structured question tool takes four and an uncapped batch hides the overflow
27
27
  - Hold every escalated decision until it is answered, and continue only the work depending on none of them
28
28
  - Route a pick that changes a written artifact into that artifact under the standard owning it, rather than leaving it in the session
@@ -31,9 +31,7 @@ Drop anything the session can settle. What survives is the batch.
31
31
 
32
32
  ## Step 2: shape each question
33
33
 
34
- Each entry carries a short header naming the axis, the question itself, and two to four options. Give every option what it means and what it costs. Rank the recommendation first and say it is the recommendation.
35
-
36
- An option with no stated cost is not an option, since the operator picks it without knowing what the other one buys.
34
+ Each entry carries a short header naming the axis, the question itself, and two to four options. `CLAUDE.md` states what an option carries and how the set is ranked, so follow it rather than a second copy here. The header is what a batch adds. An operator scanning four questions needs an axis on each to tell one from the next.
37
35
 
38
36
  Cap the batch at four. A structured question tool takes four, and a batch past that is a session asking to be redesigned rather than answered. When more than four are open, send the four blocking the most work and say in one line how many are held.
39
37
 
@@ -41,11 +39,11 @@ Cap the batch at four. A structured question tool takes four, and a batch past t
41
39
 
42
40
  Put every question in one turn. Never split the batch across turns and never ask the first while the rest stay unstated.
43
41
 
44
- When the session runs on a surface carrying a structured question tool, such as `AskUserQuestion` in Claude Code, send the whole batch through one call with one entry per decision. The tool renders the options and collects the picks together.
42
+ Send the batch through a structured question tool wherever the session runs on one, and write the shape below where it does not. What a batch adds is that one call carries the whole set, with one entry per decision, so the operator answers them together instead of one per turn.
45
43
 
46
- Otherwise write the batch as a numbered list in one message, each question followed by its lettered options with the recommendation marked. The behavior is the same on either surface, and only the rendering changes.
44
+ The test is the surface rather than the project's instruction file. A target scaffolded before the rule shipped still reaches the tool, and what it loses is the option shape `CLAUDE.md` states, which the example below carries instead.
47
45
 
48
- Batch shape:
46
+ Batch shape on the fallback surface:
49
47
 
50
48
  ```plaintext
51
49
  <N> open decisions. <M> held.
@@ -0,0 +1,57 @@
1
+ ---
2
+ name: session-map
3
+ description: Why the write procedure needs a route any session can take, why the door carries the drift step and its ref recovery, and why it states none of the shape the standard already fixes
4
+ ---
5
+
6
+ # Session map requirement
7
+
8
+ ## Gap
9
+
10
+ Without this skill, the standard governing the pre-compaction handoff carries a complete numbered write procedure and nothing routes a session to it. The reading half already works, since the resume path opens the newest map and leads its report with it, so a file nobody is routed to write is read by a surface built to find it.
11
+
12
+ The only routed writer belongs to the orchestrator role. It disables model invocation, asserts that role on invocation, and adds a section for decisions taken under delegated authority, so a plain feature session that reaches it receives a section it cannot fill and a review poll it does not run.
13
+
14
+ The nearest description by wording writes a different artifact. Capture routes facts to a context entry and writes memory files, and a request naming the session and the moment matches it, so the map goes unwritten while a session believes it has handed off.
15
+
16
+ The drift step is the one most specific to session length and the easiest to skip. It reads the commit the session started from, nothing on the machine records that commit, and a route that names the step without naming how to recover the ref ships an instruction nobody can follow.
17
+
18
+ A step that reads a surface a project may not carry gets skipped on the reasoning that it has nothing to act on. A cold session run against a project with no `.claude/` tree skipped both the capture and the drift step and wrote its own rationale into the map, so the step the route exists to carry did not run on the first test from outside. The skip is worst where it looks most defensible, and a session that takes it quietly leaves a map indistinguishable from a conforming one.
19
+
20
+ A capture fired the same way for every caller breaks the one caller the split leaves. An orchestrating session may write no tracked file, so its capture has to skip routing, and a route offering no way to say so leaves that reader running capture twice or routing facts the role forbids it to fold.
21
+
22
+ A body that restates the sections, the frontmatter, or the numbered steps becomes a second source that drifts from the standard, which is the failure the split between the role writer and the core was made to remove rather than move.
23
+
24
+ ## Must
25
+
26
+ - Write from any session whatever role it holds, without asserting one
27
+ - Cite the standard for the filename, the frontmatter, the sections, the numbered procedure, and the citation rule rather than restating any of them
28
+ - Run the drift step and state how to recover the ref it reads from how long the session has run
29
+ - Record what the drift verb names, and read a refusal as the boundary of what the verb can read
30
+ - Resolve the folder at the main worktree root, and write the file whole from the shell where the editing tools refuse that root
31
+ - Fall back to the branchless filename on an empty slug rather than stopping
32
+ - Leave model invocation enabled, so a session that has dropped its routing still reaches this by description
33
+ - Take a caller's statement that the session does not commit and pass it to capture, so no fact this route fires is routed into a tracked file
34
+ - Report the map alone, plus the line capture returns when a fact routed, since a fold left unreported is a fold nobody runs
35
+
36
+ ## Must not
37
+
38
+ - Restate the standard's sections, frontmatter, or numbered steps
39
+ - Skip a step by predicting what its skill or verb would have answered, rather than running it and recording what came back
40
+ - Assert a role, or add a role's section to a map written by a session holding no such role
41
+ - Fold the capture step's output into this skill's report
42
+ - Take the worktree-local copy the editing tools offer in place of the main-root path
43
+ - Summarize the board, the task files, or the work that shipped, each of which is carried by an artifact a compaction leaves standing
44
+
45
+ ## Guards
46
+
47
+ - Not a git repository: stop, since the filename comes from the branch
48
+ - Empty slug: fall back rather than stop, since the reasoning is worth more than the name
49
+ - The drift verb refusing: record the boundary under standing cautions and keep writing
50
+
51
+ ## Out of scope
52
+
53
+ - Reading a handoff back at the start of the next session: `session-resume`
54
+ - Routing a session fact to the context entry that owns it, and writing what no entry owns to the memory folder: `claude-memory-capture`
55
+ - The sections a role adds over the core three, which belong to that role's own surface. `claude-orchestrate` owns the orchestrator's and cites this route for the generic half.
56
+ - Validating a written map against the standard, which no record kind covers, so a conforming shape rests on the standard being followed
57
+ - Firing the write without being asked, which is a question about what the harness supports and is measured on its own track
@@ -0,0 +1,57 @@
1
+ ---
2
+ name: session-map
3
+ description: Writes the session map, the pre-compaction handoff at `.claude/tasks/session-<slug>.md`, from any session whatever role it holds, running the skill-drift step the write procedure opens with. Use when asked to "write the handoff", "write the session map", "save the session before it compacts", "we are about to compact", "hand off to the next session", or "leave a note for whoever picks this up". Do NOT use to route session facts to a context entry or the memory folder, which is `claude-memory-capture` and writes a different artifact, and do NOT use to read a handoff back, which is `session-resume`.
4
+ ---
5
+
6
+ # Session map
7
+
8
+ Write the pre-compaction handoff for the current session. `${CLAUDE_SKILL_DIR}/../../standards/session.md` fixes the filename, the frontmatter, the three core sections, the numbered write procedure, and the citation rule. Follow that document rather than this body, which states when the procedure runs and what it runs against and leaves the shape where it already lives.
9
+
10
+ Any session writes one. Do not assert a role on invocation, and do not add a role's sections to a map written by a session holding no such role.
11
+
12
+ Run every step rather than judging in advance that one has nothing to act on. The capture skill and the drift verb each answer for themselves, refusal included, and a refusal recorded is a result where a prediction of one is not. A project carrying none of the scaffolding either step reads is the case this fires on, and it is the case where skipping looks most defensible.
13
+
14
+ ## Guards
15
+
16
+ - If `git rev-parse --git-dir` does not resolve, stop: `❌ Not a git repository. A session map takes its filename from the branch.`
17
+ - Derive `<slug>` per `${CLAUDE_SKILL_DIR}/../../standards/slug.md`. An empty result falls back to `latest` rather than stopping, since a handoff is scratch and a stop loses the reasoning the file exists to save.
18
+ - Resolve the containing folder at the main worktree root with `git worktree list --porcelain | grep -m 1 '^worktree ' | cut -d' ' -f2-`. The guard above already stopped where that read has no repository to answer from, so it takes no fallback.
19
+
20
+ ## Step 1: run the capture the procedure opens with
21
+
22
+ Item 1 of `## Writing one` is a capture. Invoke `aitk:claude-memory-capture` and let it return before writing, so the map cites what was written instead of restating the same lesson in prose.
23
+
24
+ Pass on the caveat a caller states about committing. A caller that does not commit says so, and capture then skips routing and writes memory files alone, since a routed fact lands in a context entry and that is a tracked file. A caller stating nothing leaves capture to decide for itself, which is the ordinary run.
25
+
26
+ Carry through the line capture returns when a fact routed, so the session knows a fold is still owed. Report nothing else about what it wrote. The map is this skill's output.
27
+
28
+ ## Step 2: recover the commit the drift step reads
29
+
30
+ Item 2 runs `aitk claude skills drift <ref>` against the commit this session started from, and nothing on the machine records that commit. Estimate how long the session has run, round the duration up, and read the ref item 3 recovers:
31
+
32
+ ```bash
33
+ git log -1 --format=%H --before='<duration> ago'
34
+ ```
35
+
36
+ Round up rather than down. A ref older than the oldest load over-reports, and confirming a name it raises costs one read of that body, so the generous end is the safe one.
37
+
38
+ Record what the verb names under `## Standing cautions`. A refusal is the boundary of what the verb can read rather than a fault, since it answers where the working directory carries `claude/skills/` with history behind it and refuses in a project consuming the plugin from a cache. Record the boundary the verb reported and keep writing, rather than the one it looked likely to report.
39
+
40
+ ## Step 3: write the map
41
+
42
+ Follow items 4 through 6. Write only what a compaction destroys and no other artifact already carries, and cite a commit, a task, or a file and line for every claim.
43
+
44
+ The file sits at the main worktree root, which the file-editing tools refuse from inside a linked worktree while offering a copy under that worktree instead. Take neither the refusal nor the copy. The map is written whole every time, so send it out as one plain shell command carrying a heredoc.
45
+
46
+ ## Step 4: extend it only where a role is held
47
+
48
+ `## Extending it` governs a section added over the core three. Add one only when this session holds the role and the surface owning that role states the section, since a section the writer cannot fill teaches its reader to skip the file. A session holding no role writes the core three and stops.
49
+
50
+ ## Output
51
+
52
+ ```plaintext
53
+ ✅ Session map written: .claude/tasks/session-<slug>.md
54
+ <what the drift verb named, or the boundary it refused at>
55
+ ```
56
+
57
+ Emit the path from the project root. The `## Output` section of the project's instruction file sets the form it takes.
@@ -250,6 +250,7 @@ This section is the corpus the coverage claim is measured against: every name `a
250
250
  | ------------------------- | ------------------------------------------------------------------------------ |
251
251
  | `aitk:claude-orchestrate` | To assert the control session that owns the queue and reviews each worker's PR |
252
252
  | `aitk:session-resume` | At the start of a session, to pick up what a previous one left |
253
+ | `aitk:session-map` | At the close of a session, to write the handoff a compaction would destroy |
253
254
 
254
255
  ### Keep the project current with the toolkit
255
256
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@erclx/aitk",
3
3
  "type": "module",
4
- "version": "3.4.0",
4
+ "version": "3.6.0",
5
5
  "description": "Infrastructure and quality tooling for developer workflows",
6
6
  "license": "MIT",
7
7
  "bin": {
@@ -56,9 +56,11 @@ Add a section only for content that fits none of the three and would otherwise b
56
56
 
57
57
  ## Writing one
58
58
 
59
+ The `session-map` skill is the invocable route onto this procedure and holds no role, so a session reaching for a handoff without knowing this document exists still lands here. A session that arrives at this document directly follows the steps below unchanged.
60
+
59
61
  1. Capture what the session learned first, so the map cites what was written instead of restating the same lesson in prose.
60
62
  2. Run `aitk claude skills drift <the commit this session started from>` and record what it names under `## Standing cautions`. A skill body enters a session once and re-invoking the skill does not re-read the file, so the drift is worst at exactly this moment and a name here is a body the session has been following out of date. Recording a name is not acting on it, and the verb misses a body this session edited and has not committed. This step belongs to session length rather than to any role, so every writer runs it, and a refusal names the boundary of what the verb can read rather than a fault.
61
- 3. Recover that commit from how long the session has been running with `git log -1 --format=%H --before='<duration> ago'`, rounding the duration up rather than down. Nothing on the machine records it. A ref older than the oldest load over-reports, and confirming a name costs one read of the body, so the generous end is the safe one and a guess at the exact commit is not worth making.
63
+ 3. Recover that commit from how long the session has been running with `git log -1 --format=%H --before='<duration> ago'`, rounding the duration up rather than down. Nothing on the machine records it. A ref older than the oldest load over-reports, and confirming a name costs one read of the body, so the generous end is the safe one and a guess at the exact commit is not worth making. An empty result means no commit predates the window, so take the oldest commit the history holds and say which of the two the ref came from.
62
64
  4. Write only what a compaction destroys and no other artifact already carries. The board holds the ordering and what each task waits on, a task file holds its own findings, and a measurement folder holds its track.
63
65
  5. Cite a commit, a task, or a file and line for every claim, so the next session can tell a read from a recall.
64
66
  6. Fill a section from reasoning the session actually holds. A session with no cross-feature picture that fills `## State` from what is already in git has written a summary of the tree, which the reader can produce faster than they can read it.
@@ -76,6 +78,7 @@ Do not restate the board, and do not summarize the work that shipped, since vers
76
78
  - Carry every core section whatever else a role adds, and state in the surface that adds a section why the core cannot carry it
77
79
  - Let the adding surface fix where its own section sits, so a role can place one between core sections where that reads better. The core order holds among the core sections alone.
78
80
  - Keep a section out of the core when a session holding no such role would leave it unfilled. An unfilled section teaches a reader to skip the file.
81
+ - Cite the route onto `## Writing one` rather than restating the procedure, so the extension is the only thing the adding surface carries and the two cannot fall out of step
79
82
  - Carry a resume instruction inside the map itself when the routing to that instruction is what a compaction takes. The map survives what the instruction was loaded from, so each reaches a reader the other cannot.
80
83
 
81
84
  ## Template
@@ -17,6 +17,9 @@
17
17
 
18
18
  - Flag concerns or alternatives when a proposed change has tradeoffs worth discussing
19
19
  - When facing a judgment call with 2-3 reasonable options mid-flow, pick one and state the tradeoff in one sentence. Enumerate options only when the user's preference is the deciding factor.
20
+ - Put a call the user's preference decides through the structured question surface, such as `AskUserQuestion` in Claude Code, and fall back to a numbered list in one message where none exists. Rank the recommendation first and mark it, order the rest behind it, and give each option its cost, since an option with no stated cost is picked blind.
21
+ - Author the real choices only. A structured surface appends its own trailing escapes for a free-text answer and for reopening the question as conversation, so never write either as an option. On the numbered-list fallback, say that answering outside the list is fine.
22
+ - Answer from the artifact when one already put the question in writing with a suggestion, rather than re-asking it. A blank `- Answer:` slot in a plan accepts the `- Suggested:` line above it, per the plan standard, which your toolkit resolves by name.
20
23
  - Match edit scope to the request. Ship minimal v1 and queue extensions as follow-ups.
21
24
  - On simplification requests, edit only what the user named
22
25
  - Do not add features the user did not ask for