clawstrap 1.2.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 +176 -74
- package/dist/index.cjs +1104 -68
- 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
|
|
|
@@ -49,12 +56,15 @@ Scaffold a production-ready AI agent workspace.
|
|
|
49
56
|
|
|
50
57
|
? Enable session handoff checklists? (for multi-session work) Yes
|
|
51
58
|
|
|
59
|
+
? Enable Spec-Driven Development? (write specs before implementing) Yes
|
|
60
|
+
|
|
52
61
|
Configuration:
|
|
53
62
|
Workspace: my-project
|
|
54
63
|
Workload: Research & Analysis
|
|
55
64
|
Parallel agents: single
|
|
56
65
|
Quality level: team
|
|
57
66
|
Session handoff: yes
|
|
67
|
+
Spec-driven dev: yes
|
|
58
68
|
|
|
59
69
|
Generating your workspace...
|
|
60
70
|
|
|
@@ -81,6 +91,11 @@ Done. Open GETTING_STARTED.md to begin.
|
|
|
81
91
|
|
|
82
92
|
That's it. Your workspace is ready. Open `GETTING_STARTED.md` and start your first session.
|
|
83
93
|
|
|
94
|
+
```bash
|
|
95
|
+
# Then start the adaptive memory daemon:
|
|
96
|
+
clawstrap watch
|
|
97
|
+
```
|
|
98
|
+
|
|
84
99
|
## What You Get
|
|
85
100
|
|
|
86
101
|
The generated workspace adapts to your answers. Here's the full structure with everything enabled:
|
|
@@ -95,7 +110,8 @@ my-project/
|
|
|
95
110
|
│ ├── rules/
|
|
96
111
|
│ │ ├── context-discipline.md # Flush cadence, thin orchestrator pattern
|
|
97
112
|
│ │ ├── approval-first.md # Plan → approve → execute
|
|
98
|
-
│ │
|
|
113
|
+
│ │ ├── quality-gates.md # QC as structural gate (team/production only)
|
|
114
|
+
│ │ └── conventions.md # Auto-generated by clawstrap analyze (watch only)
|
|
99
115
|
│ ├── agents/ # (multi-agent workspaces only)
|
|
100
116
|
│ │ ├── primary-agent.md # Main orchestrator definition
|
|
101
117
|
│ │ └── _template.md # Template for new subagents
|
|
@@ -103,6 +119,8 @@ my-project/
|
|
|
103
119
|
│ │ └── SKILL_REGISTRY.md # Skill index
|
|
104
120
|
│ ├── memory/
|
|
105
121
|
│ │ └── MEMORY.md # Cross-session memory (session handoff only)
|
|
122
|
+
│ ├── commands/
|
|
123
|
+
│ │ └── spec.md # /spec slash command (SDD only)
|
|
106
124
|
│ ├── subagent-bootstrap.md # Lightweight ad-hoc governance (multi-agent only)
|
|
107
125
|
│ ├── gotcha-log.md # Incident tracking — why rules exist
|
|
108
126
|
│ └── future-considerations.md # Deferred ideas parking lot
|
|
@@ -110,13 +128,16 @@ my-project/
|
|
|
110
128
|
│ └── _template/
|
|
111
129
|
│ ├── README.md # Project metadata template
|
|
112
130
|
│ └── process.md # Workflow and session checklist template
|
|
131
|
+
├── specs/
|
|
132
|
+
│ └── _template.md # Spec template (SDD only)
|
|
113
133
|
├── tmp/ # Gitignored session workspace
|
|
134
|
+
│ └── sessions/ # Session summaries processed by watch daemon
|
|
114
135
|
├── research/ # Reference material
|
|
115
136
|
├── context/ # Session checkpoints
|
|
116
137
|
└── artifacts/ # Durable output
|
|
117
138
|
```
|
|
118
139
|
|
|
119
|
-
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.
|
|
120
141
|
|
|
121
142
|
## See the Difference
|
|
122
143
|
|
|
@@ -142,26 +163,31 @@ Claude: Reading progress tracker... Last session completed endpoints for
|
|
|
142
163
|
tmp/api-migration/plan.md. Ready to proceed?
|
|
143
164
|
```
|
|
144
165
|
|
|
145
|
-
###
|
|
166
|
+
### Living memory across sessions
|
|
146
167
|
|
|
147
|
-
|
|
168
|
+
Without Clawstrap watch — corrections evaporate:
|
|
148
169
|
|
|
149
170
|
```
|
|
150
|
-
You:
|
|
151
|
-
Claude:
|
|
152
|
-
|
|
153
|
-
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)
|
|
154
177
|
```
|
|
155
178
|
|
|
156
|
-
|
|
179
|
+
With Clawstrap watch — corrections survive automatically:
|
|
157
180
|
|
|
158
181
|
```
|
|
159
|
-
You:
|
|
160
|
-
Claude:
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
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.
|
|
165
191
|
```
|
|
166
192
|
|
|
167
193
|
### Subagent context control
|
|
@@ -189,6 +215,116 @@ Claude: Research complete. Reading the 3 low-confidence entries for
|
|
|
189
215
|
review before proceeding to the report.
|
|
190
216
|
```
|
|
191
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
|
+
|
|
192
328
|
## Working with Your Workspace
|
|
193
329
|
|
|
194
330
|
### Starting a session
|
|
@@ -224,8 +360,6 @@ You: Yes, go ahead.
|
|
|
224
360
|
Claude: Starting implementation...
|
|
225
361
|
```
|
|
226
362
|
|
|
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
363
|
### Ending and resuming sessions
|
|
230
364
|
|
|
231
365
|
When you're done for the day, tell Claude to wrap up. The session handoff checklist runs automatically:
|
|
@@ -243,16 +377,6 @@ Claude: Running session handoff checklist:
|
|
|
243
377
|
Plan file: tmp/auth/plan.md
|
|
244
378
|
```
|
|
245
379
|
|
|
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
380
|
### Delegating to subagents
|
|
257
381
|
|
|
258
382
|
When a task needs parallel work, tell Claude to delegate. The governance rules ensure subagents stay disciplined:
|
|
@@ -288,44 +412,22 @@ Claude: Writing correction to .claude/rules/context-discipline.md...
|
|
|
288
412
|
|
|
289
413
|
The correction is saved to a durable rule file first, then applied. Next session, Claude follows the same rule without you repeating it.
|
|
290
414
|
|
|
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
415
|
## Commands
|
|
320
416
|
|
|
321
417
|
```
|
|
322
|
-
clawstrap init [directory]
|
|
323
|
-
clawstrap init [directory] --yes
|
|
324
|
-
clawstrap
|
|
325
|
-
clawstrap add
|
|
326
|
-
clawstrap add
|
|
327
|
-
clawstrap
|
|
328
|
-
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
|
|
329
431
|
```
|
|
330
432
|
|
|
331
433
|
## Export to Paperclip
|
|
@@ -346,21 +448,21 @@ Generates a directory with `paperclip.manifest.json`, agent definitions with fro
|
|
|
346
448
|
| `--mission`, `-m` | Company mission statement |
|
|
347
449
|
| `--adapter`, `-a` | Agent adapter type (default: `claude_local`) |
|
|
348
450
|
|
|
349
|
-
##
|
|
451
|
+
## Why Clawstrap Exists
|
|
350
452
|
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
| `--version` | Show version |
|
|
355
|
-
| `--help` | Show help |
|
|
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.
|
|
454
|
+
|
|
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.
|
|
356
456
|
|
|
357
457
|
## Roadmap
|
|
358
458
|
|
|
359
459
|
| Version | Status | What |
|
|
360
460
|
|---------|--------|------|
|
|
361
|
-
| **v1.0** | Done | `init` command, 4 workspace profiles,
|
|
362
|
-
| **v1.1** | Done | `add agent
|
|
363
|
-
| **v1.2** |
|
|
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` |
|
|
364
466
|
| **v2.0** | Planned | Multi-model support, `upgrade` command, ClipMart publishing |
|
|
365
467
|
|
|
366
468
|
## Contributing
|