@veewo/claw 0.2.11 → 0.2.13
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 +127 -127
- package/dist/cli.js +27 -3
- package/dist/cli.js.map +1 -1
- package/dist/codex-driver.d.ts +2 -2
- package/dist/codex-driver.js +4 -8
- package/dist/codex-driver.js.map +1 -1
- package/package.json +45 -45
package/README.md
CHANGED
|
@@ -1,127 +1,127 @@
|
|
|
1
|
-
# @veewo/claw
|
|
2
|
-
|
|
3
|
-
`@veewo/claw` is the CLI entrypoint for running the `.claw` workflow in a project.
|
|
4
|
-
|
|
5
|
-
It gives agents and developers a concrete way to plan work, recall project knowledge, deposit truth and ADR notes, and close rounds out cleanly instead of leaving project state scattered across transient chats.
|
|
6
|
-
|
|
7
|
-
## What the CLI is for
|
|
8
|
-
|
|
9
|
-
- initialize and normalize the `.claw` project surface
|
|
10
|
-
- run project-scoped planning and task lifecycle commands
|
|
11
|
-
- index and query project documentation recall
|
|
12
|
-
- support truth ingestion and closeout flows
|
|
13
|
-
|
|
14
|
-
## Install
|
|
15
|
-
|
|
16
|
-
```bash
|
|
17
|
-
npm install -g @veewo/claw
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
After installing the CLI, project search still needs one-time setup inside each `.claw` project:
|
|
21
|
-
|
|
22
|
-
1. Run `claw context` so `.claw/project.json` is normalized and the default local embedding config is present.
|
|
23
|
-
2. Run `claw search index --refresh` once so the local embedding model can be downloaded or reused and the first vector index can be built.
|
|
24
|
-
|
|
25
|
-
Then run:
|
|
26
|
-
|
|
27
|
-
```bash
|
|
28
|
-
claw init
|
|
29
|
-
claw search index --refresh
|
|
30
|
-
claw search "existing truth or ADR topic"
|
|
31
|
-
claw plan create --title "My task" --goal "Define the first task"
|
|
32
|
-
claw plan create "My templated task" --template default --goal "Route through the default template"
|
|
33
|
-
claw plan create "Ephemeral harness" --scope session --goal "Use plan and Goal workflows without project deposition"
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
`claw plan create` uses explicit `--template` first, otherwise the project's configured `defaultPlanTemplate`, and finally falls back to the built-in `default` template. You can select a template explicitly with `claw plan create "<title>" --template <name>` or `claw plan create --template <name> --title "<title>"`.
|
|
37
|
-
|
|
38
|
-
New project tasks are grouped under `.claw/tasks/YYYY-MM-DD/`. On the first `claw context` call of each local calendar day, claw performs a lock-protected maintenance pass: it removes expired entries from `.claw/runtime/tmp/`, removes workflow task directories that exceed the task TTL even when incomplete, moves eligible date-scoped task folders into the archive, applies `maxTasksToKeep` and archive TTL, removes expired or invalid bindings, and sweeps expired session workflows. This is lazy maintenance, not a background scheduler.
|
|
39
|
-
|
|
40
|
-
`--scope session` stores the workflow in a user-level directory keyed by the platform session id, so it works without a project `.claw` directory and recovers across cwd changes. It preserves plan/task/subplan/Goal behavior while disabling project knowledge capture, memory/GitNexus refresh, and project retention. Use `claw session clean` for the current session or `claw session clean --expired` for the seven-day TTL sweep.
|
|
41
|
-
|
|
42
|
-
Projects can add reusable templates directly under `.claw/templates` with `.json`, `.js`, `.mjs`, or `.cjs` files. Put `defaultPlanTemplate` in `.claw/project.json` for a shared team default, or in `.claw/project-override.json` for a local personal override.
|
|
43
|
-
|
|
44
|
-
When `.claw/project.json` has `planning: true`, the default `default` template seeds one planning task in `process.discussing`. It loads the effective `externalPlanningSkill`, falling back to `claw-kit:planning`, and stays open while the requirements and proposed solution are discussed and confirmed with the user. Use `plan start` when execution tasks remain; when planning itself resolves the request, complete task 1 and close the plan.
|
|
45
|
-
|
|
46
|
-
When `planning: false`, `claw plan create` seeds the smallest executable plan directly in `process.active`.
|
|
47
|
-
|
|
48
|
-
## Workflow shape
|
|
49
|
-
|
|
50
|
-
In a typical round, the CLI helps land this loop in a project:
|
|
51
|
-
|
|
52
|
-
`plan` -> `search and recall` -> `execute` -> `deposit truth / ADR` -> `close out`
|
|
53
|
-
|
|
54
|
-
That project-level plan structure helps agents carry longer-running work more cleanly than leaving the task in loose chat state alone.
|
|
55
|
-
|
|
56
|
-
## Persistent sessions
|
|
57
|
-
|
|
58
|
-
Open a persistent terminal with:
|
|
59
|
-
|
|
60
|
-
```bash
|
|
61
|
-
claw session open <dir> <agent-session-id>
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
The workdir is immutable for the lifetime of that session. Opening another
|
|
65
|
-
directory closes the prior live connection and opens the composite identity
|
|
66
|
-
`(canonical workdir, agent session id)`; two directories with the same agent id
|
|
67
|
-
remain isolated.
|
|
68
|
-
|
|
69
|
-
Inside the terminal, these commands implicitly target `currentPlan`:
|
|
70
|
-
|
|
71
|
-
```text
|
|
72
|
-
plan show [--simple]
|
|
73
|
-
plan edit ...
|
|
74
|
-
plan wait
|
|
75
|
-
plan done --retrospective "..."
|
|
76
|
-
task add ...
|
|
77
|
-
task edit --id ...
|
|
78
|
-
task done --id ...
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
Use `plan resume` to resume the retained current plan, `plan resume <planId>` to
|
|
82
|
-
make a specified resumable plan current, and `plan leave` to enter
|
|
83
|
-
`end.leave` and clear focus. Every `end.*` triggers end-state finalization;
|
|
84
|
-
`end.leave` remains resumable and does not set `completedAt`.
|
|
85
|
-
|
|
86
|
-
`search --dir <dir> <query>` changes only that search operation. It never
|
|
87
|
-
changes the session workdir or current plan.
|
|
88
|
-
|
|
89
|
-
On an interrupted connection, mutations are never replayed automatically.
|
|
90
|
-
Reopen with the exact command returned by the error, then inspect
|
|
91
|
-
`plan show --simple`. Retained v2 state expires seven days after its last
|
|
92
|
-
update. Legacy session caches are not migrated and canonical plans are never
|
|
93
|
-
deleted by v2 cleanup.
|
|
94
|
-
|
|
95
|
-
Host adapters remain compatible with the stateless CLI. They can adopt
|
|
96
|
-
`@veewo/claw-client` incrementally once they consume the same structured
|
|
97
|
-
post-commit effects; opening a persistent session does not change existing
|
|
98
|
-
adapter behavior.
|
|
99
|
-
|
|
100
|
-
Codex startup workflow should rely on the session hook or startup recovery path instead of treating any extra manual recovery step as required after plan creation.
|
|
101
|
-
|
|
102
|
-
## Search and recall
|
|
103
|
-
|
|
104
|
-
`claw search` is the project recall command for `.claw` memory, truth, ADR, and declared markdown docs. Use it for retained project context rather than code search.
|
|
105
|
-
|
|
106
|
-
When a task needs deeper code investigation or relationship tracing, GitNexus can complement this workflow, but it is optional rather than required for using `claw` itself.
|
|
107
|
-
|
|
108
|
-
Typical setup:
|
|
109
|
-
|
|
110
|
-
```bash
|
|
111
|
-
claw context
|
|
112
|
-
claw search index --refresh
|
|
113
|
-
```
|
|
114
|
-
|
|
115
|
-
If you need deeper backup detail on config or recall behavior, use the adapter reference notes in [packages/codex-adapter/references/project-config-reference.md](../codex-adapter/references/project-config-reference.md) or [packages/opencode-adapter/references/project-config-reference.md](../opencode-adapter/references/project-config-reference.md).
|
|
116
|
-
|
|
117
|
-
## Configuration
|
|
118
|
-
|
|
119
|
-
If you need backup `.claw/project.json` detail, start with the adapter reference notes above and use [docs/project-json-reference.md](../../docs/project-json-reference.md) only for deeper canonical detail.
|
|
120
|
-
|
|
121
|
-
`claw-kit` also stays usable alongside other harnesses or external skills, so the CLI does not assume a single host or investigation surface.
|
|
122
|
-
|
|
123
|
-
The config model is team-friendly as well: `.claw/project.json` carries the shared canonical workflow, while `.claw/project-override.json` leaves room for personal runtime preferences.
|
|
124
|
-
|
|
125
|
-
## Repository
|
|
126
|
-
|
|
127
|
-
- [claw-kit](https://github.com/chanyuenpang/claw-kit)
|
|
1
|
+
# @veewo/claw
|
|
2
|
+
|
|
3
|
+
`@veewo/claw` is the CLI entrypoint for running the `.claw` workflow in a project.
|
|
4
|
+
|
|
5
|
+
It gives agents and developers a concrete way to plan work, recall project knowledge, deposit truth and ADR notes, and close rounds out cleanly instead of leaving project state scattered across transient chats.
|
|
6
|
+
|
|
7
|
+
## What the CLI is for
|
|
8
|
+
|
|
9
|
+
- initialize and normalize the `.claw` project surface
|
|
10
|
+
- run project-scoped planning and task lifecycle commands
|
|
11
|
+
- index and query project documentation recall
|
|
12
|
+
- support truth ingestion and closeout flows
|
|
13
|
+
|
|
14
|
+
## Install
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npm install -g @veewo/claw
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
After installing the CLI, project search still needs one-time setup inside each `.claw` project:
|
|
21
|
+
|
|
22
|
+
1. Run `claw context` so `.claw/project.json` is normalized and the default local embedding config is present.
|
|
23
|
+
2. Run `claw search index --refresh` once so the local embedding model can be downloaded or reused and the first vector index can be built.
|
|
24
|
+
|
|
25
|
+
Then run:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
claw init
|
|
29
|
+
claw search index --refresh
|
|
30
|
+
claw search "existing truth or ADR topic"
|
|
31
|
+
claw plan create --title "My task" --goal "Define the first task"
|
|
32
|
+
claw plan create "My templated task" --template default --goal "Route through the default template"
|
|
33
|
+
claw plan create "Ephemeral harness" --scope session --goal "Use plan and Goal workflows without project deposition"
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
`claw plan create` uses explicit `--template` first, otherwise the project's configured `defaultPlanTemplate`, and finally falls back to the built-in `default` template. You can select a template explicitly with `claw plan create "<title>" --template <name>` or `claw plan create --template <name> --title "<title>"`.
|
|
37
|
+
|
|
38
|
+
New project tasks are grouped under `.claw/tasks/YYYY-MM-DD/`. On the first `claw context` call of each local calendar day, claw performs a lock-protected maintenance pass: it removes expired entries from `.claw/runtime/tmp/`, removes workflow task directories that exceed the task TTL even when incomplete, moves eligible date-scoped task folders into the archive, applies `maxTasksToKeep` and archive TTL, removes expired or invalid bindings, and sweeps expired session workflows. This is lazy maintenance, not a background scheduler.
|
|
39
|
+
|
|
40
|
+
`--scope session` stores the workflow in a user-level directory keyed by the platform session id, so it works without a project `.claw` directory and recovers across cwd changes. It preserves plan/task/subplan/Goal behavior while disabling project knowledge capture, memory/GitNexus refresh, and project retention. Use `claw session clean` for the current session or `claw session clean --expired` for the seven-day TTL sweep.
|
|
41
|
+
|
|
42
|
+
Projects can add reusable templates directly under `.claw/templates` with `.json`, `.js`, `.mjs`, or `.cjs` files. Put `defaultPlanTemplate` in `.claw/project.json` for a shared team default, or in `.claw/project-override.json` for a local personal override.
|
|
43
|
+
|
|
44
|
+
When `.claw/project.json` has `planning: true`, the default `default` template seeds one planning task in `process.discussing`. It loads the effective `externalPlanningSkill`, falling back to `claw-kit:planning`, and stays open while the requirements and proposed solution are discussed and confirmed with the user. Use `plan start` when execution tasks remain; when planning itself resolves the request, complete task 1 and close the plan.
|
|
45
|
+
|
|
46
|
+
When `planning: false`, `claw plan create` seeds the smallest executable plan directly in `process.active`.
|
|
47
|
+
|
|
48
|
+
## Workflow shape
|
|
49
|
+
|
|
50
|
+
In a typical round, the CLI helps land this loop in a project:
|
|
51
|
+
|
|
52
|
+
`plan` -> `search and recall` -> `execute` -> `deposit truth / ADR` -> `close out`
|
|
53
|
+
|
|
54
|
+
That project-level plan structure helps agents carry longer-running work more cleanly than leaving the task in loose chat state alone.
|
|
55
|
+
|
|
56
|
+
## Persistent sessions
|
|
57
|
+
|
|
58
|
+
Open a persistent terminal with:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
claw session open <dir> <agent-session-id>
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
The workdir is immutable for the lifetime of that session. Opening another
|
|
65
|
+
directory closes the prior live connection and opens the composite identity
|
|
66
|
+
`(canonical workdir, agent session id)`; two directories with the same agent id
|
|
67
|
+
remain isolated.
|
|
68
|
+
|
|
69
|
+
Inside the terminal, these commands implicitly target `currentPlan`:
|
|
70
|
+
|
|
71
|
+
```text
|
|
72
|
+
plan show [--simple]
|
|
73
|
+
plan edit ...
|
|
74
|
+
plan wait
|
|
75
|
+
plan done --retrospective "..."
|
|
76
|
+
task add ...
|
|
77
|
+
task edit --id ...
|
|
78
|
+
task done --id ...
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Use `plan resume` to resume the retained current plan, `plan resume <planId>` to
|
|
82
|
+
make a specified resumable plan current, and `plan leave` to enter
|
|
83
|
+
`end.leave` and clear focus. Every `end.*` triggers end-state finalization;
|
|
84
|
+
`end.leave` remains resumable and does not set `completedAt`.
|
|
85
|
+
|
|
86
|
+
`search --dir <dir> <query>` changes only that search operation. It never
|
|
87
|
+
changes the session workdir or current plan.
|
|
88
|
+
|
|
89
|
+
On an interrupted connection, mutations are never replayed automatically.
|
|
90
|
+
Reopen with the exact command returned by the error, then inspect
|
|
91
|
+
`plan show --simple`. Retained v2 state expires seven days after its last
|
|
92
|
+
update. Legacy session caches are not migrated and canonical plans are never
|
|
93
|
+
deleted by v2 cleanup.
|
|
94
|
+
|
|
95
|
+
Host adapters remain compatible with the stateless CLI. They can adopt
|
|
96
|
+
`@veewo/claw-client` incrementally once they consume the same structured
|
|
97
|
+
post-commit effects; opening a persistent session does not change existing
|
|
98
|
+
adapter behavior.
|
|
99
|
+
|
|
100
|
+
Codex startup workflow should rely on the session hook or startup recovery path instead of treating any extra manual recovery step as required after plan creation.
|
|
101
|
+
|
|
102
|
+
## Search and recall
|
|
103
|
+
|
|
104
|
+
`claw search` is the project recall command for `.claw` memory, truth, ADR, and declared markdown docs. Use it for retained project context rather than code search.
|
|
105
|
+
|
|
106
|
+
When a task needs deeper code investigation or relationship tracing, GitNexus can complement this workflow, but it is optional rather than required for using `claw` itself.
|
|
107
|
+
|
|
108
|
+
Typical setup:
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
claw context
|
|
112
|
+
claw search index --refresh
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
If you need deeper backup detail on config or recall behavior, use the adapter reference notes in [packages/codex-adapter/references/project-config-reference.md](../codex-adapter/references/project-config-reference.md) or [packages/opencode-adapter/references/project-config-reference.md](../opencode-adapter/references/project-config-reference.md).
|
|
116
|
+
|
|
117
|
+
## Configuration
|
|
118
|
+
|
|
119
|
+
If you need backup `.claw/project.json` detail, start with the adapter reference notes above and use [docs/project-json-reference.md](../../docs/project-json-reference.md) only for deeper canonical detail.
|
|
120
|
+
|
|
121
|
+
`claw-kit` also stays usable alongside other harnesses or external skills, so the CLI does not assume a single host or investigation surface.
|
|
122
|
+
|
|
123
|
+
The config model is team-friendly as well: `.claw/project.json` carries the shared canonical workflow, while `.claw/project-override.json` leaves room for personal runtime preferences.
|
|
124
|
+
|
|
125
|
+
## Repository
|
|
126
|
+
|
|
127
|
+
- [claw-kit](https://github.com/chanyuenpang/claw-kit)
|
package/dist/cli.js
CHANGED
|
@@ -1215,6 +1215,7 @@ async function runPlan(args, effectiveHost) {
|
|
|
1215
1215
|
if (!title) {
|
|
1216
1216
|
throw new ClawError("PROJECT_CONFIG_INVALID", "plan create requires a title. Use `claw plan create \"<title>\"` or `claw plan create --title \"<title>\"`.");
|
|
1217
1217
|
}
|
|
1218
|
+
await preparePlanCreateWorkflow(process.cwd(), resolveOwnerSessionKey(), effectiveHost, scope);
|
|
1218
1219
|
const result = await writePlan({
|
|
1219
1220
|
cwd: process.cwd(),
|
|
1220
1221
|
scope,
|
|
@@ -2166,6 +2167,26 @@ function completeKnowledgeFinalizationJob(jobPath, result, claimToken) {
|
|
|
2166
2167
|
});
|
|
2167
2168
|
printJson({ ok: true, completed: true, alreadyDone: terminal.alreadyDone, finalizeId: running.finalizeId });
|
|
2168
2169
|
}
|
|
2170
|
+
async function preparePlanCreateWorkflow(cwd, ownerSessionKey, effectiveHost, requestedScope) {
|
|
2171
|
+
if (requestedScope === "session" || resolveSessionWorkflowContext(ownerSessionKey ?? undefined)) {
|
|
2172
|
+
return;
|
|
2173
|
+
}
|
|
2174
|
+
const project = tryResolveHookProject(cwd);
|
|
2175
|
+
if (!project) {
|
|
2176
|
+
return;
|
|
2177
|
+
}
|
|
2178
|
+
await prepareProjectWorkflow(cwd, ownerSessionKey, effectiveHost, project);
|
|
2179
|
+
}
|
|
2180
|
+
async function prepareProjectWorkflow(cwd, ownerSessionKey, effectiveHost, project = tryResolveHookProject(cwd)) {
|
|
2181
|
+
const sessionProject = resolveSessionWorkflowContext(ownerSessionKey ?? undefined);
|
|
2182
|
+
if (sessionProject) {
|
|
2183
|
+
return runContextCommand([], cwd, ownerSessionKey, effectiveHost);
|
|
2184
|
+
}
|
|
2185
|
+
if (!project) {
|
|
2186
|
+
return null;
|
|
2187
|
+
}
|
|
2188
|
+
return runContextCommand([], cwd, ownerSessionKey, effectiveHost);
|
|
2189
|
+
}
|
|
2169
2190
|
function resolveKnowledgeJobProject(jobPath, job) {
|
|
2170
2191
|
const project = resolveProjectContext(job.projectRoot);
|
|
2171
2192
|
const sessionProject = resolveSessionWorkflowContext(job.sessionId);
|
|
@@ -2462,7 +2483,10 @@ async function runSessionStartHook(effectiveHost) {
|
|
|
2462
2483
|
return;
|
|
2463
2484
|
}
|
|
2464
2485
|
try {
|
|
2465
|
-
const context = await
|
|
2486
|
+
const context = await prepareProjectWorkflow(hookCwd, ownerSessionKey, effectiveHost);
|
|
2487
|
+
if (!context) {
|
|
2488
|
+
return;
|
|
2489
|
+
}
|
|
2466
2490
|
const contextProject = asJsonRecord(context.project);
|
|
2467
2491
|
const retryableJobs = effectiveHost !== "cindy" && contextProject?.scope !== "session" && !context.error
|
|
2468
2492
|
? listRetryableKnowledgeFinalizationJobs(resolveProjectContext(hookCwd), { excludeHosts: ["cindy"] })
|
|
@@ -2967,11 +2991,11 @@ function compactPlanCommandResult(command, result, effectiveHost, completionRefr
|
|
|
2967
2991
|
...(!codexResult && result.changedTaskIds?.length ? { changedTaskIds: result.changedTaskIds } : {}),
|
|
2968
2992
|
...(!codexResult && result.appendedTaskIds?.length ? { appendedTaskIds: result.appendedTaskIds } : {}),
|
|
2969
2993
|
...(codexResult ? { stage: result.workflowGuidance.stage } : {}),
|
|
2970
|
-
...(
|
|
2994
|
+
...(codexResult || !cindyResult
|
|
2971
2995
|
? { nextsteps }
|
|
2972
2996
|
: {}),
|
|
2973
2997
|
...(result.workflowGuidance.nextTask ? { nextTask: result.workflowGuidance.nextTask } : {}),
|
|
2974
|
-
...(result.workflowGuidance.notes?.trim() && !
|
|
2998
|
+
...(result.workflowGuidance.notes?.trim() && !cindyResult
|
|
2975
2999
|
? { notes: result.workflowGuidance.notes }
|
|
2976
3000
|
: {}),
|
|
2977
3001
|
...(result.workflowGuidance.commandHints?.length
|