clawstrap 1.3.0 → 1.4.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.
- package/README.md +168 -124
- package/dist/index.cjs +1057 -60
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -8,14 +8,21 @@
|
|
|
8
8
|
╚═════╝╚══════╝╚═╝ ╚═╝ ╚══╝╚══╝ ╚══════╝ ╚═╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
### Scaffold a production-ready AI agent workspace
|
|
11
|
+
### Scaffold a production-ready AI agent workspace — then keep it sharp automatically.
|
|
12
12
|
|
|
13
13
|

|
|
14
14
|

|
|
15
15
|

|
|
16
|
-

|
|
17
|
+

|
|
17
18
|
|
|
18
|
-
|
|
19
|
+
## What Is Clawstrap
|
|
20
|
+
|
|
21
|
+
Clawstrap scaffolds a complete, opinionated AI agent workspace in under 2 minutes. Run `npx clawstrap init`, answer five questions, and you get a governance-first directory: a `CLAUDE.md` master rules file loaded every session, approval-first workflow rules, quality gates, cross-session memory, subagent definitions, and a spec template — all wired together before you write your first prompt. Sessions no longer die without context. Agents no longer drift without guardrails.
|
|
22
|
+
|
|
23
|
+
The watch daemon takes it further. Run `clawstrap watch` once and it stays alive in the background, doing three things automatically: processing session summaries from `tmp/sessions/` through an LLM adapter to extract decisions, corrections, and deferred ideas — writing them to `MEMORY.md` and `gotcha-log.md`; mining your git history for co-changing file pairs, high-churn directories, and recurring commit patterns; and scanning your codebase on a configurable schedule to maintain `.claude/rules/conventions.md` with live naming, import, and error-handling patterns. Your workspace gets more accurate over time without any manual work.
|
|
24
|
+
|
|
25
|
+
Most AI workspace tools generate files and stop. Clawstrap keeps going.
|
|
19
26
|
|
|
20
27
|
## Quick Start
|
|
21
28
|
|
|
@@ -84,6 +91,11 @@ Done. Open GETTING_STARTED.md to begin.
|
|
|
84
91
|
|
|
85
92
|
That's it. Your workspace is ready. Open `GETTING_STARTED.md` and start your first session.
|
|
86
93
|
|
|
94
|
+
```bash
|
|
95
|
+
# Then start the adaptive memory daemon:
|
|
96
|
+
clawstrap watch
|
|
97
|
+
```
|
|
98
|
+
|
|
87
99
|
## What You Get
|
|
88
100
|
|
|
89
101
|
The generated workspace adapts to your answers. Here's the full structure with everything enabled:
|
|
@@ -98,7 +110,8 @@ my-project/
|
|
|
98
110
|
│ ├── rules/
|
|
99
111
|
│ │ ├── context-discipline.md # Flush cadence, thin orchestrator pattern
|
|
100
112
|
│ │ ├── approval-first.md # Plan → approve → execute
|
|
101
|
-
│ │
|
|
113
|
+
│ │ ├── quality-gates.md # QC as structural gate (team/production only)
|
|
114
|
+
│ │ └── conventions.md # Auto-generated by clawstrap analyze (watch only)
|
|
102
115
|
│ ├── agents/ # (multi-agent workspaces only)
|
|
103
116
|
│ │ ├── primary-agent.md # Main orchestrator definition
|
|
104
117
|
│ │ └── _template.md # Template for new subagents
|
|
@@ -118,12 +131,13 @@ my-project/
|
|
|
118
131
|
├── specs/
|
|
119
132
|
│ └── _template.md # Spec template (SDD only)
|
|
120
133
|
├── tmp/ # Gitignored session workspace
|
|
134
|
+
│ └── sessions/ # Session summaries processed by watch daemon
|
|
121
135
|
├── research/ # Reference material
|
|
122
136
|
├── context/ # Session checkpoints
|
|
123
137
|
└── artifacts/ # Durable output
|
|
124
138
|
```
|
|
125
139
|
|
|
126
|
-
Solo single-agent workspaces get a leaner structure — no agent definitions, no quality-gates rule file, no memory directory. The
|
|
140
|
+
Solo single-agent workspaces get a leaner structure — no agent definitions, no quality-gates rule file, no memory directory. The watch daemon works with any configuration.
|
|
127
141
|
|
|
128
142
|
## See the Difference
|
|
129
143
|
|
|
@@ -149,26 +163,31 @@ Claude: Reading progress tracker... Last session completed endpoints for
|
|
|
149
163
|
tmp/api-migration/plan.md. Ready to proceed?
|
|
150
164
|
```
|
|
151
165
|
|
|
152
|
-
###
|
|
166
|
+
### Living memory across sessions
|
|
153
167
|
|
|
154
|
-
|
|
168
|
+
Without Clawstrap watch — corrections evaporate:
|
|
155
169
|
|
|
156
170
|
```
|
|
157
|
-
You:
|
|
158
|
-
Claude:
|
|
159
|
-
|
|
160
|
-
You:
|
|
171
|
+
You (session 2): Stop using var. We use const and let everywhere.
|
|
172
|
+
Claude: Got it, fixing now...
|
|
173
|
+
|
|
174
|
+
You (session 3): Why are you using var again?
|
|
175
|
+
Claude: I apologize — I don't have context from last session.
|
|
176
|
+
You: (explains again)
|
|
161
177
|
```
|
|
162
178
|
|
|
163
|
-
|
|
179
|
+
With Clawstrap watch — corrections survive automatically:
|
|
164
180
|
|
|
165
181
|
```
|
|
166
|
-
You:
|
|
167
|
-
Claude:
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
182
|
+
You (session 2): Stop using var. We use const and let everywhere.
|
|
183
|
+
Claude: Understood. Writing session summary to tmp/sessions/...
|
|
184
|
+
|
|
185
|
+
[watch daemon detects new summary, extracts the correction,
|
|
186
|
+
appends to .claude/gotcha-log.md]
|
|
187
|
+
|
|
188
|
+
You (session 3): Continue the refactor.
|
|
189
|
+
Claude: Reading gotcha-log.md... Noted: use const/let, avoid var.
|
|
190
|
+
Continuing with that convention.
|
|
172
191
|
```
|
|
173
192
|
|
|
174
193
|
### Subagent context control
|
|
@@ -196,6 +215,116 @@ Claude: Research complete. Reading the 3 low-confidence entries for
|
|
|
196
215
|
review before proceeding to the report.
|
|
197
216
|
```
|
|
198
217
|
|
|
218
|
+
## The Watch Daemon
|
|
219
|
+
|
|
220
|
+
The watch daemon is a background process that keeps your workspace's memory current without any manual work. It runs as a detached subprocess after `clawstrap watch`, survives terminal closes, and orchestrates three subsystems continuously.
|
|
221
|
+
|
|
222
|
+
**Transcript processor** — watches `tmp/sessions/` for new `.md` session summaries; when one appears, sends it to your configured LLM adapter, extracts decisions, corrections, and deferred ideas as structured JSON, and appends them to `MEMORY.md`, `gotcha-log.md`, and `future-considerations.md` respectively.
|
|
223
|
+
|
|
224
|
+
**Git observer** — on first run, reads your full commit history; on subsequent runs, reads only commits since the last processed SHA; extracts co-changing file pairs, high-churn directories, and recurring themes from commit messages; writes findings to `MEMORY.md`.
|
|
225
|
+
|
|
226
|
+
**Convention scanner** — walks the codebase on a configurable interval (default: weekly) and maintains `.claude/rules/conventions.md` with detected naming conventions, import style, test patterns, error handling approach, and comment density; preserves any sections you have manually edited.
|
|
227
|
+
|
|
228
|
+
```bash
|
|
229
|
+
clawstrap watch # Start daemon (detached, persists after terminal closes)
|
|
230
|
+
clawstrap watch --once # Run all observers once and exit
|
|
231
|
+
clawstrap watch --stop # Stop the running daemon
|
|
232
|
+
clawstrap analyze # Run convention scan immediately
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
The daemon uses an LLM to process session transcripts. Four adapters are available:
|
|
236
|
+
|
|
237
|
+
| Adapter | Requires | Notes |
|
|
238
|
+
|---------|----------|-------|
|
|
239
|
+
| `claude-local` (default) | Claude Code CLI | Uses your existing subscription, no API cost |
|
|
240
|
+
| `claude-api` | `ANTHROPIC_API_KEY` | Uses claude-haiku by default, configurable |
|
|
241
|
+
| `ollama` | Ollama running locally | Fully offline/air-gapped |
|
|
242
|
+
| `codex-local` | OpenAI Codex CLI | Uses your existing Codex setup |
|
|
243
|
+
|
|
244
|
+
Configure in `.clawstrap.json`:
|
|
245
|
+
|
|
246
|
+
```json
|
|
247
|
+
{
|
|
248
|
+
"watch": {
|
|
249
|
+
"adapter": "claude-local",
|
|
250
|
+
"scan": { "intervalDays": 7 },
|
|
251
|
+
"silent": false
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
The daemon causes zero disruption to Claude Code sessions. It runs as a detached background process and only writes to files already managed by Clawstrap.
|
|
257
|
+
|
|
258
|
+
## Spec-Driven Development
|
|
259
|
+
|
|
260
|
+
Enable SDD mode to enforce a spec-first workflow. Before Claude implements anything, it writes a structured spec, saves it to `specs/{name}.md`, and gets your explicit approval.
|
|
261
|
+
|
|
262
|
+
```bash
|
|
263
|
+
npx clawstrap init --sdd
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
What you get:
|
|
267
|
+
|
|
268
|
+
- **`specs/_template.md`** — reusable spec format with problem statement, acceptance criteria, technical constraints, out-of-scope, and implementation notes
|
|
269
|
+
- **`.claude/rules/sdd.md`** — governance rule Claude loads every session: "Never implement from a vague prompt"
|
|
270
|
+
- **`.claude/commands/spec.md`** — `/spec` slash command that walks Claude through writing, saving, and presenting a spec for approval
|
|
271
|
+
|
|
272
|
+
In practice:
|
|
273
|
+
|
|
274
|
+
```
|
|
275
|
+
You: Build a CSV export for the orders table.
|
|
276
|
+
|
|
277
|
+
Claude: Writing spec to specs/csv-export-orders.md...
|
|
278
|
+
|
|
279
|
+
# Spec: CSV Export — Orders Table
|
|
280
|
+
Status: draft | Created: 2026-04-04
|
|
281
|
+
|
|
282
|
+
## Problem Statement
|
|
283
|
+
Users need to export order data for reporting in external tools.
|
|
284
|
+
|
|
285
|
+
## Acceptance Criteria
|
|
286
|
+
- [ ] Export all orders or filter by date range
|
|
287
|
+
- [ ] CSV includes: order_id, customer, total, status, created_at
|
|
288
|
+
- [ ] Empty state handled gracefully
|
|
289
|
+
- [ ] File named orders-export-{date}.csv
|
|
290
|
+
|
|
291
|
+
## Technical Constraints
|
|
292
|
+
- Must use existing DB connection pool
|
|
293
|
+
- Must stream for large datasets (>10k rows)
|
|
294
|
+
|
|
295
|
+
## Out of Scope
|
|
296
|
+
- PDF export
|
|
297
|
+
- Scheduled exports
|
|
298
|
+
|
|
299
|
+
Does this spec look right? Any changes before I start?
|
|
300
|
+
|
|
301
|
+
You: Looks good, go ahead.
|
|
302
|
+
|
|
303
|
+
Claude: Implementing from spec...
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
## The Five Principles
|
|
307
|
+
|
|
308
|
+
### 1. File-First Persistence
|
|
309
|
+
|
|
310
|
+
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.
|
|
311
|
+
|
|
312
|
+
### 2. Approval-First Workflow
|
|
313
|
+
|
|
314
|
+
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.
|
|
315
|
+
|
|
316
|
+
### 3. Quality as a Structural Gate
|
|
317
|
+
|
|
318
|
+
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.
|
|
319
|
+
|
|
320
|
+
### 4. Governed Subagents
|
|
321
|
+
|
|
322
|
+
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.
|
|
323
|
+
|
|
324
|
+
### 5. Binary Decision Architecture
|
|
325
|
+
|
|
326
|
+
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.
|
|
327
|
+
|
|
199
328
|
## Working with Your Workspace
|
|
200
329
|
|
|
201
330
|
### Starting a session
|
|
@@ -231,8 +360,6 @@ You: Yes, go ahead.
|
|
|
231
360
|
Claude: Starting implementation...
|
|
232
361
|
```
|
|
233
362
|
|
|
234
|
-
Without Clawstrap, Claude would start writing code immediately. With it, the approval-first rule fires — you always see the plan before anything happens.
|
|
235
|
-
|
|
236
363
|
### Ending and resuming sessions
|
|
237
364
|
|
|
238
365
|
When you're done for the day, tell Claude to wrap up. The session handoff checklist runs automatically:
|
|
@@ -250,16 +377,6 @@ Claude: Running session handoff checklist:
|
|
|
250
377
|
Plan file: tmp/auth/plan.md
|
|
251
378
|
```
|
|
252
379
|
|
|
253
|
-
Tomorrow, open Claude Code in the same directory. It reads `CLAUDE.md`, sees the plan file, and picks up:
|
|
254
|
-
|
|
255
|
-
```
|
|
256
|
-
You: Let's continue.
|
|
257
|
-
|
|
258
|
-
Claude: Reading session plan from tmp/auth/plan.md...
|
|
259
|
-
Last session completed: login, register, JWT middleware.
|
|
260
|
-
Next: rate limiting middleware. Starting there.
|
|
261
|
-
```
|
|
262
|
-
|
|
263
380
|
### Delegating to subagents
|
|
264
381
|
|
|
265
382
|
When a task needs parallel work, tell Claude to delegate. The governance rules ensure subagents stay disciplined:
|
|
@@ -295,45 +412,22 @@ Claude: Writing correction to .claude/rules/context-discipline.md...
|
|
|
295
412
|
|
|
296
413
|
The correction is saved to a durable rule file first, then applied. Next session, Claude follows the same rule without you repeating it.
|
|
297
414
|
|
|
298
|
-
## The Five Principles
|
|
299
|
-
|
|
300
|
-
### 1. File-First Persistence
|
|
301
|
-
|
|
302
|
-
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.
|
|
303
|
-
|
|
304
|
-
### 2. Approval-First Workflow
|
|
305
|
-
|
|
306
|
-
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.
|
|
307
|
-
|
|
308
|
-
### 3. Quality as a Structural Gate
|
|
309
|
-
|
|
310
|
-
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.
|
|
311
|
-
|
|
312
|
-
### 4. Governed Subagents
|
|
313
|
-
|
|
314
|
-
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.
|
|
315
|
-
|
|
316
|
-
### 5. Binary Decision Architecture
|
|
317
|
-
|
|
318
|
-
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.
|
|
319
|
-
|
|
320
|
-
## Why Clawstrap Exists
|
|
321
|
-
|
|
322
|
-
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.
|
|
323
|
-
|
|
324
|
-
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.
|
|
325
|
-
|
|
326
415
|
## Commands
|
|
327
416
|
|
|
328
417
|
```
|
|
329
|
-
clawstrap init [directory]
|
|
330
|
-
clawstrap init [directory] --yes
|
|
331
|
-
clawstrap init [directory] --sdd
|
|
332
|
-
clawstrap add agent <name>
|
|
333
|
-
clawstrap add skill <name>
|
|
334
|
-
clawstrap add project <name>
|
|
335
|
-
clawstrap status
|
|
336
|
-
clawstrap
|
|
418
|
+
clawstrap init [directory] Scaffold a new workspace (interactive)
|
|
419
|
+
clawstrap init [directory] --yes Use defaults, skip prompts
|
|
420
|
+
clawstrap init [directory] --sdd Enable Spec-Driven Development mode
|
|
421
|
+
clawstrap add agent <name> Add a new agent definition
|
|
422
|
+
clawstrap add skill <name> Add a new skill
|
|
423
|
+
clawstrap add project <name> Add a new project
|
|
424
|
+
clawstrap status Show workspace configuration and structure
|
|
425
|
+
clawstrap watch Start adaptive memory daemon
|
|
426
|
+
clawstrap watch --once Run all observers once and exit
|
|
427
|
+
clawstrap watch --stop Stop the running daemon
|
|
428
|
+
clawstrap watch --silent Start daemon without output
|
|
429
|
+
clawstrap analyze Run convention scan immediately
|
|
430
|
+
clawstrap export --format paperclip Export workspace as Paperclip company template
|
|
337
431
|
```
|
|
338
432
|
|
|
339
433
|
## Export to Paperclip
|
|
@@ -354,71 +448,21 @@ Generates a directory with `paperclip.manifest.json`, agent definitions with fro
|
|
|
354
448
|
| `--mission`, `-m` | Company mission statement |
|
|
355
449
|
| `--adapter`, `-a` | Agent adapter type (default: `claude_local`) |
|
|
356
450
|
|
|
357
|
-
##
|
|
358
|
-
|
|
359
|
-
Enable SDD mode to enforce a spec-first workflow. Before Claude implements anything, it writes a structured spec, saves it to `specs/{name}.md`, and gets your explicit approval.
|
|
360
|
-
|
|
361
|
-
```bash
|
|
362
|
-
npx clawstrap init --sdd
|
|
363
|
-
```
|
|
364
|
-
|
|
365
|
-
What you get:
|
|
366
|
-
|
|
367
|
-
- **`specs/_template.md`** — reusable spec format with problem statement, acceptance criteria, technical constraints, out-of-scope, and implementation notes
|
|
368
|
-
- **`.claude/rules/sdd.md`** — governance rule Claude loads every session: "Never implement from a vague prompt"
|
|
369
|
-
- **`.claude/commands/spec.md`** — `/spec` slash command that walks Claude through writing, saving, and presenting a spec for approval
|
|
370
|
-
|
|
371
|
-
In practice:
|
|
372
|
-
|
|
373
|
-
```
|
|
374
|
-
You: Build a CSV export for the orders table.
|
|
375
|
-
|
|
376
|
-
Claude: Writing spec to specs/csv-export-orders.md...
|
|
377
|
-
|
|
378
|
-
# Spec: CSV Export — Orders Table
|
|
379
|
-
Status: draft | Created: 2026-04-04
|
|
380
|
-
|
|
381
|
-
## Problem Statement
|
|
382
|
-
Users need to export order data for reporting in external tools.
|
|
383
|
-
|
|
384
|
-
## Acceptance Criteria
|
|
385
|
-
- [ ] Export all orders or filter by date range
|
|
386
|
-
- [ ] CSV includes: order_id, customer, total, status, created_at
|
|
387
|
-
- [ ] Empty state handled gracefully
|
|
388
|
-
- [ ] File named orders-export-{date}.csv
|
|
389
|
-
|
|
390
|
-
## Technical Constraints
|
|
391
|
-
- Must use existing DB connection pool
|
|
392
|
-
- Must stream for large datasets (>10k rows)
|
|
393
|
-
|
|
394
|
-
## Out of Scope
|
|
395
|
-
- PDF export
|
|
396
|
-
- Scheduled exports
|
|
397
|
-
|
|
398
|
-
Does this spec look right? Any changes before I start?
|
|
399
|
-
|
|
400
|
-
You: Looks good, go ahead.
|
|
401
|
-
|
|
402
|
-
Claude: Implementing from spec...
|
|
403
|
-
```
|
|
451
|
+
## Why Clawstrap Exists
|
|
404
452
|
|
|
405
|
-
|
|
453
|
+
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.
|
|
406
454
|
|
|
407
|
-
|
|
408
|
-
|------|-------------|
|
|
409
|
-
| `--yes`, `-y` | Skip prompts, use sensible defaults (init only) |
|
|
410
|
-
| `--sdd` | Enable Spec-Driven Development mode (init only) |
|
|
411
|
-
| `--version` | Show version |
|
|
412
|
-
| `--help` | Show help |
|
|
455
|
+
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.
|
|
413
456
|
|
|
414
457
|
## Roadmap
|
|
415
458
|
|
|
416
459
|
| Version | Status | What |
|
|
417
460
|
|---------|--------|------|
|
|
418
|
-
| **v1.0** | Done | `init` command, 4 workspace profiles,
|
|
419
|
-
| **v1.1** | Done | `add agent
|
|
420
|
-
| **v1.2** | Done | `export --format paperclip`
|
|
421
|
-
| **v1.3** |
|
|
461
|
+
| **v1.0** | Done | `init` command, 4 workspace profiles, governance templates, `--yes` mode |
|
|
462
|
+
| **v1.1** | Done | `add agent/skill/project`, `status` command |
|
|
463
|
+
| **v1.2** | Done | `export --format paperclip` |
|
|
464
|
+
| **v1.3** | Done | `--sdd` flag, Spec-Driven Development mode |
|
|
465
|
+
| **v1.4** | Now | `clawstrap watch` — adaptive memory daemon, `clawstrap analyze` |
|
|
422
466
|
| **v2.0** | Planned | Multi-model support, `upgrade` command, ClipMart publishing |
|
|
423
467
|
|
|
424
468
|
## Contributing
|