plumbbob 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 Rob McLarty
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,137 @@
1
+ # Plumbbob
2
+
3
+ A manual, attention-first build process that enforces the deciding/executing
4
+ boundary so you build *with* an LLM instead of being dragged behind one. You
5
+ decide on a surface outside the chat; a one-word state file and a set of Claude
6
+ Code hooks refuse to let code edits cross that line until you have.
7
+
8
+ The full philosophy — the one law, the mode machine, the loop — lives in
9
+ [`docs/plumbbob-README.md`](docs/plumbbob-README.md). This file is the
10
+ as-built reference: what ships, how to install it, and the verbs you type.
11
+
12
+ This repository was built using Plumbbob, dogfooded on its own build under its
13
+ own enforcement from step 5 onward.
14
+
15
+ ## What ships
16
+
17
+ - A `plumbbob` CLI (TypeScript, run natively by Node ≥ 22.18, zero runtime
18
+ dependencies) — the dumb mechanical verbs that move the state machine and the
19
+ git checkpoints.
20
+ - Three session-gated Claude Code hooks — a pre-edit muzzle + seam-guard, a Bash
21
+ guard, and a non-blocking light-feedback pass. With no active session they
22
+ short-circuit to allow in microseconds, so a repo without a Plumbbob session
23
+ behaves like plain Claude Code.
24
+ - Five Claude Code skills — the judgment work, each one human-triggered
25
+ (`disable-model-invocation: true`): `/plumbbob-interrogate`, `/park`,
26
+ `/plumbbob-triage`, `/plumbbob-report`, `/plumbbob-docs`.
27
+ - A `.plumbbob/` sidecar of flat control files (`STATE`, `SEAM`, `checkpoints`,
28
+ `intent.md`, `build-log.md`) that the hooks read with a grep.
29
+
30
+ ## Install
31
+
32
+ The npm package is `plumbbob` (the npm name `plumbbob` was taken); it installs
33
+ the CLI as `plumbbob` plus a `pb` shorthand:
34
+
35
+ ```sh
36
+ npm install -g plumbbob
37
+ ```
38
+
39
+ `plumbbob setup` copies the hooks to `~/.claude/plumbbob/hooks/` and the skills
40
+ to `~/.claude/skills/`, then registers the hooks in a Claude Code settings file.
41
+ The hooks and skills always install once under `~/.claude/`; the registration
42
+ scope is a sharing choice, not a behavior choice.
43
+
44
+ | Command | Registers in | Use for |
45
+ |----------------------------|--------------------------------------|--------------------------------------|
46
+ | `plumbbob setup` | `~/.claude/settings.json` | yourself, across every repo (default) |
47
+ | `plumbbob setup --project`| `<repo>/.claude/settings.json` | enrolling a whole team (committable) |
48
+ | `plumbbob setup --local` | `<repo>/.claude/settings.local.json` | yourself, this repo only (untracked) |
49
+
50
+ The repo-scoped files register `~`-prefixed command paths, so committed settings
51
+ carry no machine-absolute home directory — a teammate without Plumbbob installed
52
+ gets a non-blocking hook error, not a wall. `plumbbob setup --uninstall` strips
53
+ the registration (the installed files stay in place).
54
+
55
+ After installing, restart Claude Code (or reload settings) for the hooks to take
56
+ effect. The npm install puts `plumbbob` on your `PATH`, which the skills' status
57
+ pre-injection needs to resolve; from a dev checkout, alias it at the CLI entry
58
+ point instead:
59
+
60
+ ```sh
61
+ alias plumbbob='node /path/to/plumbbob/src/cli.ts'
62
+ ```
63
+
64
+ ## The verbs and skills
65
+
66
+ Mechanical verbs are the `plumbbob` CLI, run from your terminal. The judgment
67
+ work is skills, invoked from the chat pane. The split is judgment-vs-mechanism.
68
+
69
+ | Verb / skill | Does | Kind |
70
+ |----------------------------|------------------------------------------------------------------|---------------|
71
+ | `plumbbob start "<t>"` | scaffold `.plumbbob/`; `STATE=DESIGN`; record the baseline | CLI |
72
+ | `/plumbbob-interrogate` | `DESIGN`; attack the frame for holes; append to Open questions | skill (Opus) |
73
+ | `plumbbob build <n>` | write `SEAM` from step n; `STATE=BUILD` | CLI |
74
+ | `plumbbob review` | run the heavy check; if green → `STATE=REVIEW` | CLI |
75
+ | `plumbbob done` | ensure check green; checkpoint commit + record SHA; `STATE=DESIGN` | CLI |
76
+ | `plumbbob park "<text>"` | append a raw line to the park list; the model never sees it | CLI (dumb) |
77
+ | `/park` | compose one tidy tagged line, you approve, then it shells `park` | skill (Haiku) |
78
+ | `/plumbbob-triage` | `DESIGN`; classify the park list blocker/tangent/pivot | skill (Opus) |
79
+ | `plumbbob revert [--to n]`| `git reset --hard` to a checkpoint SHA; `STATE=DESIGN` | CLI |
80
+ | `plumbbob wrap` | `STATE=FINISH` so the report and docs skills can run | CLI |
81
+ | `/plumbbob-report` | `FINISH`; write `.plumbbob/report.md` from intent + log | skill (Opus) |
82
+ | `/plumbbob-docs` | `FINISH`; conservatively update `docs/` from canonical intent | skill (Opus) |
83
+ | `plumbbob finish` | refuse unless a report exists; archive; clear; muzzle off | CLI |
84
+ | `plumbbob spike "<slug>"` | throwaway worktree experiment per option; `spike done` tears down | CLI |
85
+ | `plumbbob mode <x>` | escape hatch: set `STATE` directly (not part of the normal flow) | CLI (hidden) |
86
+ | `plumbbob setup` | install hooks + skills; register them (D27 scopes above) | CLI |
87
+
88
+ In a Claude Code session the deciding/transition verbs refuse to run (they are
89
+ yours to type in a terminal); `status` and `park` are the deliberate exceptions.
90
+
91
+ ## The core / adapter boundary
92
+
93
+ The deciding/executing core — the `plumbbob` CLI, the `.plumbbob/` sidecar, and
94
+ the additive git footprint — is agent- and model-agnostic. Only the enforcement
95
+ layer (the hooks, the skills, the `CLAUDECODE` verb guard) is specific to Claude
96
+ Code, because enforcement inherently means intercepting some agent's edit tool.
97
+ Claude Code is v1's enforcement adapter; other-agent adapters over the same core
98
+ are a future Plumbbob, not a v1 obligation.
99
+
100
+ ## Ratified residual gaps
101
+
102
+ These are deliberate v1 boundaries, decided on the record, not oversights:
103
+
104
+ - **The archive is local-only.** `finish` lists the checkpoint SHAs in the report
105
+ and archives plain markdown under `.plumbbob/archive/`; it never touches git
106
+ (D20). The sidecar is kept untracked so a revert can never destroy captured
107
+ attention.
108
+ - **The muzzle is a fence, not a wall.** The Bash guard blocks the obvious
109
+ shell-write escape routes around the edit hooks, but full shell-write detection
110
+ is unsolvable; a determined model can still get around it (D21). The fence
111
+ raises the cost of crossing the boundary by accident, which is the job.
112
+ - **`tsc` is deferred to the heavy tier.** The light post-edit feedback runs
113
+ file-scoped oxlint + ast-grep only; `tsc` has no true single-file mode, so it
114
+ runs in the `pnpm check` gate inside `review`/`done` rather than per keystroke
115
+ (D25).
116
+
117
+ ## Development
118
+
119
+ ```sh
120
+ pnpm install
121
+ pnpm check # tsc, oxlint, ast-grep, vitest, knip, markdownlint
122
+ ```
123
+
124
+ **The pnpm pin.** `package.json` pins `devEngines.packageManager` to an *exact*
125
+ pnpm version (`11.1.2`) rather than a range, because the `^` range broke every
126
+ pnpm command at the time of writing. That exact pin will need bumping by hand on
127
+ the next pnpm upgrade; moving back to a ranged constraint is a future revisit.
128
+
129
+ `scripts/dev-install.sh` is the development installer: it registers the hooks
130
+ pointing at this working tree's `hooks/` (so hook edits take effect with no
131
+ re-copy), where `plumbbob setup` copies them into `~/.claude/`. Use
132
+ `dev-install.sh` while hacking on the hooks themselves; use `plumbbob setup` to
133
+ install Plumbbob for real.
134
+
135
+ ## License
136
+
137
+ Licensed under the [Apache License 2.0](LICENSE).
@@ -0,0 +1,58 @@
1
+ #!/bin/sh
2
+ # bash-guard.sh — Plumbbob's assistive fence (D21), not a wall. PreToolUse on
3
+ # Bash. Session-gated. Blocks shell commands that poke control state or write
4
+ # files outside BUILD/SPIKE, so the muzzle is not trivially bypassed. Full
5
+ # shell-write detection is unsolvable; the residual gap is accepted (D21).
6
+
7
+ find_root() {
8
+ d=$(pwd -P)
9
+ while [ -n "$d" ]; do
10
+ if [ -f "$d/.plumbbob/STATE" ]; then
11
+ printf '%s' "$d"
12
+ return 0
13
+ fi
14
+ [ "$d" = "/" ] && break
15
+ d=$(dirname "$d")
16
+ done
17
+ return 1
18
+ }
19
+
20
+ deny() {
21
+ printf 'plumbbob: %s\n' "$1" >&2
22
+ exit 2
23
+ }
24
+
25
+ root=$(find_root) || exit 0 # no session: allow
26
+
27
+ input=$(cat)
28
+ command=$(printf '%s' "$input" | jq -r '.tool_input.command // empty' 2>/dev/null)
29
+ [ -z "$command" ] && command=$(printf '%s' "$input" | sed -n 's/.*"command"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p' | head -n1)
30
+ [ -z "$command" ] && exit 0
31
+
32
+ state=$(tr -d '[:space:]' <"$root/.plumbbob/STATE" 2>/dev/null)
33
+
34
+ # Always: keep the model out of the control files and the escape hatch (D21).
35
+ case "$command" in
36
+ *.plumbbob/STATE* | *.plumbbob/SEAM*)
37
+ deny "blocked: do not touch .plumbbob/STATE or SEAM from the shell. Read state with \`plumbbob status\`; transitions are the human's verbs. Do not retry."
38
+ ;;
39
+ esac
40
+ case "$command" in
41
+ *"plumbbob mode"* | *"pb mode"* | *"plumbbob mode"*)
42
+ deny "blocked: \`plumbbob mode\` is the human's escape hatch, not a model action. Do not retry — ask the human."
43
+ ;;
44
+ esac
45
+
46
+ # Outside BUILD/SPIKE: block obvious file-writing shell patterns (D21).
47
+ case "$state" in
48
+ BUILD | SPIKE) ;;
49
+ *)
50
+ case "$command" in
51
+ *">"* | *"tee "* | *"sed -i"* | *"git apply"*)
52
+ deny "blocked: file-writing shell commands are not allowed in ${state:-?} (code edits happen in BUILD). Do not retry — park it or ask the human to \`plumbbob build <n>\`."
53
+ ;;
54
+ esac
55
+ ;;
56
+ esac
57
+
58
+ exit 0
@@ -0,0 +1,59 @@
1
+ #!/bin/sh
2
+ # post-edit.sh — light feedback (D25). PostToolUse, non-blocking, ALWAYS exits 0.
3
+ # Runs file-scoped oxlint + ast-grep on the changed file and injects any failures
4
+ # into the model's context via additionalContext (verified API, D3). No-ops when
5
+ # the tools are absent or there is no session. tsc is deferred to the heavy tier
6
+ # (D25): it has no true single-file mode and would tax every keystroke.
7
+
8
+ find_root() {
9
+ d=$(pwd -P)
10
+ while [ -n "$d" ]; do
11
+ if [ -f "$d/.plumbbob/STATE" ]; then
12
+ printf '%s' "$d"
13
+ return 0
14
+ fi
15
+ [ "$d" = "/" ] && break
16
+ d=$(dirname "$d")
17
+ done
18
+ return 1
19
+ }
20
+
21
+ root=$(find_root) || exit 0 # no session: no feedback
22
+
23
+ input=$(cat)
24
+ path=$(printf '%s' "$input" | jq -r '.tool_input.file_path // .tool_input.notebook_path // empty' 2>/dev/null)
25
+ [ -z "$path" ] && path=$(printf '%s' "$input" | sed -n 's/.*"file_path"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p' | head -n1)
26
+ [ -z "$path" ] && exit 0
27
+
28
+ case "$path" in
29
+ *.ts | *.tsx | *.js | *.jsx | *.mjs | *.cjs) ;;
30
+ *) exit 0 ;;
31
+ esac
32
+ [ -f "$path" ] || exit 0
33
+
34
+ bin="$root/node_modules/.bin"
35
+ out=""
36
+ if [ -x "$bin/oxlint" ]; then
37
+ o=$("$bin/oxlint" "$path" 2>&1) || out="${out}${o}
38
+ "
39
+ fi
40
+ if [ -x "$bin/ast-grep" ]; then
41
+ a=$("$bin/ast-grep" scan "$path" 2>&1) || out="${out}${a}
42
+ "
43
+ fi
44
+
45
+ # Drop ast-grep's cosmetic postinstall notice (parked at step 1).
46
+ out=$(printf '%s' "$out" | grep -v 'postinstall script did not run' | grep -v 'Enable postinstall to avoid')
47
+
48
+ if [ -n "$(printf '%s' "$out" | tr -d '[:space:]')" ]; then
49
+ ctx="Light check flagged $path:
50
+ $out"
51
+ if command -v jq >/dev/null 2>&1; then
52
+ jq -n --arg c "$ctx" '{hookSpecificOutput: {hookEventName: "PostToolUse", additionalContext: $c}}'
53
+ else
54
+ esc=$(printf '%s' "$ctx" | awk 'BEGIN{ORS="\\n"} {gsub(/\\/,"\\\\"); gsub(/"/,"\\\""); print}')
55
+ printf '{"hookSpecificOutput":{"hookEventName":"PostToolUse","additionalContext":"%s"}}\n' "$esc"
56
+ fi
57
+ fi
58
+
59
+ exit 0
@@ -0,0 +1,95 @@
1
+ #!/bin/sh
2
+ # pre-edit.sh — Plumbbob muzzle + seam-guard. PreToolUse on
3
+ # Edit|Write|MultiEdit|NotebookEdit. Session-gated: a repo with no .plumbbob/
4
+ # session behaves exactly like plain Claude Code (C7). The dormant check is pure
5
+ # sh (test -f) before any JSON parsing, so a no-session edit pays ~nothing (C3).
6
+ # Built from the verified hooks API (D3): input is JSON on stdin
7
+ # (tool_input.file_path / notebook_path, absolute); deny is exit 2 + stderr.
8
+
9
+ # Walk up from the hook's physical cwd to the session root, like git finds .git.
10
+ find_root() {
11
+ d=$(pwd -P)
12
+ while [ -n "$d" ]; do
13
+ if [ -f "$d/.plumbbob/STATE" ]; then
14
+ printf '%s' "$d"
15
+ return 0
16
+ fi
17
+ [ "$d" = "/" ] && break
18
+ d=$(dirname "$d")
19
+ done
20
+ return 1
21
+ }
22
+
23
+ # Seam membership (D23): exact whole-line match, or a `dir/` line by prefix.
24
+ in_seam() {
25
+ _rel=$1
26
+ _seam=$2
27
+ [ -f "$_seam" ] || return 1
28
+ grep -qFx "$_rel" "$_seam" && return 0
29
+ while IFS= read -r _line || [ -n "$_line" ]; do
30
+ case "$_line" in
31
+ */)
32
+ case "$_rel" in
33
+ "$_line"*) return 0 ;;
34
+ esac
35
+ ;;
36
+ esac
37
+ done <"$_seam"
38
+ return 1
39
+ }
40
+
41
+ deny() {
42
+ printf 'plumbbob: %s\n' "$1" >&2
43
+ exit 2
44
+ }
45
+
46
+ root=$(find_root) || exit 0 # no session anywhere above cwd: allow
47
+
48
+ input=$(cat)
49
+ path=$(printf '%s' "$input" | jq -r '.tool_input.file_path // .tool_input.notebook_path // empty' 2>/dev/null)
50
+ if [ -z "$path" ]; then
51
+ path=$(printf '%s' "$input" | sed -n 's/.*"file_path"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p' | head -n1)
52
+ [ -z "$path" ] && path=$(printf '%s' "$input" | sed -n 's/.*"notebook_path"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p' | head -n1)
53
+ fi
54
+ [ -z "$path" ] && exit 0 # nothing to guard: allow
55
+
56
+ state=$(tr -d '[:space:]' <"$root/.plumbbob/STATE" 2>/dev/null)
57
+
58
+ # Canonicalize the absolute tool path to repo-relative (D4).
59
+ case "$path" in
60
+ "$root"/*) rel=${path#"$root"/} ;;
61
+ *) rel=$path ;;
62
+ esac
63
+
64
+ # 1. The archive is read-only history — never writable (D6/D19).
65
+ case "$rel" in
66
+ .plumbbob/archive/*)
67
+ deny "blocked: $rel is archived history (read-only). Do not retry."
68
+ ;;
69
+ esac
70
+
71
+ # 2. The three control docs are writable in every state, so DESIGN and FINISH can
72
+ # do their work. Anchored exact paths — never a bare */intent.md suffix (D6).
73
+ case "$rel" in
74
+ .plumbbob/intent.md | .plumbbob/build-log.md | .plumbbob/report.md)
75
+ exit 0
76
+ ;;
77
+ esac
78
+
79
+ # 3. docs/ is writable only in FINISH (D19).
80
+ case "$rel" in
81
+ docs/*)
82
+ [ "$state" = "FINISH" ] && exit 0
83
+ deny "blocked: $rel (docs/) is writable only in FINISH — docs are projected at the end. Do not retry; park it or finish the build first."
84
+ ;;
85
+ esac
86
+
87
+ # 4. Everything else is code: allowed only in BUILD, confined to the SEAM (D23).
88
+ # SPIKE locks the main tree like DESIGN (D18) — spike edits live in dormant
89
+ # worktrees, so the muzzle never needs to allow SPIKE here.
90
+ if [ "$state" = "BUILD" ]; then
91
+ in_seam "$rel" "$root/.plumbbob/SEAM" && exit 0
92
+ deny "blocked: $rel is outside the seam for this step. Do not retry — park it (\`plumbbob park\`), or ask the human to revise the step's seam in intent.md and re-run \`plumbbob build <n>\`."
93
+ fi
94
+
95
+ deny "blocked: code edits are not allowed in ${state:-?} (they happen in BUILD). Do not retry — if this needs doing it's a decision: park it (\`plumbbob park\`) or ask the human to \`plumbbob build <n>\`."
package/package.json ADDED
@@ -0,0 +1,60 @@
1
+ {
2
+ "name": "plumbbob",
3
+ "version": "0.1.3",
4
+ "description": "Attention-first build process: a CLI + hooks that enforce the deciding/executing boundary.",
5
+ "keywords": [
6
+ "claude-code",
7
+ "claude",
8
+ "hooks",
9
+ "cli",
10
+ "agent",
11
+ "attention-first"
12
+ ],
13
+ "homepage": "https://github.com/robmclarty/plumbbob#readme",
14
+ "bugs": "https://github.com/robmclarty/plumbbob/issues",
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "git+https://github.com/robmclarty/plumbbob.git"
18
+ },
19
+ "type": "module",
20
+ "license": "Apache-2.0",
21
+ "author": "Rob McLarty <hello@robmclarty.com>",
22
+ "bin": {
23
+ "plumbbob": "src/cli.ts",
24
+ "pb": "src/cli.ts"
25
+ },
26
+ "files": [
27
+ "src",
28
+ "hooks",
29
+ "skills",
30
+ "templates"
31
+ ],
32
+ "engines": {
33
+ "node": ">=22.18.0"
34
+ },
35
+ "devEngines": {
36
+ "packageManager": {
37
+ "name": "pnpm",
38
+ "version": "11.1.2",
39
+ "onFail": "download"
40
+ }
41
+ },
42
+ "devDependencies": {
43
+ "@ast-grep/cli": "^0.43.0",
44
+ "@types/node": "^24.0.0",
45
+ "knip": "^6.16.1",
46
+ "markdownlint-cli": "^0.48.0",
47
+ "oxlint": "^1.69.0",
48
+ "typescript": "^6.0.3",
49
+ "vitest": "^4.1.8"
50
+ },
51
+ "scripts": {
52
+ "check": "pnpm run check:tsc && pnpm run check:oxlint && pnpm run check:astgrep && pnpm run check:test && pnpm run check:knip && pnpm run check:md",
53
+ "check:tsc": "tsc --noEmit",
54
+ "check:oxlint": "oxlint",
55
+ "check:astgrep": "ast-grep scan",
56
+ "check:test": "vitest run",
57
+ "check:knip": "knip",
58
+ "check:md": "markdownlint --config .markdownlint.jsonc \"**/*.md\" --ignore node_modules"
59
+ }
60
+ }
@@ -0,0 +1,26 @@
1
+ ---
2
+ name: park
3
+ description: Compose one tidy tagged park line, get the human's OK in-turn, then capture it by shelling `plumbbob park` — never by editing a file.
4
+ disable-model-invocation: true
5
+ model: haiku
6
+ allowed-tools: Bash(plumbbob status:*), Bash(plumbbob park:*)
7
+ ---
8
+
9
+ # Park
10
+
11
+ Current session state (injected when this skill runs): !`plumbbob status`
12
+
13
+ ## Wrong-state refusal
14
+
15
+ Parking needs an **active session** to capture into. Read the state injected above: if it is `NO ACTIVE SESSION`, **refuse** and tell the human to run `plumbbob start "<title>"` first. Every active state (`DESIGN`, `BUILD`, `REVIEW`, `SPIKE`, `FINISH`) is fine — capture is always available, which is the whole point of parking.
16
+
17
+ ## What this skill does
18
+
19
+ Take the idea, problem, or "ooh what if" the human just had and **compose it into one tidy, tagged line** — short, legible, self-contained, so it still reads cleanly weeks later. Then:
20
+
21
+ 1. **Show the composed line to the human** and wait for **in-turn approval** — they confirm it as-is or edit the wording.
22
+ 2. **Only after** that approval, capture it by running `plumbbob park "<the approved line>"` via Bash.
23
+
24
+ ## The one hard contract
25
+
26
+ The capture itself is the **dumb CLI**, never an edit. This skill carries **no Edit and no Write tool** on purpose (D12): you may not append to `build-log.md` yourself. Compose, get approval, then shell `plumbbob park` — that is the only write path. If approval never comes, capture nothing.
@@ -0,0 +1,25 @@
1
+ ---
2
+ name: plumbbob-docs
3
+ description: FINISH-phase, optional docs update — conservatively project canonical intent into real docs/, only when warranted.
4
+ disable-model-invocation: true
5
+ model: opus
6
+ allowed-tools: Read, Edit, Write, Bash(plumbbob status:*)
7
+ ---
8
+
9
+ # Plumbbob — update the docs
10
+
11
+ Current session state (injected when this skill runs): !`plumbbob status`
12
+
13
+ ## Wrong-state refusal
14
+
15
+ `docs/` is writable **only in FINISH** (D19) — the muzzle blocks it everywhere else. Read the state injected above and **refuse if it is not `FINISH`**, naming `plumbbob wrap` as the verb that enters FINISH (the report skill runs first; this docs pass is the optional second Finish step). If the state is `NO ACTIVE SESSION` the hooks are dormant and there is nothing for this skill to gate — just edit docs the ordinary way.
16
+
17
+ ## What this skill does
18
+
19
+ **Conservative by default.** Most sessions write no docs at all — **a bug fix usually shouldn't spawn a doc**. Update real documentation under `docs/` only when the work genuinely changed how the system should be described, and only from the **canonical** parts of `intent.md` (the Frame, the Decisions) — never from the chat transcript.
20
+
21
+ ## The one hard contract
22
+
23
+ - Default to doing nothing. Open a doc edit only when you can name what changed for a reader of `docs/`.
24
+ - Project only from `intent.md`; the report is for the session, the docs are for the system.
25
+ - Stay inside `docs/` — and only in FINISH. An edit anywhere else, or in any other state, is the muzzle's job to refuse, not yours to attempt.