clawstrap 1.2.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 (4) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +374 -0
  3. package/dist/index.cjs +1222 -0
  4. package/package.json +57 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Giuseppe Pace
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,374 @@
1
+
2
+ ```
3
+ ██████╗██╗ █████╗ ██╗ ██╗███████╗████████╗██████╗ █████╗ ██████╗
4
+ ██╔════╝██║ ██╔══██╗██║ ██║██╔════╝╚══██╔══╝██╔══██╗██╔══██╗██╔══██╗
5
+ ██║ ██║ ███████║██║ █╗ ██║███████╗ ██║ ██████╔╝███████║██████╔╝
6
+ ██║ ██║ ██╔══██║██║███╗██║╚════██║ ██║ ██╔══██╗██╔══██║██╔═══╝
7
+ ╚██████╗███████╗██║ ██║╚███╔███╔╝███████║ ██║ ██║ ██║██║ ██║██║
8
+ ╚═════╝╚══════╝╚═╝ ╚═╝ ╚══╝╚══╝ ╚══════╝ ╚═╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝
9
+ ```
10
+
11
+ ### Scaffold a production-ready AI agent workspace in under 2 minutes.
12
+
13
+ ![npm](https://img.shields.io/npm/v/clawstrap)
14
+ ![License](https://img.shields.io/badge/license-MIT-blue)
15
+ ![Node](https://img.shields.io/badge/node-%3E%3D18-brightgreen)
16
+ ![Built for](https://img.shields.io/badge/built%20for-Claude%20Code-blueviolet)
17
+
18
+ Most AI agent systems fail not because the models are bad, but because there's no foundation underneath them. Sessions die. Context vanishes between runs. Agents drift without guardrails. Quality degrades silently mid-batch. Clawstrap generates a complete, opinionated workspace that solves all of this before you write your first prompt.
19
+
20
+ ## Quick Start
21
+
22
+ ```bash
23
+ npx clawstrap init
24
+ ```
25
+
26
+ ```
27
+ $ npx clawstrap init
28
+
29
+ Welcome to Clawstrap 🔨
30
+ Scaffold a production-ready AI agent workspace.
31
+
32
+ ? Workspace name: my-project
33
+
34
+ ? What kind of work will this workspace handle?
35
+ ● Research & analysis pipeline
36
+ ○ Content & writing system
37
+ ○ Data processing workflow
38
+ ○ Custom / general purpose
39
+
40
+ ? How many AI agents will work in parallel?
41
+ ● Just me — single agent
42
+ ○ Small team — 2 to 5 agents
43
+ ○ Production — 5+ agents, orchestrator pattern
44
+
45
+ ? What quality controls do you need?
46
+ ○ Solo — lightweight checks, fast iteration
47
+ ● Team — structured QC gates, review steps
48
+ ○ Production — full QC pipeline, batch monitoring
49
+
50
+ ? Enable session handoff checklists? (for multi-session work) Yes
51
+
52
+ Configuration:
53
+ Workspace: my-project
54
+ Workload: Research & Analysis
55
+ Parallel agents: single
56
+ Quality level: team
57
+ Session handoff: yes
58
+
59
+ Generating your workspace...
60
+
61
+ ✓ CLAUDE.md
62
+ ✓ GETTING_STARTED.md
63
+ ✓ .gitignore
64
+ ✓ .claude/rules/context-discipline.md
65
+ ✓ .claude/rules/approval-first.md
66
+ ✓ .claude/rules/quality-gates.md
67
+ ✓ .claude/skills/SKILL_REGISTRY.md
68
+ ✓ .claude/gotcha-log.md
69
+ ✓ .claude/future-considerations.md
70
+ ✓ projects/_template/process.md
71
+ ✓ projects/_template/README.md
72
+ ✓ .claude/memory/MEMORY.md
73
+ ✓ .clawstrap.json
74
+ ✓ tmp/
75
+ ✓ research/
76
+ ✓ context/
77
+ ✓ artifacts/
78
+
79
+ Done. Open GETTING_STARTED.md to begin.
80
+ ```
81
+
82
+ That's it. Your workspace is ready. Open `GETTING_STARTED.md` and start your first session.
83
+
84
+ ## What You Get
85
+
86
+ The generated workspace adapts to your answers. Here's the full structure with everything enabled:
87
+
88
+ ```
89
+ my-project/
90
+ ├── CLAUDE.md # Master governance — loaded every session
91
+ ├── GETTING_STARTED.md # Your first session guide
92
+ ├── .gitignore # Secrets and tmp excluded
93
+ ├── .clawstrap.json # Your workspace configuration
94
+ ├── .claude/
95
+ │ ├── rules/
96
+ │ │ ├── context-discipline.md # Flush cadence, thin orchestrator pattern
97
+ │ │ ├── approval-first.md # Plan → approve → execute
98
+ │ │ └── quality-gates.md # QC as structural gate (team/production only)
99
+ │ ├── agents/ # (multi-agent workspaces only)
100
+ │ │ ├── primary-agent.md # Main orchestrator definition
101
+ │ │ └── _template.md # Template for new subagents
102
+ │ ├── skills/
103
+ │ │ └── SKILL_REGISTRY.md # Skill index
104
+ │ ├── memory/
105
+ │ │ └── MEMORY.md # Cross-session memory (session handoff only)
106
+ │ ├── subagent-bootstrap.md # Lightweight ad-hoc governance (multi-agent only)
107
+ │ ├── gotcha-log.md # Incident tracking — why rules exist
108
+ │ └── future-considerations.md # Deferred ideas parking lot
109
+ ├── projects/
110
+ │ └── _template/
111
+ │ ├── README.md # Project metadata template
112
+ │ └── process.md # Workflow and session checklist template
113
+ ├── tmp/ # Gitignored session workspace
114
+ ├── research/ # Reference material
115
+ ├── context/ # Session checkpoints
116
+ └── artifacts/ # Durable output
117
+ ```
118
+
119
+ Solo single-agent workspaces get a leaner structure — no agent definitions, no quality-gates rule file, no memory directory. The workspace scales with your needs.
120
+
121
+ ## See the Difference
122
+
123
+ ### Session continuity
124
+
125
+ **Without Clawstrap** — new day, new session, zero context:
126
+
127
+ ```
128
+ You: Continue working on the API migration.
129
+ Claude: I don't have context about an API migration. Could you explain
130
+ what you're working on, what's been done so far, and what the
131
+ next steps are?
132
+ You: (spends 10 minutes re-explaining everything)
133
+ ```
134
+
135
+ **With Clawstrap** — Claude reads `CLAUDE.md` and your progress automatically:
136
+
137
+ ```
138
+ You: Continue working on the API migration.
139
+ Claude: Reading progress tracker... Last session completed endpoints for
140
+ /users and /products. Next step from the plan: implement /orders
141
+ endpoint with pagination. The execution plan is in
142
+ tmp/api-migration/plan.md. Ready to proceed?
143
+ ```
144
+
145
+ ### Quality during batch work
146
+
147
+ **Without Clawstrap** — process everything, discover problems at the end:
148
+
149
+ ```
150
+ You: Extract data from these 50 supplier files.
151
+ Claude: Done! Here are all 50 results.
152
+ You: (reviews results, finds item #12 has wrong field mapping)
153
+ You: The mapping was wrong. Redo all 50.
154
+ ```
155
+
156
+ **With Clawstrap** — quality gates catch it early:
157
+
158
+ ```
159
+ You: Extract data from these 50 supplier files.
160
+ Claude: Processing batch. QC checkpoint at item #5 — reviewing most
161
+ complex item... Item #3 looks correct. Continuing.
162
+ QC checkpoint at item #10 — reviewing item #8...
163
+ ⚠ Item #12: field mapping mismatch. Confidence below threshold.
164
+ Stopping to fix before continuing. Only 7 items to redo.
165
+ ```
166
+
167
+ ### Subagent context control
168
+
169
+ **Without Clawstrap** — subagent dumps everything into the conversation:
170
+
171
+ ```
172
+ You: Research the top 20 competitors and their pricing.
173
+ Claude: (spawns subagent, which returns 200 lines of raw data)
174
+ Here's everything I found: [wall of text fills context window]
175
+ You: Now use that to write the report.
176
+ Claude: I'm having trouble — my context is very long. Could you
177
+ remind me what the report should cover?
178
+ ```
179
+
180
+ **With Clawstrap** — subagents write to files, return receipts:
181
+
182
+ ```
183
+ You: Research the top 20 competitors and their pricing.
184
+ Claude: Launching research subagent...
185
+ Subagent: "Done. 20 items. File: tmp/research/competitors.json.
186
+ Summary: 20 competitors with pricing tiers, 3 flagged as
187
+ low-confidence."
188
+ Claude: Research complete. Reading the 3 low-confidence entries for
189
+ review before proceeding to the report.
190
+ ```
191
+
192
+ ## Working with Your Workspace
193
+
194
+ ### Starting a session
195
+
196
+ Open Claude Code inside your Clawstrap workspace. That's it.
197
+
198
+ ```bash
199
+ cd my-project
200
+ claude
201
+ ```
202
+
203
+ Claude automatically reads `CLAUDE.md` and every file in `.claude/rules/`. The governance is active from the first message. You don't configure anything, install plugins, or write system prompts.
204
+
205
+ ### Giving a task
206
+
207
+ Just describe what you want. The governance changes how Claude responds — it plans first, then asks for approval before executing.
208
+
209
+ ```
210
+ You: Build a REST API for user authentication with JWT tokens.
211
+
212
+ Claude: Here's my plan:
213
+
214
+ 1. Create auth module with login/register endpoints
215
+ 2. JWT token generation and validation middleware
216
+ 3. Password hashing with bcrypt
217
+ 4. Protected route middleware
218
+ 5. Unit tests for all auth flows
219
+
220
+ Shall I proceed with this plan?
221
+
222
+ You: Yes, go ahead.
223
+
224
+ Claude: Starting implementation...
225
+ ```
226
+
227
+ Without Clawstrap, Claude would start writing code immediately. With it, the approval-first rule fires — you always see the plan before anything happens.
228
+
229
+ ### Ending and resuming sessions
230
+
231
+ When you're done for the day, tell Claude to wrap up. The session handoff checklist runs automatically:
232
+
233
+ ```
234
+ You: Let's wrap up for today.
235
+
236
+ Claude: Running session handoff checklist:
237
+ ✓ Saved all work to SSOT files
238
+ ✓ Updated README.md status: "Last done: auth endpoints, Next: add rate limiting"
239
+ ✓ Wrote next-session plan to tmp/auth/plan.md
240
+ ✓ QC check: all endpoints return correct status codes
241
+
242
+ Next session: start with rate limiting middleware.
243
+ Plan file: tmp/auth/plan.md
244
+ ```
245
+
246
+ Tomorrow, open Claude Code in the same directory. It reads `CLAUDE.md`, sees the plan file, and picks up:
247
+
248
+ ```
249
+ You: Let's continue.
250
+
251
+ Claude: Reading session plan from tmp/auth/plan.md...
252
+ Last session completed: login, register, JWT middleware.
253
+ Next: rate limiting middleware. Starting there.
254
+ ```
255
+
256
+ ### Delegating to subagents
257
+
258
+ When a task needs parallel work, tell Claude to delegate. The governance rules ensure subagents stay disciplined:
259
+
260
+ ```
261
+ You: I need to analyze 3 competitor APIs. Delegate this to a subagent.
262
+
263
+ Claude: Launching research subagent with governance rules:
264
+ - Output goes to tmp/competitor-analysis/results.json
265
+ - One-line receipt on completion
266
+ - No raw data returned to this conversation
267
+
268
+ Subagent: "Done. 3 items. File: tmp/competitor-analysis/results.json.
269
+ Summary: 3 APIs analyzed, 2 use REST + JWT, 1 uses GraphQL."
270
+
271
+ Results written to file. Want me to read the findings and
272
+ summarize, or proceed to the comparison report?
273
+ ```
274
+
275
+ The main session never holds the raw subagent output. Context stays clean.
276
+
277
+ ### When Claude makes a mistake
278
+
279
+ Tell Claude to correct course. The correction gets persisted before being applied — so the learning survives even if the session ends:
280
+
281
+ ```
282
+ You: Don't use var for variable declarations. Always use const or let.
283
+
284
+ Claude: Writing correction to .claude/rules/context-discipline.md...
285
+ ✓ Rule added: "Use const/let, never var"
286
+ Now applying to current code...
287
+ ```
288
+
289
+ The correction is saved to a durable rule file first, then applied. Next session, Claude follows the same rule without you repeating it.
290
+
291
+ ## The Five Principles
292
+
293
+ ### 1. File-First Persistence
294
+
295
+ If it's not on disk, it didn't happen. Every finding, decision, and correction gets written to a durable location immediately — not at session end. Sessions are disposable. The work isn't.
296
+
297
+ ### 2. Approval-First Workflow
298
+
299
+ Plan. Approve. Execute. In that order, every time. No agent acts without human sign-off. If scope changes mid-task, the agent stops and re-confirms. You stay in control.
300
+
301
+ ### 3. Quality as a Structural Gate
302
+
303
+ Validation isn't optional — it's built into the workflow. Checkpoint every 5 outputs. Grade below B means stop, don't continue. Quality failures caught late cost 100% rework. Catch them early.
304
+
305
+ ### 4. Governed Subagents
306
+
307
+ Every subagent gets a full definition: tools it can use, output schema, step-by-step procedure, and governance rules. No agent runs ungoverned. No "figure it out" prompts. Predictable agents ship reliable work.
308
+
309
+ ### 5. Binary Decision Architecture
310
+
311
+ Complex decisions decomposed into sequential binary choices. One question at a time. Yes or no. This or that. Ambiguity kills reliability — binary decisions eliminate it.
312
+
313
+ ## Why Clawstrap Exists
314
+
315
+ Built from real failures, not theory. After months of running AI agent workflows, the same problems kept killing projects: context lost between sessions with no recovery path, agents drifting into unsupervised work that had to be thrown away, and quality collapsing silently mid-batch because nobody was checking.
316
+
317
+ Every rule in a Clawstrap workspace exists because something went wrong without it. The governance isn't theoretical — it's scar tissue encoded as structure.
318
+
319
+ ## Commands
320
+
321
+ ```
322
+ clawstrap init [directory] Scaffold a new workspace (interactive)
323
+ clawstrap init [directory] --yes Use defaults, skip prompts
324
+ clawstrap add agent <name> Add a new agent definition
325
+ clawstrap add skill <name> Add a new skill with SKILL.md
326
+ clawstrap add project <name> Add a new project with README + process.md
327
+ clawstrap status Show workspace configuration and structure
328
+ clawstrap export --format paperclip Export workspace as Paperclip company template
329
+ ```
330
+
331
+ ## Export to Paperclip
332
+
333
+ Translate your Clawstrap workspace into a [Paperclip](https://github.com/paperclipai/paperclip) company template. Agents, governance rules, skills, and projects are mapped to Paperclip's format automatically.
334
+
335
+ ```bash
336
+ clawstrap export --format paperclip --name "My Company" --mission "Ship reliable AI"
337
+ ```
338
+
339
+ Generates a directory with `paperclip.manifest.json`, agent definitions with frontmatter, governance rules, and a one-command `import.sh` for Paperclip import. No running Paperclip instance required — it's a pure file transformation.
340
+
341
+ | Flag | Description |
342
+ |------|-------------|
343
+ | `--format`, `-f` | Export format (required, currently: `paperclip`) |
344
+ | `--out`, `-o` | Output directory (default: `{workspace}-paperclip/`) |
345
+ | `--name`, `-n` | Company name |
346
+ | `--mission`, `-m` | Company mission statement |
347
+ | `--adapter`, `-a` | Agent adapter type (default: `claude_local`) |
348
+
349
+ ## Flags
350
+
351
+ | Flag | Description |
352
+ |------|-------------|
353
+ | `--yes`, `-y` | Skip prompts, use sensible defaults (init only) |
354
+ | `--version` | Show version |
355
+ | `--help` | Show help |
356
+
357
+ ## Roadmap
358
+
359
+ | Version | Status | What |
360
+ |---------|--------|------|
361
+ | **v1.0** | Done | `init` command, 4 workspace profiles, full governance templates, `--yes` mode |
362
+ | **v1.1** | Done | `add agent`, `add skill`, `add project`, `status` commands |
363
+ | **v1.2** | **Now** | `export --format paperclip` — Paperclip company template export |
364
+ | **v2.0** | Planned | Multi-model support, `upgrade` command, ClipMart publishing |
365
+
366
+ ## Contributing
367
+
368
+ PRs welcome. Issues welcome. Stars appreciated.
369
+
370
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines. If you've hit a failure mode that Clawstrap doesn't handle yet, open an issue — those are the most valuable contributions.
371
+
372
+ ## License
373
+
374
+ [MIT](LICENSE)