openclew 0.2.1 → 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 +5 -1
- package/UPGRADING.md +167 -0
- package/bin/openclew.js +46 -18
- package/lib/index-gen.js +100 -25
- package/lib/init.js +42 -31
- package/lib/inject.js +16 -7
- package/lib/mcp-server.js +313 -0
- package/lib/new-doc.js +12 -4
- package/lib/new-log.js +4 -4
- package/lib/search.js +242 -0
- package/lib/status.js +151 -0
- package/lib/templates.js +193 -13
- 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 +1 -1
- package/templates/onboarding/flow.md +59 -0
- package/templates/onboarding/scaffold_index.md +31 -0
- package/templates/refdoc.md +1 -1
- package/hooks/generate-index.py +0 -226
package/lib/status.js
ADDED
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* openclew status — documentation health dashboard.
|
|
3
|
+
*
|
|
4
|
+
* Shows stats, docs missing doc_brief, stale docs, and distribution.
|
|
5
|
+
* Zero dependencies — Node 16+ standard library only.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
const fs = require("fs");
|
|
9
|
+
const path = require("path");
|
|
10
|
+
const { collectDocs, parseFile } = require("./search");
|
|
11
|
+
const { parseLegacyDoc } = require("./migrate");
|
|
12
|
+
|
|
13
|
+
function run() {
|
|
14
|
+
const projectRoot = process.cwd();
|
|
15
|
+
const docDir = path.join(projectRoot, "doc");
|
|
16
|
+
|
|
17
|
+
if (!fs.existsSync(docDir)) {
|
|
18
|
+
console.error("No doc/ directory found. Run 'openclew init' first.");
|
|
19
|
+
process.exit(1);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const docs = collectDocs(docDir);
|
|
23
|
+
const refdocs = docs.filter((d) => d.kind === "refdoc");
|
|
24
|
+
const logs = docs.filter((d) => d.kind === "log");
|
|
25
|
+
|
|
26
|
+
// ── Overview ──────────────────────────────────────────────────
|
|
27
|
+
console.log("openclew status\n");
|
|
28
|
+
console.log(` Refdocs: ${refdocs.length}`);
|
|
29
|
+
console.log(` Logs: ${logs.length}`);
|
|
30
|
+
console.log(` Total: ${docs.length}`);
|
|
31
|
+
console.log("");
|
|
32
|
+
|
|
33
|
+
// ── Legacy format detection ──────────────────────────────────
|
|
34
|
+
let legacyCount = 0;
|
|
35
|
+
for (const d of docs) {
|
|
36
|
+
try {
|
|
37
|
+
const content = fs.readFileSync(d.filepath, "utf-8");
|
|
38
|
+
const parsed = parseLegacyDoc(content);
|
|
39
|
+
if (parsed.isLegacy) legacyCount++;
|
|
40
|
+
} catch {}
|
|
41
|
+
}
|
|
42
|
+
if (legacyCount > 0) {
|
|
43
|
+
console.log(`Legacy format: ${legacyCount} docs need migration`);
|
|
44
|
+
console.log(` Run 'openclew migrate' to preview, 'openclew migrate --write' to apply.\n`);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// ── Missing doc_brief ─────────────────────────────────────────
|
|
48
|
+
const missingBrief = docs.filter(
|
|
49
|
+
(d) => !d.meta.doc_brief || d.meta.doc_brief === ""
|
|
50
|
+
);
|
|
51
|
+
if (missingBrief.length) {
|
|
52
|
+
console.log(`Missing doc_brief (${missingBrief.length}):`);
|
|
53
|
+
for (const d of missingBrief) {
|
|
54
|
+
const relPath = path.relative(projectRoot, d.filepath);
|
|
55
|
+
const subject = d.meta.subject || d.filename;
|
|
56
|
+
console.log(` - ${relPath} (${subject})`);
|
|
57
|
+
}
|
|
58
|
+
console.log("");
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// ── Missing subject ───────────────────────────────────────────
|
|
62
|
+
const missingSubject = docs.filter(
|
|
63
|
+
(d) => !d.meta.subject || d.meta.subject === ""
|
|
64
|
+
);
|
|
65
|
+
if (missingSubject.length) {
|
|
66
|
+
console.log(`Missing subject (${missingSubject.length}):`);
|
|
67
|
+
for (const d of missingSubject) {
|
|
68
|
+
const relPath = path.relative(projectRoot, d.filepath);
|
|
69
|
+
console.log(` - ${relPath}`);
|
|
70
|
+
}
|
|
71
|
+
console.log("");
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// ── Stale refdocs (updated > 30 days ago) ─────────────────────
|
|
75
|
+
const now = new Date();
|
|
76
|
+
const staleThresholdMs = 30 * 24 * 60 * 60 * 1000;
|
|
77
|
+
const staleRefdocs = refdocs.filter((d) => {
|
|
78
|
+
const updated = d.meta.updated || d.meta.created;
|
|
79
|
+
if (!updated) return true; // No date = stale
|
|
80
|
+
const docDate = new Date(updated);
|
|
81
|
+
return !isNaN(docDate.getTime()) && now - docDate > staleThresholdMs;
|
|
82
|
+
});
|
|
83
|
+
if (staleRefdocs.length) {
|
|
84
|
+
console.log(`Stale refdocs (not updated in 30+ days): ${staleRefdocs.length}`);
|
|
85
|
+
for (const d of staleRefdocs) {
|
|
86
|
+
const relPath = path.relative(projectRoot, d.filepath);
|
|
87
|
+
const updated = d.meta.updated || d.meta.created || "no date";
|
|
88
|
+
const subject = d.meta.subject || d.filename;
|
|
89
|
+
console.log(` - ${relPath} (${subject}, last: ${updated})`);
|
|
90
|
+
}
|
|
91
|
+
console.log("");
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// ── Status distribution ───────────────────────────────────────
|
|
95
|
+
const statusCounts = {};
|
|
96
|
+
for (const d of docs) {
|
|
97
|
+
const st = d.meta.status || "—";
|
|
98
|
+
statusCounts[st] = (statusCounts[st] || 0) + 1;
|
|
99
|
+
}
|
|
100
|
+
const statusEntries = Object.entries(statusCounts).sort((a, b) => b[1] - a[1]);
|
|
101
|
+
if (statusEntries.length) {
|
|
102
|
+
console.log("Status distribution:");
|
|
103
|
+
for (const [status, count] of statusEntries) {
|
|
104
|
+
console.log(` ${status}: ${count}`);
|
|
105
|
+
}
|
|
106
|
+
console.log("");
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// ── Category distribution ─────────────────────────────────────
|
|
110
|
+
const catCounts = {};
|
|
111
|
+
for (const d of docs) {
|
|
112
|
+
const cat = d.meta.category || "—";
|
|
113
|
+
if (cat && cat !== "—") catCounts[cat] = (catCounts[cat] || 0) + 1;
|
|
114
|
+
}
|
|
115
|
+
const catEntries = Object.entries(catCounts).sort((a, b) => b[1] - a[1]);
|
|
116
|
+
if (catEntries.length) {
|
|
117
|
+
console.log("Category distribution:");
|
|
118
|
+
for (const [cat, count] of catEntries) {
|
|
119
|
+
console.log(` ${cat}: ${count}`);
|
|
120
|
+
}
|
|
121
|
+
console.log("");
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
// ── Health score ──────────────────────────────────────────────
|
|
125
|
+
const total = docs.length;
|
|
126
|
+
if (total === 0) {
|
|
127
|
+
console.log("Health: no docs yet. Run 'openclew new' to create one.");
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
const withBrief = total - missingBrief.length;
|
|
132
|
+
const withSubject = total - missingSubject.length;
|
|
133
|
+
const freshRefdocs = refdocs.length - staleRefdocs.length;
|
|
134
|
+
const healthPct = Math.round(
|
|
135
|
+
((withBrief + withSubject + freshRefdocs) /
|
|
136
|
+
(total + total + Math.max(refdocs.length, 1))) *
|
|
137
|
+
100
|
|
138
|
+
);
|
|
139
|
+
|
|
140
|
+
console.log(`Health: ${healthPct}%`);
|
|
141
|
+
if (healthPct === 100) {
|
|
142
|
+
console.log(" All docs have subject + doc_brief, no stale refdocs.");
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
module.exports = { run };
|
|
147
|
+
|
|
148
|
+
const calledAsStatus = process.argv.includes("status");
|
|
149
|
+
if (require.main === module || calledAsStatus) {
|
|
150
|
+
run();
|
|
151
|
+
}
|
package/lib/templates.js
CHANGED
|
@@ -163,6 +163,17 @@ Every doc has a metadata line + 3 levels. Read only what you need:
|
|
|
163
163
|
|
|
164
164
|
\`doc/_INDEX.md\` is auto-generated from L1 metadata on every git commit (via a pre-commit hook).
|
|
165
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.
|
|
166
177
|
<!-- L2_END -->
|
|
167
178
|
|
|
168
179
|
---
|
|
@@ -264,15 +275,35 @@ The index (\`doc/_INDEX.md\`) auto-regenerates on every git commit. To force a r
|
|
|
264
275
|
/**
|
|
265
276
|
* Example refdoc — shows what a filled-in doc looks like.
|
|
266
277
|
*/
|
|
267
|
-
function exampleRefdocContent() {
|
|
278
|
+
function exampleRefdocContent(existingInstructions) {
|
|
268
279
|
const date = today();
|
|
269
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
|
+
|
|
270
301
|
return `openclew@${ver} · created: ${date} · updated: ${date} · type: Reference · status: Active · category: Architecture · keywords: [architecture, overview, components]
|
|
271
302
|
|
|
272
303
|
<!-- L1_START -->
|
|
273
304
|
**subject:** Architecture overview
|
|
274
305
|
|
|
275
|
-
**doc_brief:**
|
|
306
|
+
**doc_brief:** <!-- ONE LINE: What does this project do, what's the main stack, how is it deployed? -->
|
|
276
307
|
<!-- L1_END -->
|
|
277
308
|
|
|
278
309
|
---
|
|
@@ -280,13 +311,25 @@ function exampleRefdocContent() {
|
|
|
280
311
|
<!-- L2_START -->
|
|
281
312
|
# L2 - Summary
|
|
282
313
|
|
|
283
|
-
##
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
##
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
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
|
+
-->
|
|
290
333
|
<!-- L2_END -->
|
|
291
334
|
|
|
292
335
|
---
|
|
@@ -294,10 +337,21 @@ Document the high-level architecture so new contributors and AI agents understan
|
|
|
294
337
|
<!-- L3_START -->
|
|
295
338
|
# L3 - Details
|
|
296
339
|
|
|
297
|
-
|
|
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. -->
|
|
347
|
+
|
|
348
|
+
## How to run
|
|
349
|
+
<!-- Commands to start the project locally. e.g.:
|
|
350
|
+
npm install && npm run dev
|
|
351
|
+
-->
|
|
298
352
|
|
|
299
|
-
|
|
300
|
-
|
|
353
|
+
## Known constraints
|
|
354
|
+
<!-- Limits, technical debt, or things that don't scale. -->
|
|
301
355
|
|
|
302
356
|
---
|
|
303
357
|
|
|
@@ -305,7 +359,7 @@ Edit it to document your project's architecture, or delete it and create your ow
|
|
|
305
359
|
|
|
306
360
|
| Date | Change |
|
|
307
361
|
|------|--------|
|
|
308
|
-
| ${date} | Created by openclew init
|
|
362
|
+
| ${date} | Created by openclew init — fill this in! |
|
|
309
363
|
<!-- L3_END -->
|
|
310
364
|
`;
|
|
311
365
|
}
|
|
@@ -352,10 +406,136 @@ For evolving knowledge, use refdocs (\`doc/_*.md\`).
|
|
|
352
406
|
`;
|
|
353
407
|
}
|
|
354
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 |
|
|
530
|
+
<!-- L3_END -->
|
|
531
|
+
`;
|
|
532
|
+
}
|
|
533
|
+
|
|
355
534
|
module.exports = {
|
|
356
535
|
refdocContent,
|
|
357
536
|
logContent,
|
|
358
537
|
guideContent,
|
|
538
|
+
frameworkIntegrationContent,
|
|
359
539
|
exampleRefdocContent,
|
|
360
540
|
exampleLogContent,
|
|
361
541
|
slugify,
|
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
|