openclew 0.2.0 → 0.3.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 +28 -122
- package/UPGRADING.md +167 -0
- package/bin/openclew.js +46 -18
- package/lib/checkout.js +26 -18
- package/lib/index-gen.js +100 -25
- package/lib/init.js +70 -37
- package/lib/inject.js +16 -7
- package/lib/mcp-server.js +313 -0
- package/lib/new-doc.js +15 -7
- package/lib/new-log.js +5 -5
- package/lib/search.js +242 -0
- package/lib/status.js +151 -0
- package/lib/templates.js +270 -94
- package/package.json +24 -3
- package/skills/openclew-checkpoint/SKILL.md +36 -0
- package/skills/openclew-init/SKILL.md +49 -0
- package/skills/openclew-search/SKILL.md +45 -0
- package/templates/FORMAT.md +299 -0
- package/templates/log.md +5 -8
- package/templates/onboarding/flow.md +59 -0
- package/templates/onboarding/scaffold_index.md +31 -0
- package/templates/{living.md → refdoc.md} +5 -9
- package/hooks/generate-index.py +0 -157
package/lib/templates.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Template content for
|
|
2
|
+
* Template content for refdocs and logs.
|
|
3
3
|
* Embedded here so the CLI works standalone without needing to locate template files.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
+
const path = require("path");
|
|
7
|
+
|
|
6
8
|
function today() {
|
|
7
9
|
return new Date().toISOString().slice(0, 10);
|
|
8
10
|
}
|
|
@@ -21,18 +23,24 @@ function slugifyLog(title) {
|
|
|
21
23
|
.replace(/^-|-$/g, "");
|
|
22
24
|
}
|
|
23
25
|
|
|
24
|
-
function
|
|
26
|
+
function ocVersion() {
|
|
27
|
+
try {
|
|
28
|
+
const pkg = require(path.join(__dirname, "..", "package.json"));
|
|
29
|
+
return pkg.version;
|
|
30
|
+
} catch {
|
|
31
|
+
return "0.0.0";
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function refdocContent(title) {
|
|
25
36
|
const date = today();
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
status: Active
|
|
34
|
-
category:
|
|
35
|
-
keywords: []
|
|
37
|
+
const ver = ocVersion();
|
|
38
|
+
return `openclew@${ver} · created: ${date} · updated: ${date} · type: Reference · status: Active · category: · keywords: []
|
|
39
|
+
|
|
40
|
+
<!-- L1_START -->
|
|
41
|
+
**subject:** ${title}
|
|
42
|
+
|
|
43
|
+
**doc_brief:**
|
|
36
44
|
<!-- L1_END -->
|
|
37
45
|
|
|
38
46
|
---
|
|
@@ -67,15 +75,13 @@ keywords: []
|
|
|
67
75
|
|
|
68
76
|
function logContent(title) {
|
|
69
77
|
const date = today();
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
subject
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
category:
|
|
78
|
-
keywords: []
|
|
78
|
+
const ver = ocVersion();
|
|
79
|
+
return `openclew@${ver} · date: ${date} · type: Feature · status: In progress · category: · keywords: []
|
|
80
|
+
|
|
81
|
+
<!-- L1_START -->
|
|
82
|
+
**subject:** ${title}
|
|
83
|
+
|
|
84
|
+
**doc_brief:**
|
|
79
85
|
<!-- L1_END -->
|
|
80
86
|
|
|
81
87
|
---
|
|
@@ -109,16 +115,13 @@ keywords: []
|
|
|
109
115
|
*/
|
|
110
116
|
function guideContent() {
|
|
111
117
|
const date = today();
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
status: Active
|
|
120
|
-
category: Documentation
|
|
121
|
-
keywords: [openclew, L1, L2, L3, index, living-doc, log]
|
|
118
|
+
const ver = ocVersion();
|
|
119
|
+
return `openclew@${ver} · created: ${date} · updated: ${date} · type: Guide · status: Active · category: Documentation · keywords: [openclew, L1, L2, L3, index, refdoc, log]
|
|
120
|
+
|
|
121
|
+
<!-- L1_START -->
|
|
122
|
+
**subject:** How openclew works
|
|
123
|
+
|
|
124
|
+
**doc_brief:** How openclew structures project knowledge in 3 levels (L1/L2/L3) so AI agents and humans navigate efficiently.
|
|
122
125
|
<!-- L1_END -->
|
|
123
126
|
|
|
124
127
|
---
|
|
@@ -136,7 +139,7 @@ Before starting any task, read \`doc/_INDEX.md\` to find docs related to the tas
|
|
|
136
139
|
|
|
137
140
|
## Two types of docs
|
|
138
141
|
|
|
139
|
-
**
|
|
142
|
+
**Refdocs** (\`doc/_*.md\`): knowledge that evolves with the project.
|
|
140
143
|
Architecture decisions, conventions, known pitfalls — anything that stays relevant over time.
|
|
141
144
|
Naming: \`doc/_UPPER_SNAKE_CASE.md\` (e.g. \`doc/_AUTH_DESIGN.md\`)
|
|
142
145
|
|
|
@@ -144,18 +147,33 @@ Naming: \`doc/_UPPER_SNAKE_CASE.md\` (e.g. \`doc/_AUTH_DESIGN.md\`)
|
|
|
144
147
|
What happened, what was decided, what was tried. Never modified after the session.
|
|
145
148
|
Naming: \`doc/log/YYYY-MM-DD_lowercase-slug.md\` (e.g. \`doc/log/2026-01-15_setup-auth.md\`)
|
|
146
149
|
|
|
147
|
-
##
|
|
150
|
+
## Document structure
|
|
151
|
+
|
|
152
|
+
Every doc has a metadata line + 3 levels. Read only what you need:
|
|
148
153
|
|
|
149
|
-
|
|
154
|
+
**Line 1 — Metadata**: version, date, type, status, category, keywords. For indexing and triage.
|
|
150
155
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
156
|
+
**L1 — Subject + Brief** (~40 tokens): what the doc is about and what it concludes. Read this first to decide if the doc is relevant.
|
|
157
|
+
|
|
158
|
+
**L2 — Summary**: the essential context — objective, key points, decisions.
|
|
159
|
+
|
|
160
|
+
**L3 — Details**: full technical content. Only read when deep-diving.
|
|
154
161
|
|
|
155
162
|
## Index
|
|
156
163
|
|
|
157
164
|
\`doc/_INDEX.md\` is auto-generated from L1 metadata on every git commit (via a pre-commit hook).
|
|
158
165
|
Never edit it manually. To force a rebuild: \`openclew index\`
|
|
166
|
+
|
|
167
|
+
## Using with OpenClaw (or any agent framework)
|
|
168
|
+
|
|
169
|
+
openclew handles **project knowledge** — what your project knows, what was decided, what happened.
|
|
170
|
+
Agent frameworks (OpenClaw, Claude Code, Cursor, etc.) handle **agent behavior** — identity, tools, memory.
|
|
171
|
+
|
|
172
|
+
They work together:
|
|
173
|
+
- Your framework's workspace memory (\`MEMORY.md\`, \`SOUL.md\`, etc.) = agent-level, cross-project
|
|
174
|
+
- openclew's \`doc/\` = project-level, shared across all agents and sessions
|
|
175
|
+
|
|
176
|
+
openclew injects into your project's instruction file (AGENTS.md, CLAUDE.md, .cursorrules, etc.) — it doesn't replace or conflict with your framework's configuration.
|
|
159
177
|
<!-- L2_END -->
|
|
160
178
|
|
|
161
179
|
---
|
|
@@ -163,21 +181,17 @@ Never edit it manually. To force a rebuild: \`openclew index\`
|
|
|
163
181
|
<!-- L3_START -->
|
|
164
182
|
# L3 - Details
|
|
165
183
|
|
|
166
|
-
## Creating a
|
|
184
|
+
## Creating a refdoc
|
|
167
185
|
|
|
168
186
|
Create \`doc/_TITLE.md\` (uppercase snake_case) with this structure:
|
|
169
187
|
|
|
170
188
|
\`\`\`
|
|
189
|
+
openclew@${ver} · created: YYYY-MM-DD · updated: YYYY-MM-DD · type: Reference · status: Active · category: · keywords: []
|
|
190
|
+
|
|
171
191
|
<!-- L1_START -->
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
created: YYYY-MM-DD
|
|
176
|
-
updated: YYYY-MM-DD
|
|
177
|
-
short_story:
|
|
178
|
-
status: Active
|
|
179
|
-
category:
|
|
180
|
-
keywords: []
|
|
192
|
+
**subject:** Title
|
|
193
|
+
|
|
194
|
+
**doc_brief:**
|
|
181
195
|
<!-- L1_END -->
|
|
182
196
|
|
|
183
197
|
---
|
|
@@ -205,15 +219,12 @@ keywords: []
|
|
|
205
219
|
Create \`doc/log/YYYY-MM-DD_slug.md\` (lowercase, hyphens) with this structure:
|
|
206
220
|
|
|
207
221
|
\`\`\`
|
|
222
|
+
openclew@${ver} · date: YYYY-MM-DD · type: Feature · status: In progress · category: · keywords: []
|
|
223
|
+
|
|
208
224
|
<!-- L1_START -->
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
subject: Title
|
|
213
|
-
short_story:
|
|
214
|
-
status: In progress
|
|
215
|
-
category:
|
|
216
|
-
keywords: []
|
|
225
|
+
**subject:** Title
|
|
226
|
+
|
|
227
|
+
**doc_brief:**
|
|
217
228
|
<!-- L1_END -->
|
|
218
229
|
|
|
219
230
|
---
|
|
@@ -243,9 +254,10 @@ Logs are immutable — once the session ends, the log is never modified.
|
|
|
243
254
|
|
|
244
255
|
1. At session start: read the entry point file
|
|
245
256
|
2. Before any task: read \`doc/_INDEX.md\`, scan L1 metadata, identify relevant docs
|
|
246
|
-
3. Read
|
|
247
|
-
4.
|
|
248
|
-
5.
|
|
257
|
+
3. Read L1 (subject + brief) of relevant docs to confirm relevance
|
|
258
|
+
4. Read L2 for context
|
|
259
|
+
5. Only read L3 when you need implementation details
|
|
260
|
+
6. After significant work: create or update refdocs and logs directly
|
|
249
261
|
|
|
250
262
|
The index (\`doc/_INDEX.md\`) auto-regenerates on every git commit. To force a rebuild: \`openclew index\`
|
|
251
263
|
|
|
@@ -261,20 +273,37 @@ The index (\`doc/_INDEX.md\`) auto-regenerates on every git commit. To force a r
|
|
|
261
273
|
}
|
|
262
274
|
|
|
263
275
|
/**
|
|
264
|
-
* Example
|
|
276
|
+
* Example refdoc — shows what a filled-in doc looks like.
|
|
265
277
|
*/
|
|
266
|
-
function
|
|
278
|
+
function exampleRefdocContent(existingInstructions) {
|
|
267
279
|
const date = today();
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
280
|
+
const ver = ocVersion();
|
|
281
|
+
|
|
282
|
+
// Strip openclew block from existing instructions to avoid duplication
|
|
283
|
+
let seedContent = "";
|
|
284
|
+
if (existingInstructions) {
|
|
285
|
+
seedContent = existingInstructions
|
|
286
|
+
.replace(/<!--\s*openclew_START\s*-->[\s\S]*?<!--\s*openclew_END\s*-->/g, "")
|
|
287
|
+
.trim();
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
const seedSection = seedContent
|
|
291
|
+
? `## From existing project instructions
|
|
292
|
+
|
|
293
|
+
${seedContent}
|
|
294
|
+
|
|
295
|
+
## What to do next
|
|
296
|
+
<!-- Review the above (imported from your instruction file) and reorganize into the sections below. Then delete this section. -->
|
|
297
|
+
|
|
298
|
+
`
|
|
299
|
+
: "";
|
|
300
|
+
|
|
301
|
+
return `openclew@${ver} · created: ${date} · updated: ${date} · type: Reference · status: Active · category: Architecture · keywords: [architecture, overview, components]
|
|
302
|
+
|
|
303
|
+
<!-- L1_START -->
|
|
304
|
+
**subject:** Architecture overview
|
|
305
|
+
|
|
306
|
+
**doc_brief:** <!-- ONE LINE: What does this project do, what's the main stack, how is it deployed? -->
|
|
278
307
|
<!-- L1_END -->
|
|
279
308
|
|
|
280
309
|
---
|
|
@@ -282,13 +311,25 @@ keywords: [architecture, overview, components]
|
|
|
282
311
|
<!-- L2_START -->
|
|
283
312
|
# L2 - Summary
|
|
284
313
|
|
|
285
|
-
##
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
##
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
314
|
+
${seedSection}## What this project does
|
|
315
|
+
<!-- 1-2 sentences. What problem does it solve? Who uses it? -->
|
|
316
|
+
|
|
317
|
+
## Stack
|
|
318
|
+
<!-- List the main technologies: language, framework, database, key libraries. -->
|
|
319
|
+
|
|
320
|
+
## How it's organized
|
|
321
|
+
<!-- Describe the main directories and what lives where. e.g.:
|
|
322
|
+
- src/routes/ — API endpoints
|
|
323
|
+
- src/services/ — business logic
|
|
324
|
+
- src/models/ — database models
|
|
325
|
+
-->
|
|
326
|
+
|
|
327
|
+
## Key decisions
|
|
328
|
+
<!-- List 2-5 architectural choices that someone new needs to know. e.g.:
|
|
329
|
+
- Auth via JWT (not sessions) because the API is stateless
|
|
330
|
+
- PostgreSQL over MongoDB because we need relational queries
|
|
331
|
+
- All validation happens in middleware, not in route handlers
|
|
332
|
+
-->
|
|
292
333
|
<!-- L2_END -->
|
|
293
334
|
|
|
294
335
|
---
|
|
@@ -296,10 +337,21 @@ Document the high-level architecture so new contributors and AI agents understan
|
|
|
296
337
|
<!-- L3_START -->
|
|
297
338
|
# L3 - Details
|
|
298
339
|
|
|
299
|
-
|
|
340
|
+
## Data flow
|
|
341
|
+
<!-- How does a request travel through the system? e.g.:
|
|
342
|
+
Client → route → middleware (auth, validation) → service → repository → DB
|
|
343
|
+
-->
|
|
344
|
+
|
|
345
|
+
## External dependencies
|
|
346
|
+
<!-- APIs, services, or systems this project talks to. -->
|
|
300
347
|
|
|
301
|
-
|
|
302
|
-
|
|
348
|
+
## How to run
|
|
349
|
+
<!-- Commands to start the project locally. e.g.:
|
|
350
|
+
npm install && npm run dev
|
|
351
|
+
-->
|
|
352
|
+
|
|
353
|
+
## Known constraints
|
|
354
|
+
<!-- Limits, technical debt, or things that don't scale. -->
|
|
303
355
|
|
|
304
356
|
---
|
|
305
357
|
|
|
@@ -307,7 +359,7 @@ Edit it to document your project's architecture, or delete it and create your ow
|
|
|
307
359
|
|
|
308
360
|
| Date | Change |
|
|
309
361
|
|------|--------|
|
|
310
|
-
| ${date} | Created by openclew init
|
|
362
|
+
| ${date} | Created by openclew init — fill this in! |
|
|
311
363
|
<!-- L3_END -->
|
|
312
364
|
`;
|
|
313
365
|
}
|
|
@@ -317,15 +369,13 @@ Edit it to document your project's architecture, or delete it and create your ow
|
|
|
317
369
|
*/
|
|
318
370
|
function exampleLogContent() {
|
|
319
371
|
const date = today();
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
subject
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
category: Tooling
|
|
328
|
-
keywords: [openclew, setup, documentation]
|
|
372
|
+
const ver = ocVersion();
|
|
373
|
+
return `openclew@${ver} · date: ${date} · type: Feature · status: Done · category: Tooling · keywords: [openclew, setup, documentation]
|
|
374
|
+
|
|
375
|
+
<!-- L1_START -->
|
|
376
|
+
**subject:** Set up openclew
|
|
377
|
+
|
|
378
|
+
**doc_brief:** Initialized openclew for structured project knowledge. Created doc/ structure, git hook, guide, and example docs.
|
|
329
379
|
<!-- L1_END -->
|
|
330
380
|
|
|
331
381
|
---
|
|
@@ -340,7 +390,7 @@ Set up structured documentation so AI agents and new contributors can navigate p
|
|
|
340
390
|
Project knowledge was scattered — README, inline comments, tribal knowledge. Each new AI session started from zero.
|
|
341
391
|
|
|
342
392
|
## Solution
|
|
343
|
-
Installed openclew. Every doc now has
|
|
393
|
+
Installed openclew. Every doc now has a metadata line (for triage) + L1 (subject and brief), L2 (summary for context), L3 (details when needed).
|
|
344
394
|
The index auto-regenerates on each commit via a git hook.
|
|
345
395
|
<!-- L2_END -->
|
|
346
396
|
|
|
@@ -351,16 +401,142 @@ The index auto-regenerates on each commit via a git hook.
|
|
|
351
401
|
|
|
352
402
|
This log was created by \`openclew init\`.
|
|
353
403
|
It shows what a filled-in log looks like. Logs are immutable — once the session ends, the log is frozen.
|
|
354
|
-
For evolving knowledge, use
|
|
404
|
+
For evolving knowledge, use refdocs (\`doc/_*.md\`).
|
|
405
|
+
<!-- L3_END -->
|
|
406
|
+
`;
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
/**
|
|
410
|
+
* Framework integration guide — created by init alongside the main guide.
|
|
411
|
+
* Explains how openclew works with workflow frameworks (BMAD, Spec Kit, Kiro...).
|
|
412
|
+
*/
|
|
413
|
+
function frameworkIntegrationContent() {
|
|
414
|
+
const date = today();
|
|
415
|
+
const ver = ocVersion();
|
|
416
|
+
return `openclew@${ver} · created: ${date} · updated: ${date} · type: Guide · status: Active · category: Integration · keywords: [BMAD, Spec Kit, Kiro, workflow, framework, integration]
|
|
417
|
+
|
|
418
|
+
<!-- L1_START -->
|
|
419
|
+
**subject:** How to use openclew with workflow frameworks (BMAD, Spec Kit, Kiro...)
|
|
420
|
+
|
|
421
|
+
**doc_brief:** openclew handles knowledge, your framework handles process. Covers concrete use cases, integration patterns, and what goes where. Works with any spec-driven methodology.
|
|
422
|
+
<!-- L1_END -->
|
|
423
|
+
|
|
424
|
+
---
|
|
425
|
+
|
|
426
|
+
<!-- L2_START -->
|
|
427
|
+
# L2 - Summary
|
|
428
|
+
|
|
429
|
+
## The split
|
|
430
|
+
|
|
431
|
+
Workflow frameworks (BMAD, Spec Kit, Kiro...) solve: *"my agent doesn't follow a process."*
|
|
432
|
+
openclew solves: *"my agent forgets everything between sessions."*
|
|
433
|
+
|
|
434
|
+
They're complementary. Use both.
|
|
435
|
+
|
|
436
|
+
| Your framework does | openclew does |
|
|
437
|
+
|---------------------|---------------|
|
|
438
|
+
| Structures the workflow (who does what, in what order) | Structures the knowledge (what to remember, where to find it) |
|
|
439
|
+
| Produces artifacts (PRD, architecture, stories, retro) | Persists them so they're found automatically next session |
|
|
440
|
+
| Scoped to one sprint/feature | Scoped to the lifetime of the codebase |
|
|
441
|
+
|
|
442
|
+
## Use cases
|
|
443
|
+
|
|
444
|
+
### UC1 — PRD forgotten after creation
|
|
445
|
+
|
|
446
|
+
You create a PRD with your framework. Two weeks later, a new session starts. The agent doesn't know the PRD exists.
|
|
447
|
+
|
|
448
|
+
**With openclew:** The PRD is persisted as \`doc/_PRD_AUTH.md\` (L1 scannable). The agent scans the index at session start and finds it automatically.
|
|
449
|
+
|
|
450
|
+
### UC2 — Sprint decisions lost
|
|
451
|
+
|
|
452
|
+
Three stories completed in a sprint. Decisions were made (API design, tradeoffs, rejected approaches). They live in chat history — gone.
|
|
453
|
+
|
|
454
|
+
**With openclew:** Each completed story produces a log (\`doc/log/YYYY-MM-DD_story-auth-flow.md\`). Immutable. When the project resumes, the agent sees what was decided and why.
|
|
455
|
+
|
|
456
|
+
### UC3 — Retrospective lessons not reused
|
|
457
|
+
|
|
458
|
+
Your framework runs a retro. Lessons are identified. They go into an output file that nobody reads again.
|
|
459
|
+
|
|
460
|
+
**With openclew:** Lessons go into \`doc/_LESSONS_LEARNED.md\` — a living refdoc, updated after each retro. Future sprints consult it automatically via the index.
|
|
461
|
+
|
|
462
|
+
### UC4 — New teammate onboarding
|
|
463
|
+
|
|
464
|
+
A new developer (or a new agent session) joins mid-project. No context.
|
|
465
|
+
|
|
466
|
+
**With openclew:** Read \`doc/_INDEX.md\` → scan L1s → read L2s of relevant docs → full context in minutes. Same docs for humans and agents.
|
|
467
|
+
|
|
468
|
+
### UC5 — Framework needs project context
|
|
469
|
+
|
|
470
|
+
Your framework's agents (PM, Architect, Dev) start from generic prompts. They don't know your project's conventions, architecture, or past decisions.
|
|
471
|
+
|
|
472
|
+
**With openclew:** Point your framework's knowledge config at \`doc/\`. Agents read refdocs as context before producing artifacts.
|
|
473
|
+
|
|
474
|
+
<!-- L2_END -->
|
|
475
|
+
|
|
476
|
+
---
|
|
477
|
+
|
|
478
|
+
<!-- L3_START -->
|
|
479
|
+
# L3 - Details
|
|
480
|
+
|
|
481
|
+
## Integration pattern
|
|
482
|
+
|
|
483
|
+
\`\`\`
|
|
484
|
+
Framework (process) openclew (knowledge)
|
|
485
|
+
─────────────────── ────────────────────
|
|
486
|
+
Create PRD → Save as doc/_PRD_FEATURE.md
|
|
487
|
+
Architecture design → Save as doc/_ARCHITECTURE.md
|
|
488
|
+
Sprint planning → Log as doc/log/YYYY-MM-DD_sprint-N.md
|
|
489
|
+
Story completed → Log as doc/log/YYYY-MM-DD_story-ID.md
|
|
490
|
+
Retrospective → Update doc/_LESSONS_LEARNED.md
|
|
491
|
+
─────────────────── ────────────────────
|
|
492
|
+
Next sprint starts ← Agent reads index, finds all of the above
|
|
493
|
+
\`\`\`
|
|
494
|
+
|
|
495
|
+
## Mapping: framework artifacts → openclew docs
|
|
496
|
+
|
|
497
|
+
| Framework artifact | openclew type | Naming | Mutability |
|
|
498
|
+
|--------------------|---------------|--------|------------|
|
|
499
|
+
| PRD | Refdoc | \`doc/_PRD_FEATURE.md\` | Updated as requirements evolve |
|
|
500
|
+
| Architecture decision | Refdoc | \`doc/_ARCHITECTURE.md\` | Updated as design evolves |
|
|
501
|
+
| Sprint plan | Log | \`doc/log/YYYY-MM-DD_sprint-N.md\` | Frozen (snapshot of the plan) |
|
|
502
|
+
| Completed story | Log | \`doc/log/YYYY-MM-DD_story-ID.md\` | Frozen (what was done) |
|
|
503
|
+
| Retrospective | Log + Refdoc | Log for the session, refdoc for accumulated lessons | Log frozen, refdoc updated |
|
|
504
|
+
| Tech spec | Refdoc | \`doc/_SPEC_FEATURE.md\` | Updated until implemented |
|
|
505
|
+
|
|
506
|
+
## BMAD-specific integration
|
|
507
|
+
|
|
508
|
+
BMAD uses a \`project_knowledge\` config that points agents to project context. Point it at \`doc/\`:
|
|
509
|
+
|
|
510
|
+
\`\`\`yaml
|
|
511
|
+
# _bmad/bmm/config.yaml
|
|
512
|
+
project_knowledge: doc/
|
|
513
|
+
\`\`\`
|
|
514
|
+
|
|
515
|
+
BMAD agents (PM, Architect, Dev, QA) will read openclew docs as context before producing artifacts.
|
|
516
|
+
|
|
517
|
+
## What openclew does NOT do
|
|
518
|
+
|
|
519
|
+
- Does not replace your framework's workflow or personas
|
|
520
|
+
- Does not impose a development process
|
|
521
|
+
- Does not require any specific framework — works standalone
|
|
522
|
+
|
|
523
|
+
---
|
|
524
|
+
|
|
525
|
+
## Changelog
|
|
526
|
+
|
|
527
|
+
| Date | Change |
|
|
528
|
+
|------|--------|
|
|
529
|
+
| ${date} | Created by openclew init |
|
|
355
530
|
<!-- L3_END -->
|
|
356
531
|
`;
|
|
357
532
|
}
|
|
358
533
|
|
|
359
534
|
module.exports = {
|
|
360
|
-
|
|
535
|
+
refdocContent,
|
|
361
536
|
logContent,
|
|
362
537
|
guideContent,
|
|
363
|
-
|
|
538
|
+
frameworkIntegrationContent,
|
|
539
|
+
exampleRefdocContent,
|
|
364
540
|
exampleLogContent,
|
|
365
541
|
slugify,
|
|
366
542
|
slugifyLog,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "openclew",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Long Life Memory for LLMs — structured project knowledge for AI agents and humans",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"bin": {
|
|
@@ -8,10 +8,22 @@
|
|
|
8
8
|
},
|
|
9
9
|
"files": [
|
|
10
10
|
"bin/",
|
|
11
|
-
"lib/",
|
|
11
|
+
"lib/checkout.js",
|
|
12
|
+
"lib/config.js",
|
|
13
|
+
"lib/detect.js",
|
|
14
|
+
"lib/index-gen.js",
|
|
15
|
+
"lib/init.js",
|
|
16
|
+
"lib/inject.js",
|
|
17
|
+
"lib/mcp-server.js",
|
|
18
|
+
"lib/new-doc.js",
|
|
19
|
+
"lib/new-log.js",
|
|
20
|
+
"lib/search.js",
|
|
21
|
+
"lib/status.js",
|
|
22
|
+
"lib/templates.js",
|
|
12
23
|
"templates/",
|
|
13
|
-
"
|
|
24
|
+
"skills/",
|
|
14
25
|
"README.md",
|
|
26
|
+
"UPGRADING.md",
|
|
15
27
|
"LICENSE"
|
|
16
28
|
],
|
|
17
29
|
"keywords": [
|
|
@@ -29,6 +41,15 @@
|
|
|
29
41
|
"type": "git",
|
|
30
42
|
"url": "https://github.com/openclew/openclew"
|
|
31
43
|
},
|
|
44
|
+
"author": "Raphaël Flambard <raphael@ralpha.fr>",
|
|
45
|
+
"contributors": [
|
|
46
|
+
"Adrien Cocuaud <adrien@ralpha.fr>",
|
|
47
|
+
"Victor Ripplinger"
|
|
48
|
+
],
|
|
49
|
+
"homepage": "https://github.com/openclew/openclew#readme",
|
|
50
|
+
"bugs": {
|
|
51
|
+
"url": "https://github.com/openclew/openclew/issues"
|
|
52
|
+
},
|
|
32
53
|
"engines": {
|
|
33
54
|
"node": ">=16"
|
|
34
55
|
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: openclew-checkpoint
|
|
3
|
+
description: End-of-session checkpoint. Summarizes git activity, creates a session log, and regenerates the doc index. Use at the end of a work session to persist what was done.
|
|
4
|
+
user-invocable: true
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# openclew checkpoint — End-of-session summary
|
|
8
|
+
|
|
9
|
+
Run this at the end of a work session to capture what happened.
|
|
10
|
+
|
|
11
|
+
## Command
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npx openclew checkout
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## What it does
|
|
18
|
+
|
|
19
|
+
1. Collects today's git activity (commits, changed files, uncommitted changes)
|
|
20
|
+
2. Displays a summary table
|
|
21
|
+
3. Creates a session log in `doc/log/YYYY-MM-DD_<topic>.md`
|
|
22
|
+
4. Regenerates `doc/_INDEX.md`
|
|
23
|
+
|
|
24
|
+
## When to use
|
|
25
|
+
|
|
26
|
+
- End of a coding session
|
|
27
|
+
- After completing a feature or bug fix
|
|
28
|
+
- Before switching to a different project
|
|
29
|
+
- When you want to leave a trace for the next session (yours or someone else's)
|
|
30
|
+
|
|
31
|
+
## Other useful commands
|
|
32
|
+
|
|
33
|
+
- `npx openclew add ref "Title"` — Create a reference doc for lasting knowledge
|
|
34
|
+
- `npx openclew add log "Title"` — Create a log manually (for mid-session notes)
|
|
35
|
+
- `npx openclew status` — Health dashboard (missing briefs, stale docs)
|
|
36
|
+
- `npx openclew search "query"` — Find docs by keyword
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: openclew-init
|
|
3
|
+
description: Set up openclew structured documentation in the current project. Creates doc/ with L1/L2/L3 knowledge base, auto-generated index, and injects context into your instruction file.
|
|
4
|
+
user-invocable: true
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# openclew init — Set up project knowledge
|
|
8
|
+
|
|
9
|
+
Run this to add structured documentation to your project.
|
|
10
|
+
|
|
11
|
+
## What it does
|
|
12
|
+
|
|
13
|
+
1. Creates `doc/` and `doc/log/` directories
|
|
14
|
+
2. Detects your existing instruction file (AGENTS.md, CLAUDE.md, .cursorrules, etc.)
|
|
15
|
+
3. Injects a knowledge block so agents automatically consult project docs
|
|
16
|
+
4. Creates starter docs: guide, architecture template, example log
|
|
17
|
+
5. Generates `doc/_INDEX.md` (auto-rebuilt on every commit)
|
|
18
|
+
6. Installs a git pre-commit hook for index regeneration
|
|
19
|
+
|
|
20
|
+
## Command
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npx openclew init
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Options
|
|
27
|
+
|
|
28
|
+
- `--no-inject` — Skip injection into instruction file
|
|
29
|
+
- `--no-hook` — Skip git hook installation
|
|
30
|
+
|
|
31
|
+
## After setup
|
|
32
|
+
|
|
33
|
+
Your agent will now read `doc/_INDEX.md` before starting tasks. To add knowledge:
|
|
34
|
+
|
|
35
|
+
- `npx openclew add ref "Title"` — Create a reference doc (architecture, conventions, decisions)
|
|
36
|
+
- `npx openclew add log "Title"` — Create a session log (frozen facts)
|
|
37
|
+
- `npx openclew search "query"` — Search existing docs
|
|
38
|
+
- `npx openclew checkout` — End-of-session summary
|
|
39
|
+
|
|
40
|
+
## How it works with OpenClaw
|
|
41
|
+
|
|
42
|
+
openclew handles **project knowledge** (what your project knows, what was decided, what happened).
|
|
43
|
+
OpenClaw handles **agent identity** (personality, memory, tools, messaging).
|
|
44
|
+
|
|
45
|
+
They're complementary:
|
|
46
|
+
- OpenClaw's `MEMORY.md` = your agent's personal memory across all projects
|
|
47
|
+
- openclew's `doc/` = this project's shared knowledge across all agents and sessions
|
|
48
|
+
|
|
49
|
+
openclew injects into your project's `AGENTS.md` (or any instruction file). This doesn't conflict with OpenClaw's workspace `AGENTS.md` — they live in different locations.
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: openclew-search
|
|
3
|
+
description: Search project documentation by keyword. Searches L1 metadata (subject, doc_brief, category, keywords) across all refdocs and logs. Returns results sorted by relevance.
|
|
4
|
+
user-invocable: true
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# openclew search — Find relevant docs
|
|
8
|
+
|
|
9
|
+
Search your project's knowledge base by keyword.
|
|
10
|
+
|
|
11
|
+
## Command
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npx openclew search "<query>"
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Examples
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npx openclew search "auth" # Find docs about authentication
|
|
21
|
+
npx openclew search "API design" # Multi-word search
|
|
22
|
+
npx openclew search "bug" # Find bug-related logs
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## What it searches
|
|
26
|
+
|
|
27
|
+
- **subject** (weight: 3×) — document title
|
|
28
|
+
- **doc_brief** (weight: 2×) — one-line summary
|
|
29
|
+
- **keywords** (weight: 2×) — tags
|
|
30
|
+
- **category** (weight: 1.5×) — domain
|
|
31
|
+
- **type** (weight: 1×) — Reference, Guide, Bug, Feature...
|
|
32
|
+
- **status** (weight: 0.5×) — Active, Done, Archived...
|
|
33
|
+
|
|
34
|
+
## Reading results
|
|
35
|
+
|
|
36
|
+
Each result shows:
|
|
37
|
+
- Icon: 📘 refdoc or 📝 log
|
|
38
|
+
- Subject and status
|
|
39
|
+
- File path (relative)
|
|
40
|
+
- Brief description
|
|
41
|
+
|
|
42
|
+
After finding a doc, read it at the level you need:
|
|
43
|
+
- **L1** (between `L1_START`/`L1_END`) — subject + brief, ~40 tokens
|
|
44
|
+
- **L2** (between `L2_START`/`L2_END`) — summary, essential context
|
|
45
|
+
- **L3** (between `L3_START`/`L3_END`) — full details, only when deep-diving
|