create-religion 0.1.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.
Files changed (80) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +47 -0
  3. package/dist/bin/religion.js +209 -0
  4. package/dist/lib/dashboard.js +123 -0
  5. package/dist/lib/doctor.js +164 -0
  6. package/dist/lib/install.js +170 -0
  7. package/dist/lib/paths.js +40 -0
  8. package/dist/lib/state.js +117 -0
  9. package/dist/lib/status.js +88 -0
  10. package/package.json +40 -0
  11. package/template/.agents/skills/audit/SKILL.md +169 -0
  12. package/template/.agents/skills/auto/SKILL.md +110 -0
  13. package/template/.agents/skills/browser-tests/SKILL.md +65 -0
  14. package/template/.agents/skills/check/SKILL.md +86 -0
  15. package/template/.agents/skills/ci/SKILL.md +79 -0
  16. package/template/.agents/skills/complete/SKILL.md +184 -0
  17. package/template/.agents/skills/debug/SKILL.md +72 -0
  18. package/template/.agents/skills/discovery/SKILL.md +83 -0
  19. package/template/.agents/skills/distill/SKILL.md +95 -0
  20. package/template/.agents/skills/doctor/SKILL.md +65 -0
  21. package/template/.agents/skills/extend/SKILL.md +102 -0
  22. package/template/.agents/skills/feature/SKILL.md +172 -0
  23. package/template/.agents/skills/feature/reference/spec-template.md +67 -0
  24. package/template/.agents/skills/fix/SKILL.md +76 -0
  25. package/template/.agents/skills/implement/SKILL.md +174 -0
  26. package/template/.agents/skills/overview/SKILL.md +150 -0
  27. package/template/.agents/skills/overview/reference/project-overview-template.md +101 -0
  28. package/template/.agents/skills/prototype/SKILL.md +90 -0
  29. package/template/.agents/skills/release/SKILL.md +88 -0
  30. package/template/.agents/skills/rollback/SKILL.md +114 -0
  31. package/template/.agents/skills/setup/SKILL.md +105 -0
  32. package/template/.agents/skills/status/SKILL.md +63 -0
  33. package/template/.agents/skills/tests/SKILL.md +90 -0
  34. package/template/.agents/skills/try/SKILL.md +59 -0
  35. package/template/.claude/hooks/guard-rendered-output.mjs +49 -0
  36. package/template/.claude/hooks/guard-tier-one.mjs +63 -0
  37. package/template/.claude/hooks/write-handoff.mjs +83 -0
  38. package/template/.claude/skills/audit/SKILL.md +169 -0
  39. package/template/.claude/skills/auto/SKILL.md +110 -0
  40. package/template/.claude/skills/browser-tests/SKILL.md +65 -0
  41. package/template/.claude/skills/check/SKILL.md +86 -0
  42. package/template/.claude/skills/ci/SKILL.md +79 -0
  43. package/template/.claude/skills/complete/SKILL.md +184 -0
  44. package/template/.claude/skills/debug/SKILL.md +72 -0
  45. package/template/.claude/skills/discovery/SKILL.md +83 -0
  46. package/template/.claude/skills/distill/SKILL.md +95 -0
  47. package/template/.claude/skills/doctor/SKILL.md +65 -0
  48. package/template/.claude/skills/extend/SKILL.md +102 -0
  49. package/template/.claude/skills/feature/SKILL.md +172 -0
  50. package/template/.claude/skills/feature/reference/spec-template.md +67 -0
  51. package/template/.claude/skills/fix/SKILL.md +76 -0
  52. package/template/.claude/skills/implement/SKILL.md +174 -0
  53. package/template/.claude/skills/overview/SKILL.md +150 -0
  54. package/template/.claude/skills/overview/reference/project-overview-template.md +101 -0
  55. package/template/.claude/skills/prototype/SKILL.md +90 -0
  56. package/template/.claude/skills/release/SKILL.md +88 -0
  57. package/template/.claude/skills/rollback/SKILL.md +114 -0
  58. package/template/.claude/skills/setup/SKILL.md +105 -0
  59. package/template/.claude/skills/status/SKILL.md +63 -0
  60. package/template/.claude/skills/tests/SKILL.md +90 -0
  61. package/template/.claude/skills/try/SKILL.md +59 -0
  62. package/template/AGENTS.md +206 -0
  63. package/template/CLAUDE.md +175 -0
  64. package/template/religion/.state/README.md +10 -0
  65. package/template/religion/.state/settings-template.json +19 -0
  66. package/template/religion/build-plan.md +43 -0
  67. package/template/religion/config.json +26 -0
  68. package/template/religion/context/ai-interaction.md +84 -0
  69. package/template/religion/context/coding-standards.md +77 -0
  70. package/template/religion/context/current-work.md +8 -0
  71. package/template/religion/context/findings.md +9 -0
  72. package/template/religion/context/handoff.md +8 -0
  73. package/template/religion/context/project-overview.md +8 -0
  74. package/template/religion/history/features/README.md +8 -0
  75. package/template/religion/history/fixes/README.md +6 -0
  76. package/template/religion/history/rollbacks/README.md +7 -0
  77. package/template/religion/learning/journal.md +7 -0
  78. package/template/religion/learning/lessons.md +8 -0
  79. package/template/religion/project-plan.md +49 -0
  80. package/template/religion/reference/README.md +7 -0
@@ -0,0 +1,114 @@
1
+ ---
2
+ name: rollback
3
+ summary: plan a guarded reversal of completed work, preserving its history
4
+ description: "Plan the safe reversal of a completed item using its archive and the commits it recorded when it landed. Verifies the recorded commits still resolve and are ancestors of HEAD, reviews later commits for work that depends on them, then writes a Type: Rollback spec to religion/context/current-work.md and stops before any code changes. The reversal applies only the product diff in reverse, never a whole-commit revert, so the archive and plan bookkeeping that landed in the same commits survive. Use when the user runs $rollback, asks to remove or undo completed work, or wants the project returned to its behavior before an item without erasing the record that it existed."
5
+ ---
6
+
7
+ # rollback - plan a guarded reversal
8
+
9
+ Where this sits:
10
+
11
+ history/ -> [rollback] -> implement -> complete
12
+ (archive) (plan it) (apply it) (record it)
13
+
14
+ Removing completed work is not `git revert`. The commits that landed an item also carry its
15
+ archive, its build-plan tick, and its ledger pruning. Reverting them whole would delete the
16
+ record that the work ever existed, and would fight with whatever the plan says now.
17
+
18
+ This skill plans. It writes a spec and stops. No product file changes here.
19
+
20
+ ## Step 1 - identify the target
21
+
22
+ Take a build-plan number or name. Match it to a **checked** item and its archive under
23
+ `religion/history/features/`. If the item is not checked, it was never completed, and there
24
+ is nothing to roll back: say so.
25
+
26
+ Read the archive's `## Landed` section for the base commit, the item's commits, and the
27
+ product paths it touched.
28
+
29
+ **If there is no `## Landed` section**, the item was completed before that record existed.
30
+ Do not guess the commit range from messages or dates: reversing the wrong commits damages
31
+ unrelated work. Report what is missing, show the archive and the commits around it, and ask
32
+ the user to confirm the exact range before continuing.
33
+
34
+ ## Step 2 - verify the record still holds
35
+
36
+ Stop on any failure. Do not repair a mismatch by choosing a nearby commit.
37
+
38
+ 1. Every recorded identifier matches `^[0-9a-f]{40}$`. Reject abbreviated or uppercase
39
+ values.
40
+ 2. Every recorded commit resolves in this repository and is an ancestor of `HEAD`.
41
+ 3. The recorded base is the parent of the earliest recorded commit.
42
+ 4. The working tree is clean apart from the rollback spec being written.
43
+
44
+ ## Step 3 - preview the product diff
45
+
46
+ Compute the reversal exactly as it will be applied, excluding everything the workflow owns:
47
+
48
+ git diff --binary <base> <last-recorded-commit> -- . \
49
+ ':(exclude).agents/**' ':(exclude).claude/**' \
50
+ ':(exclude)religion/**' \
51
+ ':(exclude)AGENTS.md' ':(exclude)CLAUDE.md' \
52
+ ':(exclude)prototypes/**'
53
+
54
+ Confirm the result is non-empty and its paths match the product paths in the archive. A
55
+ mismatch means the record and the repository disagree, which is a stop.
56
+
57
+ Never drop those exclusions for convenience. They are what keeps the archive, the plan, and
58
+ the ledger intact while the product change goes away.
59
+
60
+ Under `git.mode: trunk` the item's commits sit among other commits on the same branch. The
61
+ recorded range is what separates them; the diff is still computed only across that range,
62
+ never from the branch tip.
63
+
64
+ ## Step 4 - review what came after
65
+
66
+ Inspect commits after the target for work that depends on it: imports of things it added,
67
+ callers of its functions, columns or fields it introduced, configuration it established.
68
+
69
+ Report each dependency with its commit and file. A reversal that cascades into later work
70
+ is not a rollback, it is a second reversal that has not been planned. Say so plainly and
71
+ let the user decide before writing the spec.
72
+
73
+ ## Step 5 - write the spec
74
+
75
+ Write `religion/context/current-work.md` marked `Type: Rollback`, recording:
76
+
77
+ - **Target** - the item, its number, and its archive path
78
+ - **Reason** - why it is being removed, in the user's words
79
+ - **Base** and **Commits** - the verified full identifiers
80
+ - **Product paths** - what the reverse patch will touch
81
+ - **Later dependencies** - what Step 4 found, and how each is handled
82
+ - **Build steps** - normally one: apply the reverse patch and confirm the tree
83
+ - **Done when** - the removed behavior is gone, and one named unaffected path still works
84
+
85
+ Include the exact command from Step 3 in the spec, so implementation applies the reviewed
86
+ diff rather than reconstructing it.
87
+
88
+ Then stop for review.
89
+
90
+ ## What implementation will do
91
+
92
+ Recorded here so the spec and the build agree:
93
+
94
+ 1. Recompute the diff from Step 3 and confirm it still matches.
95
+ 2. Apply it in reverse with three-way conflict detection, and stage it:
96
+ `... | git apply --reverse --3way --index`
97
+ 3. Show the staged diff and the status, and confirm no workflow-owned path is touched.
98
+
99
+ On a conflict: stop, report the exact paths and the later commit involved, and ask. Never
100
+ auto-resolve, discard, stash, reset, or check out broadly. A cascade into other completed
101
+ work needs its own plan.
102
+
103
+ ## Rules
104
+
105
+ - The archive is never deleted or rewritten. Completion adds a rollback record beside it.
106
+ - Reverse only the recorded product diff. Never a whole-commit revert.
107
+ - The build-plan item is unticked and annotated, and keeps its number.
108
+ - Stop on any mismatch between the record and the repository. Guessing is what makes a
109
+ rollback dangerous.
110
+
111
+ ## Formatting
112
+
113
+ Match the conventions in `religion/context/ai-interaction.md`: concise, scannable
114
+ markdown, lists for enumerations and tables for matrices rather than dense paragraphs.
@@ -0,0 +1,105 @@
1
+ ---
2
+ name: setup
3
+ summary: tune the installation to this project, greenfield or existing
4
+ description: "Set up Religion after installing it into a project. Detects whether the project is newly scaffolded or already has shipped work, and branches: a new project gets its entry file, standards, and configuration tuned before you write the plans, while an existing one is surveyed so the plans and standards are generated from what is actually there. Documents the real commands, reports existing checks, decides whether workflow files are committed, and says what to do next. Use when the user runs $setup, has just installed Religion, or asks what to do first."
5
+ ---
6
+
7
+ # setup - make the installation match this project
8
+
9
+ Run once, after installing. It replaces the shipped assumptions with what is true here.
10
+
11
+ ## Step 0 - which project is this
12
+
13
+ Look before asking. Count source files, read the git history, check whether the project has
14
+ shipped anything.
15
+
16
+ - **New** - a scaffold, little or no history, no meaningful features yet. The plans are
17
+ written from intent, by the user, after this runs.
18
+ - **Existing** - real features, real history, real users possibly. The plans are generated
19
+ from what already exists, in this run.
20
+
21
+ State which you concluded and why, and let the user correct you. Guessing wrong is
22
+ recoverable but wasteful: the existing path does substantially more work.
23
+
24
+ ## Step 1 - survey the project
25
+
26
+ Both paths need this.
27
+
28
+ - **Stack** - languages, framework, package manager, module system, versions.
29
+ - **Commands** - the real ones, from the package manifest or task runner: dev, build, test,
30
+ lint, typecheck. Never invent one. A command that does not exist is worse than a missing
31
+ one, because it will be run.
32
+ - **Checks that already exist** - test runner, typecheck, lint, continuous integration.
33
+ Report them; do not add any.
34
+ - **Conventions** - file organization, naming, how components and modules are actually
35
+ structured, how data is accessed, how errors are handled. What the code does, not what a
36
+ style guide would say.
37
+ - **Layout** - the directories that matter and what each owns.
38
+
39
+ ## Step 2 - write what you learned
40
+
41
+ **The entry file's Commands section.** Replace the placeholder with the real commands. If
42
+ the project has a single command that runs its checks in order, record it as `Verify`. If
43
+ it does not, leave that out; $ci defines one deliberately later.
44
+
45
+ **The coding standards' Stack conventions section.** Fill it from the survey: language
46
+ conventions, file organization, naming, framework patterns, data access, as this project
47
+ actually does them. Do not import opinions the project does not hold. If the project is
48
+ inconsistent, say so and pick the dominant pattern, noting that it was a choice.
49
+
50
+ **The project title** in the entry files, and the one-line description.
51
+
52
+ ## Step 3 - the plans
53
+
54
+ **New project.** Leave both plans as templates and tell the user to fill them in, or to run
55
+ $discovery for a guided session. Do not write plans from a scaffold; there is
56
+ nothing there to derive intent from.
57
+
58
+ **Existing project.** Generate both, then have them reviewed:
59
+
60
+ - **Project plan** - problem, users, and features derived from the code, the README, and
61
+ the history. Tech and data from what is actually there. Mark anything you inferred rather
62
+ than found, because inferring intent from an implementation is exactly where this goes
63
+ wrong: the code says what was built, never why.
64
+ - **Build plan** - shipped features listed as **checked** items, so the history is honest
65
+ and numbering starts from reality. Unshipped work goes in unchecked, if the user names
66
+ any.
67
+
68
+ Ask for the intent the code cannot reveal: who this is for, what problem it solves, what
69
+ was deliberately excluded. That conversation is the whole value of this path. Then stop for
70
+ review before anything downstream runs.
71
+
72
+ ## Step 4 - visibility
73
+
74
+ Ask whether the workflow files should be committed or kept local. Do not pick a default.
75
+
76
+ - **Committed** - plans, specs, and history are part of the repository: portable across
77
+ machines, visible to collaborators, reviewable.
78
+ - **Local** - added to `.gitignore`, so nothing about the workflow enters a shared
79
+ repository. Not portable: another machine needs it installed again.
80
+
81
+ If those paths are already tracked and the user chooses local, say that `.gitignore` alone
82
+ will not untrack them, and ask before running anything that would.
83
+
84
+ ## Step 5 - report
85
+
86
+ - what was detected: stack, commands, existing checks
87
+ - what was changed, file by file
88
+ - what the user must do next, exactly: fill in the plans, or review generated ones
89
+ - optional things worth knowing about, without pushing: $tests if there is logic and
90
+ no runner, $ci if there are checks and no automation
91
+
92
+ Then stop. The next step is $overview, once the plans are real.
93
+
94
+ ## Rules
95
+
96
+ - Detect before asking, then let the user correct the detection.
97
+ - Never invent a command, a convention, or a feature.
98
+ - Mark inferred intent as inferred.
99
+ - Do not install anything, add a test runner, or create continuous integration here.
100
+ - Generated plans are a draft for review, never a finished artifact.
101
+
102
+ ## Formatting
103
+
104
+ Match the conventions in `religion/context/ai-interaction.md`: concise, scannable
105
+ markdown, lists for enumerations and tables for matrices rather than dense paragraphs.
@@ -0,0 +1,63 @@
1
+ ---
2
+ name: status
3
+ summary: say where the work stands and what to do next
4
+ description: "Report where the project stands: build-plan progress, the active spec and which of its steps are done, open findings, git state, and the one action that makes sense next. Uses the religion command-line tool when it is installed, since the parsing is deterministic, and reads the state files directly when it is not. Read-only. Use when the user runs $status, asks where things stand, what is next, what is in progress, or is picking work back up after a break or a cleared context."
5
+ ---
6
+
7
+ # status - where things stand
8
+
9
+ Read-only. It reports; it never advances anything.
10
+
11
+ ## Step 1 - get the state
12
+
13
+ If the `religion` command is available, run `religion status --json` and use it. The
14
+ parsing is deterministic and a program does it more reliably than a reading of the files.
15
+
16
+ Otherwise read them directly: `religion/build-plan.md` for progress,
17
+ `religion/context/current-work.md` for the active spec and its ticked steps,
18
+ `religion/context/findings.md` for the ledger, `religion/context/project-overview.md` for
19
+ its source hash, and the git branch and working-tree state.
20
+
21
+ ## Step 2 - report
22
+
23
+ Lead with the next action, because that is the question actually being asked.
24
+
25
+ - **Next** - the single command that makes sense now, and why in one clause.
26
+ - **Active work** - the item, and which step it is on out of how many. "Nothing in
27
+ progress" when the spec is the stub.
28
+ - **Plan** - items complete out of total, and the next unchecked one.
29
+ - **Findings** - counts by status, naming any P0 or P1 that is `open` or `fixed`, since
30
+ those block completion.
31
+ - **Git** - branch, whether the tree is dirty, and unpushed commits.
32
+ - **Warnings** - only real ones: a stale overview, an open question blocking queued work,
33
+ a spec whose steps are all ticked but which was never completed, a dirty tree with no
34
+ active spec.
35
+
36
+ Say "up to date" rather than inventing a warning when there is nothing wrong.
37
+
38
+ ## Choosing the next action
39
+
40
+ | State | Next |
41
+ | --- | --- |
42
+ | Plans not filled in | Write them, or run $discovery |
43
+ | Overview missing or stale | $overview |
44
+ | No active spec, plan has unchecked items | $feature |
45
+ | Active spec, steps unticked | $implement |
46
+ | All steps ticked, not verified | $check |
47
+ | Verified, findings blocking | $audit, or repair via $implement |
48
+ | Verified, nothing blocking | $complete |
49
+ | Plan complete | Add to the plan, or $release |
50
+
51
+ When two apply, take the one further along: finishing beats starting.
52
+
53
+ ## Rules
54
+
55
+ - Read-only. Never write a state file, tick a step, or advance anything.
56
+ - One next action. A list of options is not an answer to "what now".
57
+ - Do not guess at what is happening. If the state is contradictory, say what is
58
+ contradictory.
59
+
60
+ ## Formatting
61
+
62
+ Match the conventions in `religion/context/ai-interaction.md`: concise, scannable
63
+ markdown, lists for enumerations and tables for matrices rather than dense paragraphs.
@@ -0,0 +1,90 @@
1
+ ---
2
+ name: tests
3
+ summary: set up unit testing, or backfill coverage for logic that already exists
4
+ description: "Set up unit testing for this project: detect the stack, reuse an existing runner or install the stack-native one, add a small example test, record the command in the entry file, and run it. Declaring that command is what turns testing into a gate for logic-bearing work. Given `backfill`, instead writes tests for logic that already exists, worst-covered first. Use when the user runs $tests, asks to add or set up unit tests, or asks to cover existing code with tests."
5
+ ---
6
+
7
+ # tests - turn the testing gate on, or backfill coverage
8
+
9
+ Two modes. `$tests` sets the runner up. `$tests backfill` covers logic that already
10
+ exists. Setup comes first; backfilling into no runner is not a thing.
11
+
12
+ ## Setup mode
13
+
14
+ ### Step 1 - look before installing
15
+
16
+ If a runner is already configured, use it. Adding a second is how a project ends up with
17
+ two test commands and no idea which one is authoritative.
18
+
19
+ If there is none, choose the stack-native one: vitest for a TypeScript or JavaScript
20
+ project, pytest for Python, the built-in tooling for Go or Rust. Do not import a preference
21
+ the ecosystem does not share.
22
+
23
+ Say what you found and what you propose before installing anything. Installing a dependency
24
+ needs a yes.
25
+
26
+ ### Step 2 - wire it up
27
+
28
+ Install the runner, add the script or task, and add **one** small test that genuinely
29
+ exercises something real in this project. Not a test that asserts true is true: a test that
30
+ would fail if the thing it covers broke.
31
+
32
+ ### Step 3 - record the command
33
+
34
+ Add the exact command to the Commands section of the entry file as `Test`.
35
+
36
+ **This is the switch.** Once that command is declared, a build step that adds logic ships a
37
+ passing test in the same diff, and completion will not finish while the suite is red. Say
38
+ that plainly, because it changes how every later work item behaves.
39
+
40
+ If a `Verify` command exists, add the test command to it in the right order: typecheck,
41
+ then tests, then build.
42
+
43
+ ### Step 4 - prove it
44
+
45
+ Run the test command and show the output. Then run it again with the example test
46
+ deliberately broken, to show it actually fails. A suite that cannot fail is not a gate, and
47
+ an empty suite reporting success is the specific failure worth ruling out here.
48
+
49
+ Restore it, and report what changed.
50
+
51
+ ## Backfill mode
52
+
53
+ For logic that shipped without tests. Deliberate, bounded, and never automatic.
54
+
55
+ ### Step 1 - find what is worth covering
56
+
57
+ Only in-scope logic: parsers, formatters, validators, identifier builders, server actions,
58
+ anything with assertable inputs and outputs and real edge cases. Not components, not
59
+ integration surfaces, not anything whose test would just mirror the implementation.
60
+
61
+ Rank by risk, not by convenience: how badly a wrong answer would hurt, how likely a wrong
62
+ answer is, how often the code changes. Present the ranked list and how many to do now. Do
63
+ not attempt the whole project in one pass.
64
+
65
+ ### Step 2 - write them, in reviewed batches
66
+
67
+ One module at a time, each as its own reviewable diff. For each, cover the normal case, the
68
+ edges the code actually handles, and the edges it does not.
69
+
70
+ **When a test fails, stop.** A backfilled test that fails has found a bug, and that is the
71
+ valuable outcome. Do not adjust the test to match the behavior: report it, and let it
72
+ become a fix. Writing the test around the bug destroys the only reason to have written it.
73
+
74
+ ### Step 3 - report
75
+
76
+ What was covered, what was skipped and why, and every discrepancy found. Discrepancies are
77
+ the point; coverage is the side effect.
78
+
79
+ ## Rules
80
+
81
+ - Never install a runner during unrelated work. This is a deliberate setup step.
82
+ - One runner per project.
83
+ - Never write a test that cannot fail.
84
+ - Never change behavior to make a backfilled test pass.
85
+ - Setup adds one example test, not a suite.
86
+
87
+ ## Formatting
88
+
89
+ Match the conventions in `religion/context/ai-interaction.md`: concise, scannable
90
+ markdown, lists for enumerations and tables for matrices rather than dense paragraphs.
@@ -0,0 +1,59 @@
1
+ ---
2
+ name: try
3
+ summary: write the human walkthrough for reviewing the work yourself
4
+ description: "Generate the manual walkthrough for the current or most recently completed work: what to start, where to go, what to click or run, what to expect, and what would count as wrong. Read-only, and written for a person rather than an agent. $complete emits one for every completed item automatically, so this is for asking again later or for work still in progress. Use when the user runs $try, asks how to see or test a change themselves, asks where to click, or wants a manual review path."
5
+ ---
6
+
7
+ # try - the human review path
8
+
9
+ $check is the agent proving the work. This is you checking it yourself, which is a
10
+ different thing and catches different problems: the ones that are technically correct and
11
+ still wrong.
12
+
13
+ Read-only. It does not run the project unless asked to.
14
+
15
+ ## Step 1 - find the work
16
+
17
+ Use `religion/context/current-work.md` when something is in progress. When it is the stub,
18
+ use the most recent archive under `religion/history/`, and say which one you are describing.
19
+
20
+ ## Step 2 - write the walkthrough
21
+
22
+ Read the spec's outcomes and the project's declared commands, then write instructions a
23
+ person can follow without knowing how any of it was built.
24
+
25
+ 1. **Start it.** The exact command, and where it will be listening.
26
+ 2. **Get there.** The route, the screen, the command, the endpoint. Say how to reach it
27
+ from a cold start, including any state that has to exist first, such as being signed in
28
+ or having a record to act on.
29
+ 3. **Do the thing.** What to click, type, or run.
30
+ 4. **Expect this.** What should happen, concretely enough to disagree with.
31
+ 5. **This would be wrong.** The specific failure worth watching for. Skipping this makes
32
+ the whole walkthrough a confirmation exercise, because someone following instructions
33
+ tends to see what they were told to expect.
34
+
35
+ Cover the unhappy paths too when they are quick: the empty state, the error case, what a
36
+ second attempt does.
37
+
38
+ For a rollback, say how to confirm the removed behavior is gone, and name one unaffected
39
+ path that should still work.
40
+
41
+ ## Step 3 - keep it honest
42
+
43
+ State any setup that will not be obvious: seed data, environment variables, a service that
44
+ must be running, a browser signed into something.
45
+
46
+ If a step cannot be described because the work has no observable effect, say so plainly.
47
+ That is worth knowing before completion, not after.
48
+
49
+ ## Rules
50
+
51
+ - Instructions for a person, never a claim that a person followed them. Generating a
52
+ walkthrough is not evidence of review.
53
+ - Read-only. Do not start the project, change files, or run anything unless asked.
54
+ - Concrete over complete. Five steps someone will actually follow beat twenty they will not.
55
+
56
+ ## Formatting
57
+
58
+ Match the conventions in `religion/context/ai-interaction.md`: concise, scannable
59
+ markdown, lists for enumerations and tables for matrices rather than dense paragraphs.
@@ -0,0 +1,49 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Blocks edits to rendered adapter trees inside a source checkout.
4
+ *
5
+ * Rendered output is overwritten by the next build, so an edit made there is lost without
6
+ * warning and the real source stays wrong. Applies only where `src/skills/` exists, which
7
+ * is what distinguishes a source checkout from an installed project.
8
+ */
9
+
10
+ import { existsSync, readFileSync } from "node:fs";
11
+ import path from "node:path";
12
+
13
+ if (!existsSync(path.join(process.cwd(), "src", "skills"))) process.exit(0);
14
+
15
+ let input = "";
16
+ try {
17
+ input = readFileSync(0, "utf8");
18
+ } catch {
19
+ process.exit(0);
20
+ }
21
+
22
+ let file = "";
23
+ try {
24
+ const payload = JSON.parse(input);
25
+ file = payload?.tool_input?.file_path ?? "";
26
+ } catch {
27
+ process.exit(0);
28
+ }
29
+
30
+ if (!file) process.exit(0);
31
+
32
+ const relative = path.relative(process.cwd(), file);
33
+ const rendered = [".claude/skills", ".agents/skills", "template/"];
34
+
35
+ if (rendered.some((prefix) => relative.startsWith(prefix))) {
36
+ const source = relative.replace(/^template\//, "").replace(/^\.(claude|agents)\/skills/, "src/skills");
37
+ process.stdout.write(JSON.stringify({
38
+ hookSpecificOutput: {
39
+ hookEventName: "PreToolUse",
40
+ permissionDecision: "deny",
41
+ permissionDecisionReason:
42
+ `Blocked: ${relative} is generated output and the next build overwrites it.\n\n` +
43
+ `Edit the source instead (likely ${source}), then run \`npm run build:skills\`.`
44
+ }
45
+ }));
46
+ process.exit(0);
47
+ }
48
+
49
+ process.exit(0);
@@ -0,0 +1,63 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Blocks first-tier commands that were not approved in the conversation.
4
+ *
5
+ * This enforces nothing new. The Authority section of the project entry file already says
6
+ * merging, pushing, deploying, publishing, deleting data, and rewriting history each need
7
+ * a fresh yes. The hook exists because that rule is prose, and prose can be forgotten
8
+ * mid-task. It is a safety net for one tool, never a rule of its own.
9
+ */
10
+
11
+ import { readFileSync } from "node:fs";
12
+
13
+ const PATTERNS = [
14
+ { re: /\bgit\s+push\b/, what: "pushing to a remote" },
15
+ { re: /\bgit\s+merge\b/, what: "merging" },
16
+ { re: /\bgit\s+(?:rebase|reset\s+--hard|filter-branch)\b/, what: "rewriting history" },
17
+ { re: /\bgit\s+commit\b.*--amend\b/, what: "rewriting a commit" },
18
+ { re: /\bnpm\s+publish\b|\bpnpm\s+publish\b|\byarn\s+publish\b/, what: "publishing" },
19
+ { re: /\b(?:vercel|railway|render)\s+(?:deploy|up)\b/, what: "deploying" },
20
+ { re: /\brm\s+-[a-z]*r[a-z]*f?\b/, what: "recursive deletion" }
21
+ ];
22
+
23
+ let input = "";
24
+ try {
25
+ input = readFileSync(0, "utf8");
26
+ } catch {
27
+ process.exit(0);
28
+ }
29
+
30
+ let command = "";
31
+ try {
32
+ const payload = JSON.parse(input);
33
+ command = payload?.tool_input?.command ?? "";
34
+ } catch {
35
+ process.exit(0);
36
+ }
37
+
38
+ if (!command) process.exit(0);
39
+
40
+ // A force flag makes an otherwise ordinary command destructive, so it is always first tier.
41
+ const forced = /--force\b|(?:^|\s)-f(?:\s|$)/.test(command) && /\bgit\s+push\b/.test(command);
42
+
43
+ for (const { re, what } of PATTERNS) {
44
+ if (!re.test(command)) continue;
45
+
46
+ const reason =
47
+ `Blocked: ${what}${forced ? " (forced)" : ""} is a first-tier action.\n\n` +
48
+ `The Authority section of this project's entry file requires an explicit yes for it, ` +
49
+ `in this conversation, every time. No mode or setting grants it.\n\n` +
50
+ `If the user has already approved this exact action, say so and ask them to confirm ` +
51
+ `once more, then proceed. Do not edit or disable this hook to get past it.`;
52
+
53
+ process.stdout.write(JSON.stringify({
54
+ hookSpecificOutput: {
55
+ hookEventName: "PreToolUse",
56
+ permissionDecision: "ask",
57
+ permissionDecisionReason: reason
58
+ }
59
+ }));
60
+ process.exit(0);
61
+ }
62
+
63
+ process.exit(0);
@@ -0,0 +1,83 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Regenerates the handoff file at the end of a turn.
4
+ *
5
+ * The handoff answers "where does this sit, what should I read, what should I watch" for
6
+ * whoever picks the project up next. It is derived from the other state files, so a hook
7
+ * can produce it and the model cannot forget to. Losing it costs nothing.
8
+ */
9
+
10
+ import { existsSync, readFileSync, writeFileSync } from "node:fs";
11
+ import path from "node:path";
12
+
13
+ const STATE = "religion";
14
+ const root = process.cwd();
15
+ const contextDir = path.join(root, STATE, "context");
16
+ if (!existsSync(contextDir)) process.exit(0);
17
+
18
+ const read = (file) => {
19
+ try {
20
+ return readFileSync(path.join(root, STATE, file), "utf8");
21
+ } catch {
22
+ return "";
23
+ }
24
+ };
25
+
26
+ const buildPlan = read("build-plan.md");
27
+ const work = read("context/current-work.md");
28
+ const findings = read("context/findings.md");
29
+
30
+ const done = (buildPlan.match(/^\s*- \[x\]/gim) ?? []).length;
31
+ const open = (buildPlan.match(/^\s*- \[ \]/gim) ?? []).length;
32
+ const nextItem = buildPlan.match(/^\s*- \[ \]\s*(.+)$/im)?.[1]?.trim();
33
+
34
+ const active = !/_Nothing in progress\./.test(work) && work.trim().length > 0;
35
+ const title = work.match(/^#\s+(.+)$/m)?.[1]?.trim();
36
+ const stepsDone = (work.match(/^\s*- \[x\]/gim) ?? []).length;
37
+ const stepsLeft = (work.match(/^\s*- \[ \]/gim) ?? []).length;
38
+ const nextStep = work.match(/^\s*- \[ \]\s*(?:\*\*)?(.+?)(?:\*\*)?\s*-/im)?.[1]?.trim();
39
+
40
+ const blocking = [...findings.matchAll(/^### (F-\d+) \[(P[01])\] (open|fixed) - (.+)$/gim)]
41
+ .map((m) => `${m[1]} [${m[2]}] ${m[3]} - ${m[4]}`);
42
+
43
+ const lines = [
44
+ "# Handoff",
45
+ "",
46
+ "> **Generated file.** Rewritten at the end of each turn from the other state files.",
47
+ "> Nothing reads it to make a decision; it is how a person or a fresh session catches up.",
48
+ "",
49
+ "## Where the work sits",
50
+ ""
51
+ ];
52
+
53
+ if (active) {
54
+ lines.push(
55
+ `**${title ?? "Active work"}** is in progress: ${stepsDone} step(s) done, ${stepsLeft} to go.`,
56
+ ...(nextStep ? [`Next step: ${nextStep}.`] : []),
57
+ ""
58
+ );
59
+ } else {
60
+ lines.push("Nothing in progress.", "");
61
+ }
62
+
63
+ lines.push(
64
+ `Plan: ${done} of ${done + open} item(s) complete.` + (nextItem ? ` Next up: ${nextItem}` : ""),
65
+ ""
66
+ );
67
+
68
+ if (blocking.length > 0) {
69
+ lines.push("## Blocking findings", "", ...blocking.map((f) => `- ${f}`), "",
70
+ "These prevent completion until repaired and re-reviewed.", "");
71
+ }
72
+
73
+ lines.push(
74
+ "## Read first",
75
+ "",
76
+ `1. \`${STATE}/context/current-work.md\` - the active spec and which steps are done`,
77
+ `2. \`${STATE}/context/project-overview.md\` - the source of truth`,
78
+ `3. \`${STATE}/build-plan.md\` - what is done and what is next`,
79
+ ""
80
+ );
81
+
82
+ writeFileSync(path.join(contextDir, "handoff.md"), lines.join("\n") + "\n");
83
+ process.exit(0);