jenga-npm
CLAUDE.md0 starsChanged 20 days agoApache-2.0View on GitHub
⚠️ CRITICAL — Source of Truth for All Features All features — skills, agents, hooks, scripts, and any other implementation — MUST be created and edited in the root directories (skills/, agents/, hooks/, scripts/, etc.). The .agents/ and .claude/ directories are generated build outputs. They are populated automatically by the j.distribute skill and must never be used as the primary location for new or updated features. Any change made only inside .agents/ or .claude/ will be overwritten on the next…
- Reads credentials
- Installs packages
- Commits and pushes
In this repository151 other files it gives its agents.
- AGENTS.mdAGENTS.md
- j.brainstormSkill
- j.breakSkill
- j.btwSkill
- j.check-inSkill
- j.clearifySkill
- j.close-storySkill
- j.cloud-connectSkill
- j.commitSkill
- j.connectSkill
- j.continueSkill
- j.conventionsSkill
- j.dashboard-shareSkill
- j.dashboardSkill
- j.deep-diveSkill
- j.distributeSkill
- j.docSkill
- j.doc-syncSkill
- j.doooSkill
- j.doSkill
- j.jenga-configSkill
- j.jenga-permission-levelSkill
- j.jengaSkill
- j.errorSkill
- j.evaluateSkill
- j.examplifySkill
- j.gitignoreSkill
- j.helpSkill
- j.ideaSkill
- j.improveSkill
- j.initSkill
- j.jbpSkill
- j.lgtmSkill
- j.pi-planSkill
- j.playbook-newSkill
- j.playbookSkill
- j.proceedSkill
- j.publishSkill
- j.reconcile-originSkill
- j.reconcileSkill
- j.redoSkill
- j.skillifySkill
- j.smoke-testSkill
- j.spinoffSkill
- j.statusSkill
- j.testSkill
- j.todoSkill
- j.toolsSkill
- j.unchartedSkill
- j.wtfSkill
- skill-nameSkill
- j.brainstormSkill
- j.breakSkill
- j.btwSkill
- j.check-inSkill
- j.clearifySkill
- j.close-storySkill
- j.cloud-connectSkill
- j.commitSkill
- j.connectSkill
- The first 60 shown.
The file
Show its rules and text
We split this CLAUDE.md into the rules it gives an agent
14 rules. About 0 are common, 6 are distinctive, and 8 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈6
Distinctive · estimate
This author's own choices. Worth a look.
8
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Distinctive: line 67
Never runs tests — that is the Tester's exclusive responsibility.
- Very specific: line 68
After three failed conflict resolutions, writes a rapport, sets status to Blocked, and halts.
- Very specific: line 69
Never commits .env files or credentials.
- Very specific: line 76
Test tool configuration lives in project/configs/test-config.json (user-approved).
- Very specific: line 77
Before a task, story or epic closes, runs the configured scope test policy (test_run_task / test_run_story / test_run_epic in …
- Distinctive: line 80
After every status update, checks for story/epic rollup and writes a trigger to the queue if warranted.
- Very specific: line 206
When implementing or authoring a skill, offload deterministic, repeatable steps to shell scripts or other static tooling (e.g., bash …
- Distinctive: line 242
When presenting options to the user, ALWAYS use this format instead of open-ended questions if possible:
- Distinctive: line 250
Avoid ask open-ended questions where a list of options would serve better.
- Distinctive: line 311
When divergence is detected, immediately pause the current line of work and present the following structured choice:
- Very specific: line 330
Create a j.todo for the diverging topic (with context summary and a j.brainstorm offer for Prerequisites).
- Very specific: line 331
Create a j.todo for the primary topic (with context summary and a j.brainstorm offer for Prerequisites).
- Distinctive: line 332
Ask the user which topic to continue first.
- Very specific: line 344
User wants to pursue both in parallel: Treat this as Option C — capture both as j.todo items with full context summaries, then ask the user …
≈ “Common” is an estimate: at least 1 in 5 of the 26,980 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Workflow Rules
⚠️ CRITICAL — Source of Truth for All Features
All features — skills, agents, hooks, scripts, and any other implementation — MUST be created and edited in the root directories (
skills/,agents/,hooks/,scripts/, etc.).The
.agents/and.claude/directories are generated build outputs. They are populated automatically by thej.distributeskill and must never be used as the primary location for new or updated features. Any change made only inside.agents/or.claude/will be overwritten on the next distribution run.Rule: If you add or modify a skill, agent, hook, or script, the canonical file lives in the root directory.
.agents/and.claude/are read-only artifacts.
Workflow Lifecycle
Invocation convention (
E50_S01, separator revised byE50_S07, bare-form policy reversed by theE50reopening of 2026-09-09):skills/j-<name>/is the sole canonical form of a skill directory, andname: j.<name>(e.g.j.init,j.commit) is its canonical frontmatter identifier. Those are two separable identifiers, and only the directory changed: a skill is invoked asj.<name>— the form these docs have always taught, which survives untouched — or as the directory-resolved slash form/j-<name>.The old bare
/<name>form is hard-broken: no redirect, no alias, no deprecation shim, no warning. Its directory is deleted, and since Claude Code resolves skills by literal directory name, the command simply stops resolving — no Jenga skill runs and nothing points the user at/j-<name>. The earlier policy, which guaranteed the bare form would keep resolving indefinitely on every routing surface, was reversed on 2026-09-09 and is retained inproject/documentation/skill-authoring.mdonly as superseded history.Four permanent exceptions keep their bare directory names and are never renamed, deleted, or twinned:
skills/jenga/,skills/jenga-permission-level/andskills/jenga-config/(main skills, deliberately excluded from twin generation;E50_S06for the first two,E68_S04for the third) andskills/index/(not a skill — noSKILL.md, not part of routing). Consequently/jenga,/jenga-permission-leveland/jenga-configdo keep working — they are the only surviving bare slash forms, and they survive because those directories were always the canonical ones, not because any alias was kept.Full contract in
project/documentation/skill-authoring.md's "The Canonical Naming Contract" section; the mechanical cutover (directory renames, frontmatter rewrites, reference updates) is owned byE50_S11–E50_S18.
j.init— Scaffold the project: git init, directories,workflow.json,PROJECT_SUMMARY.mdstub.j.jenga— Interactive-by-default board orchestrator: bare shows a picker + confirmation tree,<ids>scopes and confirms,*runs the original fully automated pipeline with no prompts.j.todo(or Scrum Master directly) — Translate requirements into board items (epics → stories → tasks).j.do— Pick a task fromproject/todo.md, invoke the Developer agent with full scrum board context and a sender object.- Developer — Reads task, creates a worktree, implements, commits, and calls the Tester.
- Tester — Validates sender object, runs tests, writes status to the board, triggers rollup if all tasks pass.
SessionEndhook —on_session_end.shdetects new rapports and writes triggers to the queue.- Scrum Master (next session) — Processes the queue: rapport review, status review, story/epic rollup.
Agents
Scrum Master (agents/scrum-master.md)
- Owns
project/PROJECT_SUMMARY.md— sole writer. - Processes
project/queue/scrum_triggers.jsonlat every session start. - Creates and amends epics, stories, and tasks using the scrum board schema.
- Handles story and epic rollup when all child items pass.
- Applies advisory file locks before writing any board file.
Developer (agents/developer.md)
- Creates an isolated git worktree per task (
<E##_S##_T##-slug>). - Logs all incoming sender objects to
project/logs/events.jsonbefore doing any work. - Commits at meaningful milestones (not every line, not only at the end).
- Calls the Tester with a full sender object including commit SHAs.
- Never runs tests — that is the Tester's exclusive responsibility.
- After three failed conflict resolutions, writes a rapport, sets status to
Blocked, and halts. - Never commits
.envfiles or credentials.
Tester (agents/tester.md)
- Sole agent permitted to write the judged task and story statuses on the board. The five lifecycle statuses (
Merged,Publicized,Privatized,Deployed to Stage,Deployed to Prod) are script-set and are the exception; the rule, including what to do about an unexpected script-set write, lives intemplates/SCRUM_BOARD_SCHEMA.md(Status Values, "Status Writers"). - Validates all required sender fields before proceeding (rejects with
"error"if any are missing). - Manages the full testing lifecycle: unit, integration, e2e, SAST, vulnerability, performance, coverage.
- Test tool configuration lives in
project/configs/test-config.json(user-approved). - Before a task, story or epic closes, runs the configured scope test policy (
test_run_task/test_run_story/test_run_epicinproject/configs/test-config.json; defaults none, scoped, full) viaskills/j-test/scripts/scope-test-gate.sh; seeproject/documentation/test-runner.md. - SAST/vulnerability scans are opt-in and require explicit user approval, logged to
events.json. - Writes
Rejectedstatus only after notifying the user and receiving confirmation. - After every status update, checks for story/epic rollup and writes a trigger to the queue if warranted.
- Maintains analytics baselines in
project/data/baselines.jsonacross sessions.
Skills (Slash Commands)
Skills are stored in skills/j-<name>/SKILL.md. Invoke them with j.<name> in a Claude Code session,
or as the directory-resolved slash form /j-<name>. The bare /<name> form does not resolve (see the
Invocation Convention note under Workflow Lifecycle above).
✅ Cutover landed. The bare-name directories have been deleted and the
j.j-<name>→j.<name>frontmatter rewrite has landed, both in the singleE50_S15_T04commit. This block and the Invocation Convention note above now describe the actual current directory listing — onlyskills/j-<name>/directories (plus the four permanent exceptions) remain underskills/. Provenance:E50_S15_T04(deletion + rewrite), verified end-to-end byE50_S15_T05(full test suite, allow-list/mirror resync, doc cleanup).
skills/j-<name>/is the canonical skill directory (E50_S05, promoted from twin to sole canonical form by theE50reopening of 2026-09-09): it is the hand-edited source of truth — the directory you create, edit, and commit — not a generated duplicate of a bare-name directory. Now thatE50_S15has landed, no bare-name directory remains to generate it from or keep it in lockstep with. Itsj-prefix exists for collision safety: a real directory under a distinct name, rather than a routing/frontmatter alias, for cases where a host tool ships its own same-named built-in command (e.g. GitHub Copilot's own/init, which motivatedj-initin the first place) and would otherwise shadow a bare/<name>form. Note the directory name (j-<name>) and the frontmattername:(j.<name>) are deliberately different — see the Skill Frontmatter table below.
skills/jenga/,skills/jenga-permission-level/,skills/jenga-config/, andskills/index/are the four permanent exceptions that keep their bare directory names (see the Invocation Convention note above).skills/init/is not an exception —skills/j-init/is simply already at its canonical name.
scripts/generate-j-alias.sh's bare-name-source →j-<name>-twin generation relationship no longer applied once this contract landed, since both ends of it were invalidated by it —E50_S14retired the script outright (deleted, not hardened) rather than inverting it.scripts/apply-j-prefix.shwas kept, fixed to accept the settledj-<name>directory /j.<name>frontmatter pairing instead of requiring exact string equality. Full contract, including both decisions and their reasoning, inproject/documentation/skill-authoring.md's "The Canonical Naming Contract" section (see its "Generation" subsection).
| Command | Description |
j.init | Scaffold project directories, workflow.json, PROJECT_SUMMARY.md, initial commit. |
j.jenga | Interactive-by-default board orchestrator with a fully automated escape hatch: bare j.jenga renders a picker + confirmation tree, j.jenga <ids> resolves an explicit scope + confirms, j.jenga * reproduces the original zero-prompt, fully automated run. |
j.playbook <id> | Invoke a specific /jenga playbook directly by ID — skips natural-language matching entirely and goes straight to chain confirmation and execution, reusing /jenga's own playbook confirmation/runner scripts. |
j.playbook-new | Guided wizard that walks you through authoring a new project-local playbook (project/.playbooks/<id>.json) — id, name, description, keywords, examples, and an ordered list of skills, each validated against the real playbook and skill catalogs, self-validated via load-playbooks.sh lookup before success is ever reported. |
j.jbp | Scaffold the project using the JengaBasePlate boilerplate. |
j.brainstorm | Focused planning session with the Scrum Master to define and refine features before committing to the board. |
j.btw | Capture a mid-flow mission, classify into epic/story structure, implement now or defer. |
j.todo | Add missions to project/todo.md linked to epics and stories. Loops until done, then optionally runs j.do. |
j.redo | Rework a previous implementation by commit SHA or Epic/Story number. Includes scope assessment, plan, and doc updates. |
j.publish | Configure, validate, and orchestrate scaffolded release workflows (setup, deploy, stage, history, release-notes) across mobile-ios, npm, npm-ci, and droplet targets. stage (npm/npm-ci only) rehearses and smoke-tests a release before it goes live. |
j.uncharted | Entry point for code with no board provenance — four modes: segment (a file or directory), import (an external source), onboard (a whole pre-existing codebase), refresh (incremental re-scan of an already-onboarded codebase since its last baseline, skipping unchanged subsystems). |
j.do | Execute tasks from the scrum board. Resolves each entry to full board context and drives the Developer agent. |
j.test | Discover the project's test suites, list them numbered, run the ones you pick (blank means all) in order, and print a pass/fail summary; exit code 0 when all passed, 1 otherwise. Never writes board status. See project/documentation/test-runner.md. |
j.smoke-test | Structural smoke test of every skill in the catalog: frontmatter parses, name matches the directory, metadata.prefered_agent resolves, referenced scripts and assets exist and scripts pass bash -n. Classifies findings as critical or minor, prints a pass/fail summary, and exits 1 when any critical finding exists. Structural only (it does not replace tests/*.bats) and read-only. |
j.dashboard | Launch the local project dashboard (API + UI) by delegating to project/app's existing dashboard:start/dashboard:open npm scripts — --port <n> is forwarded unchanged. --snapshot [--out <path>] captures a point-in-time data snapshot and bundles the UI into a single self-contained HTML file (e.g. jenga.html), viewable via file:// with no running server. --data-url is an additive delivery mode for --snapshot: it base64-encodes that self-contained file into a data:text/html;base64,... URI the user can open directly, for sessions with no shared filesystem (e.g. a remote/cloud session that cannot hand over a local path). |
j.dashboard-share | Snapshot the project dashboard and upload it to a configured cloud storage remote in one step, by sequencing j.dashboard's snapshot script and a templated-path rclone copyto upload script — upload only, never creates a share link. |
j.cloud-connect | Guided cloud storage setup wizard — installs rclone if missing, presents a backend menu sourced live from rclone's own provider list, runs that backend's own config/auth flow (surfacing any auth URL directly), and independently verifies the resulting remote works. |
j.connect | Guided service setup — lists the service descriptors on disk, detects your platform, then installs the service's CLI (opt-in), authenticates, registers its MCP server where one exists, and independently verifies the result, skipping whatever is already done and never handling a secret value. |
j.tools | Guided wizard for the preferred-tools registry — choose the user or project layer, then add, edit, remove or suppress an entry (name, category, required/recommended, rationale, alternatives, version constraint, install hint linked to a real j-connect descriptor) with every input validated as it is given, or show the effective merged list. Writes go through skills/j-tools/scripts/tools-entry.sh, which validates before an atomic replace, preserves hand-edited entries, and never reports success on a failed validation. |
j.conventions | Guided wizard that records the project's conventions in project/configs/conventions.json (project layer only) across 9 categories: commit format, branching, naming, code comments, formatting and linting, testing, file layout, language and tooling, documentation placement. For each category it shows the standard the project already follows (detected, with evidence and confidence), 2-3 general-standard presets, skip and custom, validates every input as it is given, shows a review summary, then writes atomically and regenerates the managed advisory/confirm (never block) conv- pre-flight checklist items, self-validating both files before reporting success. EST naming stays mandatory for board commits; a recorded commit format applies to non-board commits only. Writes go through skills/j-conventions/scripts/conventions-entry.sh. |
j.check-in | Report whether the agents this session dispatched are actually alive right now — which are running, which have gone silent past the stall threshold, and which finished but left live processes behind — then hand anything actionable to the skill or agent that owns it. Answers the axis j.status (declared board state) and j.reconcile (board-versus-git) do not: is the item the board calls In Progress alive at the OS and harness level? Read-only apart from one appended checkin event and a twice-confirmed TaskStop; collection runs in the host session and is never delegated, because a delegated subagent cannot see its siblings. |
j.status | Overview of epics, stories, and tasks with statuses, open rapports, and queue depth. |
j.jenga-permission-level | Report or switch the current session's 5-tier permission level (Locked/Guarded/Standard/Elevated/Unrestricted) without hand-editing settings.json. |
j.commit | Commit completed work using the EST naming convention (epic(...), story(...)). Has a test gate before the commit: scoped, full or skip, with a remembered default (--tests overrides it) and a documented failure choice (fix first, commit anyway, abort); skipped, never self-certified, for non-interactive callers. See project/documentation/test-runner.md. |
j.lgtm | Approve current work, commit, and continue. Chains j.commit + j.continue; forwards --tests to j.commit's test gate and stops, without continuing, when the gate halts or nothing was committed. |
j.dev-done | Commit current work and sync the .claude//.agents/ mirrors. Chains j.commit + j.self-sync; forwards --tests to j.commit's test gate and skips the sync when the gate halts (the follow-up chore(self-sync) commit is not gated). |
j.continue | Pick up the next incomplete item across PROJECT_SUMMARY.md, epics, and stories. |
j.proceed | Resume execution from where it left off. |
j.break | Stop an orchestration at the next safe task boundary: the current task finishes and records its status, then execution halts before the next one starts — nothing is aborted mid-flight. Soft by default (one-shot); hard persists until j.break clear; append status for a progress rapport on the current scope of execution. |
j.error | Guided troubleshooting — gathers context about an error and investigates a fix. |
j.gitignore | Retroactively repair an already-scaffolded project's Jenga gitignore state — strips the stray heredoc EOF line left by pre-fix /init scaffolds, adds (or removes) the Jenga-owned path entries via a managed block, and untracks those paths from git and from origin while leaving every file on disk. /init cannot do this: it hard-stops on already-scaffolded, and its template fix is forward-only. |
j.help | List all available skills with descriptions. |
jenga config — terminal command, not a skill
jenga config (lib/commands/config.js, behind the jenga bin) lists and edits the settings in project/configs/*.json
(interactively, or with jenga config get|set <file-id>.<key>). It is deterministic and agentless: no model call, zero
token cost, so it never appears in the skills table above and is not invoked as j.config. A successful set also
increments the file's version counter (threshold_version, config_version). Usage, exit codes and the editable versus
read-only split are in project/configs/README.md.
Skill Frontmatter
Each SKILL.md starts with a YAML frontmatter block. Supported fields:
---
name: j.<skill-name>
description: <one-sentence description>
metadata:
prefered_agent: <agent_name> # optional
keywords: # optional
- "<short phrase>"
examples: # optional
- "<natural-language prompt>"
---| Field | Required | Purpose |
name | ✅ | Canonical skill identifier — j. + the skill's bare name (e.g. j.commit). Not a mechanical derivation of the directory name: the canonical directory is skills/j-<name>/, so skills/j-commit/SKILL.md carries name: j.commit, never j.j-commit (see project/documentation/skill-authoring.md's "The Canonical Naming Contract"). |
description | ✅ | Shown in j.help listings and the skill registry. |
metadata.prefered_agent | ❌ | Sub-agent to delegate to (scrum-master, developer, tester). |
keywords | ❌ | Short phrases (1–3 words) for Jenga Router keyword matching. |
examples | ❌ | Natural-language prompts for Jenga Router semantic matching. |
See project/documentation/skill-authoring.md for the full authoring guide.
prefered_agent
When a SKILL.md file contains a prefered_agent property in its YAML frontmatter, it indicates which sub-agent should be used to execute the skill. When invoking the skill, delegate execution to that agent by loading its definition from agents/<agent_name>.md and passing it the skill's instructions along with all relevant context.
Valid values match the agent definitions in the agents/ directory: scrum-master, developer, tester.
Skills without this property are executed directly without delegating to a sub-agent.
Skill Implementation Principle — Scripts Over Inline Logic
When implementing or authoring a skill, offload deterministic, repeatable steps to shell scripts or other static tooling (e.g., bash scripts in skills/j-<name>/scripts/, shared scripts in scripts/) rather than encoding them as agent instructions inside SKILL.md.
Why:
- Scripts execute consistently regardless of model, context length, or session state
- Moving logic out of
SKILL.mdreduces token consumption on every invocation - Scripts are version-controlled, testable, and reusable across skills
Apply this principle when a step:
- Runs a fixed sequence of shell commands (git operations, file manipulation, validation)
- Produces structured output that the agent then reads and acts on
- Would be identical across every invocation (no dynamic reasoning required)
Keep in SKILL.md what requires agent judgment: interpreting output, making decisions based on context, presenting results to the user, and handling edge cases that cannot be enumerated in advance.
Documentation Placement — docs/ versus project/documentation/ versus site/
Rule (
E34_S06, revised byE70_S02):docs/belongs to the project; Jenga scaffolds it but never puts Jenga content in it; Jenga's internal documents live inproject/documentation/, the published site source lives insite/. Maintainer-internal documentation — design notes, mirror and distribution rules, protocol and parity docs, decision records, execution plans and summaries — lives underproject/documentation/, thedocumentationpath inproject/configs/workflow.json.One-line test: would someone who only installed the package want to read this? If not, it is internal.
Skills and agents that create documentation resolve the destination from
workflow.json'spaths.documentation; they never default todocs/. The strategy brief is not an exception: it is an ordinaryproject/documentation/STRATEGY.mdfile (resolved viapaths.strategy). The site's decision record isproject/documentation/site-decisions.md.
Interaction Pattern
When presenting options to the user, ALWAYS use this format instead of open-ended questions if possible:
What would you like to do?
1. Option A
2. Option B
3. Option C
4. Other (describe below)Avoid ask open-ended questions where a list of options would serve better. Free-text input must always appear as the final numbered option.
MCP Tools
mcp/help
Discovers available skills by scanning .agents/skills/. help(path?) returns skill folder names.
cd mcp/help && npm install
node index.jsmcp/execute-ticket
Planned: creates a sub-agent, initialises a git worktree, and names the session after the task ID. See mcp/execute-ticket/index.js.
Hooks
Hooks are configured in settings.json and fire automatically during a Claude Code session.
| Hook | Trigger | Action |
WorktreeCreate | Developer creates a worktree | Runs git worktree add and echoes the worktree path. |
WorktreeRemove | Developer removes a worktree | Runs git worktree remove --force on the given path. |
SessionEnd | Any session ends | Runs hooks/on_session_end.sh asynchronously. |
PreToolUse | Every Bash, Task or Agent tool call | Runs hooks/on_preflight_check.sh — the pre-flight checklist backstop. Reads the situation marker; with no active lifecycle phase it is a silent no-op, and with one it refuses the phase's gated operation when a block-enforcement checklist item is unsatisfied. |
hooks/on_session_end.sh
Runs at the end of every Developer or Tester session: logs a session-end event to events.json, compares rapports/problems/ against .rapport_manifest.json (skipping *.IGNORE.md files) and writes a rapport_review trigger if new rapports are found, then always appends a status_review trigger for the next Scrum Master session.
hooks/on_preflight_check.sh
The enforcing layer of the pre-flight checklist feature (E67_S04). Fires on PreToolUse for Bash, Task and Agent calls, reads the situation marker (scripts/checklist-marker.sh) to learn which lifecycle phase is active, runs scripts/checklist.sh check <phase> with the run id from the marker frame, and refuses the tool call when a block-enforcement item is unsatisfied. It exists so that enforcement does not ultimately depend on an agent choosing to call the checker.
- No marker, no effect. With no lifecycle phase active it exits 0 with no output and no subprocess — measured at 11.0 ms/call against a 9.9 ms bare-
bashfloor. - It gates each phase's own irreversible operation, not every tool call (
pre-commit→git commit,pre-task→ subagent dispatch andgit worktree add,pre-release/pre-publish→npm publish/gh release/git push/git tag,pre-mirror→git push/mirror.sh,pre-reconcile→git merge/git worktree remove). Gating everything would wedge the session, because satisfying a failed item is itself a tool call. - It holds at every permission level, including 5 (Unrestricted). Its decision never consults permission state, and there is no environment variable that disables it.
- It is registered in six files, not one.
scripts/jenga-permission-level-switch.shwhole-file-overwrites.claude/settings.jsonand.agents/settings.jsonfromtemplates/permission-levels/level-<n>-<name>.json, so a hook present only in the rootsettings.jsonis silently dropped by any/jenga-permission-levelswitch — the same bugE15_S04_T01fixed for theWorktreeCreatecommit guard. ThePreToolUseblock is therefore byte-identical across the rootsettings.jsonand all five templates. Change all six together.
Full contract: the script's own header comment, and section 9 of project/documentation/preflight-checklists.md.
Subject Divergence Detection
What Counts as Divergence
A subject has diverged when the user introduces any of the following mid-session:
- A new feature request unrelated to the task or story currently in focus
- An unrelated suggestion (tooling change, refactor, workflow idea) that would require separate planning
- A scope-expanding idea that goes beyond the current story's Acceptance Criteria or Definition of Done
Clarifying questions, follow-up details, or edge cases that directly serve the current topic are not divergence.
Detection & Prompt
When divergence is detected, immediately pause the current line of work and present the following structured choice:
It looks like we're moving into a new topic. How would you like to handle it?
1. Capture the **new topic** as a `j.todo` (I'll return to what we were doing)
2. Capture the **current topic** as a `j.todo` (I'll continue with the new topic)
3. Capture **both** as `j.todo` items (you choose which to continue first)
4. Ignore it — tell me which topic to continue withOption A — Capture the Diverging Topic
- Summarise the diverging topic using context gathered so far and create a
j.todowith that summary as the description. - Offer
j.brainstormto fill in any missing Prerequisites before finalising thej.todo. - Once the
j.todois saved, return to the primary topic exactly where it was paused.
Option B — Capture the Primary Topic
- Summarise the primary topic using context gathered so far and create a
j.todowith that summary as the description. - Offer
j.brainstormto fill in any missing Prerequisites before finalising thej.todo. - Once the
j.todois saved, continue with the diverging topic.
Option C — Capture Both
- Create a
j.todofor the diverging topic (with context summary and aj.brainstormoffer for Prerequisites). - Create a
j.todofor the primary topic (with context summary and aj.brainstormoffer for Prerequisites). - Ask the user which topic to continue first.
Context Surfacing
In every j.todo description created through this flow, include:
- A one-sentence summary of the topic
- Key details, constraints, or decisions already discussed
- Any open questions or unknowns raised so far
This ensures no context is lost regardless of which option the user chooses.
Edge Cases
- User declines both options (selects "Ignore it"): Acknowledge the choice without creating any
j.todoitems, then ask the user to explicitly state which topic to continue. Follow their direction. - User wants to pursue both in parallel: Treat this as Option C — capture both as
j.todoitems with full context summaries, then ask the user which to continue first.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

