@veewo/claw 0.2.14 → 0.2.16
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 +141 -141
- package/dist/cli.js +8 -30
- package/dist/cli.js.map +1 -1
- package/dist/codex-transcript.d.ts +1 -1
- package/dist/codex-transcript.js +54 -2
- package/dist/codex-transcript.js.map +1 -1
- package/package.json +45 -45
package/README.md
CHANGED
|
@@ -1,141 +1,141 @@
|
|
|
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
|
-
## Host startup context
|
|
26
|
-
|
|
27
|
-
`claw context --host <host>` is the single structured startup-state entrypoint
|
|
28
|
-
for host adapters. A host Hook owns its native event payload, validates its
|
|
29
|
-
trusted cwd and session identity, invokes `context`, and maps the JSON result
|
|
30
|
-
to its own prompt, card, or host-action surface. The CLI does not own platform
|
|
31
|
-
Hook event names or Hook-output envelopes.
|
|
32
|
-
|
|
33
|
-
The result may contain `activeWorkflow`, `error`, `startupRecovery.versionSync`,
|
|
34
|
-
and `searchGuidance`, in addition to project and session state. Adapters must
|
|
35
|
-
not accept cwd or session identity from model input. A missing `activeWorkflow`
|
|
36
|
-
means the session has no bound plan; it does not authorize plan discovery by
|
|
37
|
-
scanning unrelated project tasks.
|
|
38
|
-
|
|
39
|
-
Then run:
|
|
40
|
-
|
|
41
|
-
```bash
|
|
42
|
-
claw init
|
|
43
|
-
claw search index --refresh
|
|
44
|
-
claw search "existing truth or ADR topic"
|
|
45
|
-
claw plan create --title "My task" --goal "Define the first task"
|
|
46
|
-
claw plan create "My templated task" --template default --goal "Route through the default template"
|
|
47
|
-
claw plan create "Ephemeral harness" --scope session --goal "Use plan and Goal workflows without project deposition"
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
`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>"`.
|
|
51
|
-
|
|
52
|
-
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.
|
|
53
|
-
|
|
54
|
-
`--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.
|
|
55
|
-
|
|
56
|
-
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.
|
|
57
|
-
|
|
58
|
-
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.
|
|
59
|
-
|
|
60
|
-
When `planning: false`, `claw plan create` seeds the smallest executable plan directly in `process.active`.
|
|
61
|
-
|
|
62
|
-
## Workflow shape
|
|
63
|
-
|
|
64
|
-
In a typical round, the CLI helps land this loop in a project:
|
|
65
|
-
|
|
66
|
-
`plan` -> `search and recall` -> `execute` -> `deposit truth / ADR` -> `close out`
|
|
67
|
-
|
|
68
|
-
That project-level plan structure helps agents carry longer-running work more cleanly than leaving the task in loose chat state alone.
|
|
69
|
-
|
|
70
|
-
## Persistent sessions
|
|
71
|
-
|
|
72
|
-
Open a persistent terminal with:
|
|
73
|
-
|
|
74
|
-
```bash
|
|
75
|
-
claw session open <dir> <agent-session-id>
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
The workdir is immutable for the lifetime of that session. Opening another
|
|
79
|
-
directory closes the prior live connection and opens the composite identity
|
|
80
|
-
`(canonical workdir, agent session id)`; two directories with the same agent id
|
|
81
|
-
remain isolated.
|
|
82
|
-
|
|
83
|
-
Inside the terminal, these commands implicitly target `currentPlan`:
|
|
84
|
-
|
|
85
|
-
```text
|
|
86
|
-
plan show [--simple]
|
|
87
|
-
plan edit ...
|
|
88
|
-
plan wait
|
|
89
|
-
plan done --retrospective "..."
|
|
90
|
-
task add ...
|
|
91
|
-
task edit --id ...
|
|
92
|
-
task done --id ...
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
Use `plan resume` to resume the retained current plan, `plan resume <planId>` to
|
|
96
|
-
make a specified resumable plan current, and `plan leave` to enter
|
|
97
|
-
`end.leave` and clear focus. Every `end.*` triggers end-state finalization;
|
|
98
|
-
`end.leave` remains resumable and does not set `completedAt`.
|
|
99
|
-
|
|
100
|
-
`search --dir <dir> <query>` changes only that search operation. It never
|
|
101
|
-
changes the session workdir or current plan.
|
|
102
|
-
|
|
103
|
-
On an interrupted connection, mutations are never replayed automatically.
|
|
104
|
-
Reopen with the exact command returned by the error, then inspect
|
|
105
|
-
`plan show --simple`. Retained v2 state expires seven days after its last
|
|
106
|
-
update. Legacy session caches are not migrated and canonical plans are never
|
|
107
|
-
deleted by v2 cleanup.
|
|
108
|
-
|
|
109
|
-
Host adapters remain compatible with the stateless CLI. They can adopt
|
|
110
|
-
`@veewo/claw-client` incrementally once they consume the same structured
|
|
111
|
-
post-commit effects; opening a persistent session does not change existing
|
|
112
|
-
adapter behavior.
|
|
113
|
-
|
|
114
|
-
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.
|
|
115
|
-
|
|
116
|
-
## Search and recall
|
|
117
|
-
|
|
118
|
-
`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.
|
|
119
|
-
|
|
120
|
-
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.
|
|
121
|
-
|
|
122
|
-
Typical setup:
|
|
123
|
-
|
|
124
|
-
```bash
|
|
125
|
-
claw context
|
|
126
|
-
claw search index --refresh
|
|
127
|
-
```
|
|
128
|
-
|
|
129
|
-
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).
|
|
130
|
-
|
|
131
|
-
## Configuration
|
|
132
|
-
|
|
133
|
-
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.
|
|
134
|
-
|
|
135
|
-
`claw-kit` also stays usable alongside other harnesses or external skills, so the CLI does not assume a single host or investigation surface.
|
|
136
|
-
|
|
137
|
-
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.
|
|
138
|
-
|
|
139
|
-
## Repository
|
|
140
|
-
|
|
141
|
-
- [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
|
+
## Host startup context
|
|
26
|
+
|
|
27
|
+
`claw context --host <host>` is the single structured startup-state entrypoint
|
|
28
|
+
for host adapters. A host Hook owns its native event payload, validates its
|
|
29
|
+
trusted cwd and session identity, invokes `context`, and maps the JSON result
|
|
30
|
+
to its own prompt, card, or host-action surface. The CLI does not own platform
|
|
31
|
+
Hook event names or Hook-output envelopes.
|
|
32
|
+
|
|
33
|
+
The result may contain `activeWorkflow`, `error`, `startupRecovery.versionSync`,
|
|
34
|
+
and `searchGuidance`, in addition to project and session state. Adapters must
|
|
35
|
+
not accept cwd or session identity from model input. A missing `activeWorkflow`
|
|
36
|
+
means the session has no bound plan; it does not authorize plan discovery by
|
|
37
|
+
scanning unrelated project tasks.
|
|
38
|
+
|
|
39
|
+
Then run:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
claw init
|
|
43
|
+
claw search index --refresh
|
|
44
|
+
claw search "existing truth or ADR topic"
|
|
45
|
+
claw plan create --title "My task" --goal "Define the first task"
|
|
46
|
+
claw plan create "My templated task" --template default --goal "Route through the default template"
|
|
47
|
+
claw plan create "Ephemeral harness" --scope session --goal "Use plan and Goal workflows without project deposition"
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
`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>"`.
|
|
51
|
+
|
|
52
|
+
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.
|
|
53
|
+
|
|
54
|
+
`--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.
|
|
55
|
+
|
|
56
|
+
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.
|
|
57
|
+
|
|
58
|
+
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.
|
|
59
|
+
|
|
60
|
+
When `planning: false`, `claw plan create` seeds the smallest executable plan directly in `process.active`.
|
|
61
|
+
|
|
62
|
+
## Workflow shape
|
|
63
|
+
|
|
64
|
+
In a typical round, the CLI helps land this loop in a project:
|
|
65
|
+
|
|
66
|
+
`plan` -> `search and recall` -> `execute` -> `deposit truth / ADR` -> `close out`
|
|
67
|
+
|
|
68
|
+
That project-level plan structure helps agents carry longer-running work more cleanly than leaving the task in loose chat state alone.
|
|
69
|
+
|
|
70
|
+
## Persistent sessions
|
|
71
|
+
|
|
72
|
+
Open a persistent terminal with:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
claw session open <dir> <agent-session-id>
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
The workdir is immutable for the lifetime of that session. Opening another
|
|
79
|
+
directory closes the prior live connection and opens the composite identity
|
|
80
|
+
`(canonical workdir, agent session id)`; two directories with the same agent id
|
|
81
|
+
remain isolated.
|
|
82
|
+
|
|
83
|
+
Inside the terminal, these commands implicitly target `currentPlan`:
|
|
84
|
+
|
|
85
|
+
```text
|
|
86
|
+
plan show [--simple]
|
|
87
|
+
plan edit ...
|
|
88
|
+
plan wait
|
|
89
|
+
plan done --retrospective "..."
|
|
90
|
+
task add ...
|
|
91
|
+
task edit --id ...
|
|
92
|
+
task done --id ...
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
Use `plan resume` to resume the retained current plan, `plan resume <planId>` to
|
|
96
|
+
make a specified resumable plan current, and `plan leave` to enter
|
|
97
|
+
`end.leave` and clear focus. Every `end.*` triggers end-state finalization;
|
|
98
|
+
`end.leave` remains resumable and does not set `completedAt`.
|
|
99
|
+
|
|
100
|
+
`search --dir <dir> <query>` changes only that search operation. It never
|
|
101
|
+
changes the session workdir or current plan.
|
|
102
|
+
|
|
103
|
+
On an interrupted connection, mutations are never replayed automatically.
|
|
104
|
+
Reopen with the exact command returned by the error, then inspect
|
|
105
|
+
`plan show --simple`. Retained v2 state expires seven days after its last
|
|
106
|
+
update. Legacy session caches are not migrated and canonical plans are never
|
|
107
|
+
deleted by v2 cleanup.
|
|
108
|
+
|
|
109
|
+
Host adapters remain compatible with the stateless CLI. They can adopt
|
|
110
|
+
`@veewo/claw-client` incrementally once they consume the same structured
|
|
111
|
+
post-commit effects; opening a persistent session does not change existing
|
|
112
|
+
adapter behavior.
|
|
113
|
+
|
|
114
|
+
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.
|
|
115
|
+
|
|
116
|
+
## Search and recall
|
|
117
|
+
|
|
118
|
+
`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.
|
|
119
|
+
|
|
120
|
+
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.
|
|
121
|
+
|
|
122
|
+
Typical setup:
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
claw context
|
|
126
|
+
claw search index --refresh
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
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).
|
|
130
|
+
|
|
131
|
+
## Configuration
|
|
132
|
+
|
|
133
|
+
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.
|
|
134
|
+
|
|
135
|
+
`claw-kit` also stays usable alongside other harnesses or external skills, so the CLI does not assume a single host or investigation surface.
|
|
136
|
+
|
|
137
|
+
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.
|
|
138
|
+
|
|
139
|
+
## Repository
|
|
140
|
+
|
|
141
|
+
- [claw-kit](https://github.com/chanyuenpang/claw-kit)
|
package/dist/cli.js
CHANGED
|
@@ -535,7 +535,7 @@ async function main() {
|
|
|
535
535
|
await runSearch(args);
|
|
536
536
|
return;
|
|
537
537
|
case "knowledge":
|
|
538
|
-
runKnowledge(args);
|
|
538
|
+
await runKnowledge(args);
|
|
539
539
|
return;
|
|
540
540
|
case "direct":
|
|
541
541
|
runDirect(args, effectiveHost);
|
|
@@ -1018,7 +1018,7 @@ function readCindyKnowledgeClaimCaptureInput() {
|
|
|
1018
1018
|
}
|
|
1019
1019
|
return { sessionId, turnId, taskConclusions };
|
|
1020
1020
|
}
|
|
1021
|
-
function runKnowledge(args) {
|
|
1021
|
+
async function runKnowledge(args) {
|
|
1022
1022
|
const subcommand = args.shift();
|
|
1023
1023
|
switch (subcommand) {
|
|
1024
1024
|
case "list": {
|
|
@@ -1096,6 +1096,10 @@ function runKnowledge(args) {
|
|
|
1096
1096
|
if (!jobPath) {
|
|
1097
1097
|
throw new Error(`Knowledge finalization ${finalizeId} is unavailable.`);
|
|
1098
1098
|
}
|
|
1099
|
+
const queued = readKnowledgeFinalizationJob(jobPath);
|
|
1100
|
+
if (queued.host === "codex" && queued.writer?.executionPolicy === "subagent" && queued.reportCapture?.mode === "claim" && queued.reportCapture.status !== "captured") {
|
|
1101
|
+
await new Promise((resolve) => setTimeout(resolve, 10_000));
|
|
1102
|
+
}
|
|
1099
1103
|
const job = claimKnowledgeFinalizationJob(jobPath, {
|
|
1100
1104
|
prepare: (queued) => {
|
|
1101
1105
|
if (queued.writer?.executionPolicy !== "subagent"
|
|
@@ -1128,7 +1132,7 @@ function runKnowledge(args) {
|
|
|
1128
1132
|
if (!transcriptPath) {
|
|
1129
1133
|
throw new Error(`Codex transcript is unavailable for knowledge session ${queued.sessionId}.`);
|
|
1130
1134
|
}
|
|
1131
|
-
const conclusions = extractTaskDoneConclusions(transcriptPath, undefined, queued.reportCapture.startedAt);
|
|
1135
|
+
const conclusions = extractTaskDoneConclusions(transcriptPath, undefined, queued.reportCapture.startedAt, queued.planPath);
|
|
1132
1136
|
const capturedAt = new Date().toISOString();
|
|
1133
1137
|
appendKnowledgeTaskConclusions(queued.reportPath, queued.sessionId, conclusions, capturedAt);
|
|
1134
1138
|
return {
|
|
@@ -1601,7 +1605,6 @@ function runDirect(args, effectiveHost) {
|
|
|
1601
1605
|
cwd: process.cwd(),
|
|
1602
1606
|
taskName: "__direct__",
|
|
1603
1607
|
includeTaskRetention: false,
|
|
1604
|
-
includeTaskMemory: false,
|
|
1605
1608
|
statusLabel: "direct",
|
|
1606
1609
|
});
|
|
1607
1610
|
printJson(compactDirectCommandResult("direct", buildDirectWorkflowGuidance({
|
|
@@ -2157,7 +2160,6 @@ function completeKnowledgeFinalizationJob(jobPath, result, claimToken) {
|
|
|
2157
2160
|
cwd: running.projectRoot,
|
|
2158
2161
|
taskName: running.taskName,
|
|
2159
2162
|
includeTaskRetention: false,
|
|
2160
|
-
includeTaskMemory: false,
|
|
2161
2163
|
includeGitNexus: false,
|
|
2162
2164
|
statusLabel: `knowledge-${running.finalizeId.slice(0, 12)}`,
|
|
2163
2165
|
});
|
|
@@ -2903,7 +2905,7 @@ function compactPlanCommandResult(command, result, effectiveHost, completionRefr
|
|
|
2903
2905
|
const nextsteps = [
|
|
2904
2906
|
...result.workflowGuidance.nextsteps,
|
|
2905
2907
|
...(knowledgeDispatch
|
|
2906
|
-
? ["A knowledgeDispatch is present: dispatch its unchanged prompt through the current Host's designated knowledge-finalizer now, then do not wait for or poll that worker."]
|
|
2908
|
+
? ["A knowledgeDispatch is present: dispatch its unchanged prompt through the current Host's designated knowledge-finalizer now, then immediately end the Lead turn; do not wait for or poll that worker."]
|
|
2907
2909
|
: []),
|
|
2908
2910
|
];
|
|
2909
2911
|
const planSummary = result.planView.collapsedSummary;
|
|
@@ -3272,7 +3274,6 @@ function preparePlanEndFinalization(cwd, ownerSessionKey) {
|
|
|
3272
3274
|
function queueCompletionRefresh(input) {
|
|
3273
3275
|
const project = resolveProjectContext(input.cwd);
|
|
3274
3276
|
const includeTaskRetention = input.includeTaskRetention ?? true;
|
|
3275
|
-
const includeTaskMemory = input.includeTaskMemory ?? includeTaskRetention;
|
|
3276
3277
|
const taskRetention = includeTaskRetention
|
|
3277
3278
|
? enforceTaskRetention(project, input.taskName)
|
|
3278
3279
|
: {
|
|
@@ -3284,9 +3285,6 @@ function queueCompletionRefresh(input) {
|
|
|
3284
3285
|
const startedAt = new Date().toISOString();
|
|
3285
3286
|
const statusFile = createCompletionRefreshStatusFile(project.clawDir, input.statusLabel ?? input.taskName, startedAt);
|
|
3286
3287
|
const operations = ["memory.reindex.project"];
|
|
3287
|
-
if (includeTaskMemory && !taskRetention.archivedCurrentTask) {
|
|
3288
|
-
operations.push("memory.reindex.task");
|
|
3289
|
-
}
|
|
3290
3288
|
if (project.projectConfig?.gitnexus === true && input.includeGitNexus !== false) {
|
|
3291
3289
|
operations.push("gitnexus.refresh");
|
|
3292
3290
|
}
|
|
@@ -3433,7 +3431,6 @@ function runInternalCompletionRefresh(args) {
|
|
|
3433
3431
|
operations,
|
|
3434
3432
|
}, null, 2)}\n`, "utf-8");
|
|
3435
3433
|
let projectMemory;
|
|
3436
|
-
let taskMemory;
|
|
3437
3434
|
let gitnexus;
|
|
3438
3435
|
let refreshCycles = 0;
|
|
3439
3436
|
let dirtyHash = "";
|
|
@@ -3441,9 +3438,6 @@ function runInternalCompletionRefresh(args) {
|
|
|
3441
3438
|
refreshCycles += 1;
|
|
3442
3439
|
dirtyHash = computeCompletionDirtyHash(cwd, taskName, operations);
|
|
3443
3440
|
projectMemory = buildMemoryIndex({ cwd, scope: "project" });
|
|
3444
|
-
taskMemory = operations.includes("memory.reindex.task")
|
|
3445
|
-
? tryBuildTaskMemoryIndex(cwd, taskName)
|
|
3446
|
-
: undefined;
|
|
3447
3441
|
gitnexus = operations.includes("gitnexus.refresh")
|
|
3448
3442
|
? refreshGitNexusIfEnabled(cwd, resolveProjectContext(cwd).projectConfig)
|
|
3449
3443
|
: {
|
|
@@ -3472,7 +3466,6 @@ function runInternalCompletionRefresh(args) {
|
|
|
3472
3466
|
taskName,
|
|
3473
3467
|
memory: {
|
|
3474
3468
|
project: projectMemory,
|
|
3475
|
-
...(taskMemory ? { task: taskMemory } : {}),
|
|
3476
3469
|
},
|
|
3477
3470
|
gitnexus,
|
|
3478
3471
|
dirtyHash,
|
|
@@ -3673,21 +3666,6 @@ function listCompletionFingerprintFiles(root) {
|
|
|
3673
3666
|
}
|
|
3674
3667
|
return files;
|
|
3675
3668
|
}
|
|
3676
|
-
function tryBuildTaskMemoryIndex(cwd, taskName) {
|
|
3677
|
-
try {
|
|
3678
|
-
return buildMemoryIndex({
|
|
3679
|
-
cwd,
|
|
3680
|
-
scope: "task",
|
|
3681
|
-
taskName,
|
|
3682
|
-
});
|
|
3683
|
-
}
|
|
3684
|
-
catch (error) {
|
|
3685
|
-
if (error instanceof ClawError && error.code === "TASK_NOT_FOUND") {
|
|
3686
|
-
return undefined;
|
|
3687
|
-
}
|
|
3688
|
-
throw error;
|
|
3689
|
-
}
|
|
3690
|
-
}
|
|
3691
3669
|
function createCompletionRefreshStatusFile(clawDir, taskName, startedAt) {
|
|
3692
3670
|
const stamp = startedAt.replace(/[:.]/g, "-");
|
|
3693
3671
|
const safeTaskName = taskName.replace(/[^a-zA-Z0-9._-]+/g, "-");
|