@veewo/claw-core 0.2.2 → 0.2.4
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 +16 -16
- package/dist/src/daily-maintenance.d.ts +2 -0
- package/dist/src/daily-maintenance.js +66 -110
- package/dist/src/daily-maintenance.js.map +1 -1
- package/dist/src/errors.d.ts +1 -1
- package/dist/src/errors.js.map +1 -1
- package/dist/src/focus-transitions.d.ts +158 -0
- package/dist/src/focus-transitions.js +586 -0
- package/dist/src/focus-transitions.js.map +1 -0
- package/dist/src/index.d.ts +2 -0
- package/dist/src/index.js +2 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/io.d.ts +6 -0
- package/dist/src/io.js +133 -33
- package/dist/src/io.js.map +1 -1
- package/dist/src/knowledge-assignments.d.ts +0 -6
- package/dist/src/knowledge-assignments.js +1 -8
- package/dist/src/knowledge-assignments.js.map +1 -1
- package/dist/src/knowledge-sidecar.d.ts +4 -1
- package/dist/src/knowledge-sidecar.js +17 -10
- package/dist/src/knowledge-sidecar.js.map +1 -1
- package/dist/src/plan-view.d.ts +2 -1
- package/dist/src/plan-view.js +12 -0
- package/dist/src/plan-view.js.map +1 -1
- package/dist/src/plan.d.ts +3 -0
- package/dist/src/plan.js +54 -30
- package/dist/src/plan.js.map +1 -1
- package/dist/src/resources/delegate-writer/TEMPLATE.json +5 -5
- package/dist/src/resources/knowledge-writer/CONTENT-COVERAGE.md +30 -30
- package/dist/src/resources/knowledge-writer/SKILL.md +9 -9
- package/dist/src/resources/knowledge-writer/TEMPLATE.json +1 -1
- package/dist/src/resources/knowledge-writer/agents/openai.yaml +4 -4
- package/dist/src/resources/knowledge-writer/knowledge-format.md +47 -47
- package/dist/src/resources/knowledge-writer/non-claw-fallback.md +53 -53
- package/dist/src/session-bindings.d.ts +2 -1
- package/dist/src/session-bindings.js +22 -1
- package/dist/src/session-bindings.js.map +1 -1
- package/dist/src/task-lifecycle.d.ts +13 -0
- package/dist/src/task-lifecycle.js +142 -0
- package/dist/src/task-lifecycle.js.map +1 -0
- package/dist/src/templates/plans/default.js +1 -1
- package/dist/src/types.d.ts +19 -1
- package/dist/src/workflow-guidance.codex.config.json +363 -0
- package/dist/src/workflow-guidance.config.json +374 -363
- package/dist/src/workflow-guidance.js +10 -2
- package/dist/src/workflow-guidance.js.map +1 -1
- package/dist/src/workflow-guidance.qoder.config.json +362 -0
- package/package.json +48 -48
- package/dist/src/embedding-config.d.ts +0 -9
- package/dist/src/embedding-config.js +0 -21
- package/dist/src/embedding-config.js.map +0 -1
- package/dist/src/project-config-defaults.d.ts +0 -6
- package/dist/src/project-config-defaults.js +0 -5
- package/dist/src/project-config-defaults.js.map +0 -1
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
# Canonical knowledge evolution format
|
|
2
|
-
|
|
3
|
-
Use this format for every new Truth or ADR document and every existing owner written by the current writer pass. Inspect the selected owner before writing and repair nonconforming structure in the same edit. Do not mass-rewrite untouched documents.
|
|
4
|
-
|
|
5
|
-
## Document metadata
|
|
6
|
-
|
|
7
|
-
Document kind is inferred from its canonical path: documents under `adr/` are ADRs; other documents under the Truth root are Truth documents. Do not add a document-kind field.
|
|
8
|
-
|
|
9
|
-
Truth documents default to `current`. ADR documents default to `accepted`. When a different document state must be explicit, place a renderer-hidden generic comment immediately after the title:
|
|
10
|
-
|
|
11
|
-
```markdown
|
|
12
|
-
# ADR: Replaced decision
|
|
13
|
-
|
|
14
|
-
<!-- document-state: superseded -->
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
Allowed document states are:
|
|
18
|
-
|
|
19
|
-
- Truth: `current` or `historical`
|
|
20
|
-
- ADR: `accepted`, `superseded`, or `historical`
|
|
21
|
-
|
|
22
|
-
An ordinary leading `## Status` or `## 状态` section may also supply the document state. Do not emit tool-specific metadata names.
|
|
23
|
-
|
|
24
|
-
## Current and evolution sections
|
|
25
|
-
|
|
26
|
-
Use renderer-hidden, machine-stable ASCII comments before natural-language headings:
|
|
27
|
-
|
|
28
|
-
```markdown
|
|
29
|
-
<!-- state: current -->
|
|
30
|
-
## Current behavior
|
|
31
|
-
|
|
32
|
-
Current canonical content.
|
|
33
|
-
|
|
34
|
-
<!-- state: history -->
|
|
35
|
-
## Evolution history
|
|
36
|
-
|
|
37
|
-
<!-- dated: 2026-07-20 -->
|
|
38
|
-
### Replaced the earlier route
|
|
39
|
-
|
|
40
|
-
The prior behavior and why it matters for rollback or repeated work.
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
For ADRs, the ordinary Context, Decision, Alternatives, and Consequences sections inherit the document state. Mark only retained decision evolution with `<!-- state: history -->`.
|
|
44
|
-
|
|
45
|
-
Each `<!-- dated: YYYY-MM-DD -->` comment starts one complete evolution unit at the level-three heading that follows it. The unit extends to the next dated comment or the next level-two heading. The date is a stable checkpoint label and search signal, not a time-to-live value. Multiple checkpoints may use the same date. Their canonical evolution order is document order.
|
|
46
|
-
|
|
47
|
-
Do not append an evolution unit for routine progress or every successful turn. Add one only when the former fact or decision remains useful for rollback, compatibility, feature repetition, incident reasoning, or understanding a meaningful transition.
|
|
1
|
+
# Canonical knowledge evolution format
|
|
2
|
+
|
|
3
|
+
Use this format for every new Truth or ADR document and every existing owner written by the current writer pass. Inspect the selected owner before writing and repair nonconforming structure in the same edit. Do not mass-rewrite untouched documents.
|
|
4
|
+
|
|
5
|
+
## Document metadata
|
|
6
|
+
|
|
7
|
+
Document kind is inferred from its canonical path: documents under `adr/` are ADRs; other documents under the Truth root are Truth documents. Do not add a document-kind field.
|
|
8
|
+
|
|
9
|
+
Truth documents default to `current`. ADR documents default to `accepted`. When a different document state must be explicit, place a renderer-hidden generic comment immediately after the title:
|
|
10
|
+
|
|
11
|
+
```markdown
|
|
12
|
+
# ADR: Replaced decision
|
|
13
|
+
|
|
14
|
+
<!-- document-state: superseded -->
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Allowed document states are:
|
|
18
|
+
|
|
19
|
+
- Truth: `current` or `historical`
|
|
20
|
+
- ADR: `accepted`, `superseded`, or `historical`
|
|
21
|
+
|
|
22
|
+
An ordinary leading `## Status` or `## 状态` section may also supply the document state. Do not emit tool-specific metadata names.
|
|
23
|
+
|
|
24
|
+
## Current and evolution sections
|
|
25
|
+
|
|
26
|
+
Use renderer-hidden, machine-stable ASCII comments before natural-language headings:
|
|
27
|
+
|
|
28
|
+
```markdown
|
|
29
|
+
<!-- state: current -->
|
|
30
|
+
## Current behavior
|
|
31
|
+
|
|
32
|
+
Current canonical content.
|
|
33
|
+
|
|
34
|
+
<!-- state: history -->
|
|
35
|
+
## Evolution history
|
|
36
|
+
|
|
37
|
+
<!-- dated: 2026-07-20 -->
|
|
38
|
+
### Replaced the earlier route
|
|
39
|
+
|
|
40
|
+
The prior behavior and why it matters for rollback or repeated work.
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
For ADRs, the ordinary Context, Decision, Alternatives, and Consequences sections inherit the document state. Mark only retained decision evolution with `<!-- state: history -->`.
|
|
44
|
+
|
|
45
|
+
Each `<!-- dated: YYYY-MM-DD -->` comment starts one complete evolution unit at the level-three heading that follows it. The unit extends to the next dated comment or the next level-two heading. The date is a stable checkpoint label and search signal, not a time-to-live value. Multiple checkpoints may use the same date. Their canonical evolution order is document order.
|
|
46
|
+
|
|
47
|
+
Do not append an evolution unit for routine progress or every successful turn. Add one only when the former fact or decision remains useful for rollback, compatibility, feature repetition, incident reasoning, or understanding a meaningful transition.
|
|
@@ -1,53 +1,53 @@
|
|
|
1
|
-
# Knowledge writer fallback
|
|
2
|
-
|
|
3
|
-
Act as the knowledge-base steward for the project. Leave the relevant Truth and ADR corpus accurate, coherent, and easy for future agents to trust.
|
|
4
|
-
|
|
5
|
-
## Input and evidence boundary
|
|
6
|
-
|
|
7
|
-
Read every supplied material completely. Interpret evidence from its content and semantics rather than requiring a particular filename, field, record shape, or serialization format. Extract executed conclusions, verified findings, retrospective lessons, key decisions, and other explicit outcomes wherever they appear. Do not repeat implementation or test verification or modify supplied materials.
|
|
8
|
-
|
|
9
|
-
When task status is present, it helps interpret completed, pending, and blocked scope, but a task list is not an execution log. Infer execution results, verified findings, planning outcomes, and durable decisions from conclusion-bearing content; never turn task titles, descriptions, requirements, or intentions into completed results merely because they appear in an input.
|
|
10
|
-
|
|
11
|
-
## Evidence freshness
|
|
12
|
-
|
|
13
|
-
Trusted means the evidence was verified at the revision or worktree state it describes; it does not make an older report permanently authoritative for current behavior.
|
|
14
|
-
|
|
15
|
-
- Before writing current behavior from a supplied conclusion, read the relevant implementation anchors and inspect later or overlapping working-tree changes. This is a freshness check, not repeated implementation verification; do not rerun tests merely to reconfirm the report.
|
|
16
|
-
- When current implementation supersedes the report, current implementation owns current-state Truth and the report may only support historical or version-bound evidence.
|
|
17
|
-
- If chronology or authority cannot be resolved safely, omit the affected canonical write and retain the freshness conflict as the reason.
|
|
18
|
-
|
|
19
|
-
## Fixed deposition sequence
|
|
20
|
-
|
|
21
|
-
Process the eligible evidence without a route choice:
|
|
22
|
-
|
|
23
|
-
1. Maintain Truth for stable behavior, architecture facts, constraints, pitfalls, code anchors, and verification rules.
|
|
24
|
-
2. Then maintain ADRs for durable decisions, context, rationale, alternatives, tradeoffs, ownership, and consequences, using the same evidence and resulting Truth state.
|
|
25
|
-
3. Finally review Truth and ADR together for ownership and consistency.
|
|
26
|
-
|
|
27
|
-
Use `knowledge-format.md` for every new document and every existing owner written by this pass. Inspect each selected owner before writing and repair nonconforming structure in the same edit; leave untouched documents unmigrated. Dated identifies an evolution checkpoint, not age or time-to-live.
|
|
28
|
-
|
|
29
|
-
It is valid for either pass to make no edit when the eligible evidence contains no new or changed durable knowledge. Temporary progress, speculation, conversational narration, unchanged facts, and unfinished-task claims do not belong in canonical knowledge.
|
|
30
|
-
|
|
31
|
-
## Stewardship and ownership
|
|
32
|
-
|
|
33
|
-
Use `claw search` to discover existing owners, then open every plausible candidate before judging it. Use exhaustive text search for distinguishing identifiers when top-k recall could hide another current claim. Update the document that already owns the topic; create a new document only for a genuinely new durable topic after filename and title collision checks.
|
|
34
|
-
|
|
35
|
-
Maintain one current owner for each material fact or decision. A broad or neighboring document is still a competing owner when it restates an unqualified current rule. Reconcile overlaps by extending the canonical owner and narrowing other current claims to references, historical evidence, or non-overlapping scope. Preserve unrelated user edits and repository conventions.
|
|
36
|
-
|
|
37
|
-
Truth and ADR are one knowledge system: after both ordered passes, review the related documents together and resolve contradictions between current-state Truth, decision ownership, and consequences. Do not report completion while a material current claim remains inconsistent or ownerless.
|
|
38
|
-
|
|
39
|
-
## Writing and verification
|
|
40
|
-
|
|
41
|
-
- Follow the repository's language and document shape.
|
|
42
|
-
- Preserve exact identifiers, config keys, commands, and error text.
|
|
43
|
-
- Use project-relative paths in canonical documents.
|
|
44
|
-
- Ground every fact, path, owner, and alternative in supplied or inspected evidence.
|
|
45
|
-
- Label historical and superseded evidence explicitly; never silently promote it to current behavior.
|
|
46
|
-
- Add dated evolution only for former facts or decisions that remain useful for rollback, compatibility, feature repetition, incident reasoning, or understanding a meaningful transition.
|
|
47
|
-
- Repair every written Truth or ADR owner to the canonical format in `knowledge-format.md`; do not defer a discovered format mismatch.
|
|
48
|
-
- Repair mojibake and preserve valid Markdown encoding.
|
|
49
|
-
- Re-run focused and exhaustive searches after writing; every plausible hit must be the selected owner, an explicit reference, historical or version-bound evidence, or a narrowed non-overlapping claim.
|
|
50
|
-
|
|
51
|
-
## Return
|
|
52
|
-
|
|
53
|
-
Return a brief completion note with changed paths or the evidence-backed no-edit reasons. Response format is not part of the contract.
|
|
1
|
+
# Knowledge writer fallback
|
|
2
|
+
|
|
3
|
+
Act as the knowledge-base steward for the project. Leave the relevant Truth and ADR corpus accurate, coherent, and easy for future agents to trust.
|
|
4
|
+
|
|
5
|
+
## Input and evidence boundary
|
|
6
|
+
|
|
7
|
+
Read every supplied material completely. Interpret evidence from its content and semantics rather than requiring a particular filename, field, record shape, or serialization format. Extract executed conclusions, verified findings, retrospective lessons, key decisions, and other explicit outcomes wherever they appear. Do not repeat implementation or test verification or modify supplied materials.
|
|
8
|
+
|
|
9
|
+
When task status is present, it helps interpret completed, pending, and blocked scope, but a task list is not an execution log. Infer execution results, verified findings, planning outcomes, and durable decisions from conclusion-bearing content; never turn task titles, descriptions, requirements, or intentions into completed results merely because they appear in an input.
|
|
10
|
+
|
|
11
|
+
## Evidence freshness
|
|
12
|
+
|
|
13
|
+
Trusted means the evidence was verified at the revision or worktree state it describes; it does not make an older report permanently authoritative for current behavior.
|
|
14
|
+
|
|
15
|
+
- Before writing current behavior from a supplied conclusion, read the relevant implementation anchors and inspect later or overlapping working-tree changes. This is a freshness check, not repeated implementation verification; do not rerun tests merely to reconfirm the report.
|
|
16
|
+
- When current implementation supersedes the report, current implementation owns current-state Truth and the report may only support historical or version-bound evidence.
|
|
17
|
+
- If chronology or authority cannot be resolved safely, omit the affected canonical write and retain the freshness conflict as the reason.
|
|
18
|
+
|
|
19
|
+
## Fixed deposition sequence
|
|
20
|
+
|
|
21
|
+
Process the eligible evidence without a route choice:
|
|
22
|
+
|
|
23
|
+
1. Maintain Truth for stable behavior, architecture facts, constraints, pitfalls, code anchors, and verification rules.
|
|
24
|
+
2. Then maintain ADRs for durable decisions, context, rationale, alternatives, tradeoffs, ownership, and consequences, using the same evidence and resulting Truth state.
|
|
25
|
+
3. Finally review Truth and ADR together for ownership and consistency.
|
|
26
|
+
|
|
27
|
+
Use `knowledge-format.md` for every new document and every existing owner written by this pass. Inspect each selected owner before writing and repair nonconforming structure in the same edit; leave untouched documents unmigrated. Dated identifies an evolution checkpoint, not age or time-to-live.
|
|
28
|
+
|
|
29
|
+
It is valid for either pass to make no edit when the eligible evidence contains no new or changed durable knowledge. Temporary progress, speculation, conversational narration, unchanged facts, and unfinished-task claims do not belong in canonical knowledge.
|
|
30
|
+
|
|
31
|
+
## Stewardship and ownership
|
|
32
|
+
|
|
33
|
+
Use `claw search` to discover existing owners, then open every plausible candidate before judging it. Use exhaustive text search for distinguishing identifiers when top-k recall could hide another current claim. Update the document that already owns the topic; create a new document only for a genuinely new durable topic after filename and title collision checks.
|
|
34
|
+
|
|
35
|
+
Maintain one current owner for each material fact or decision. A broad or neighboring document is still a competing owner when it restates an unqualified current rule. Reconcile overlaps by extending the canonical owner and narrowing other current claims to references, historical evidence, or non-overlapping scope. Preserve unrelated user edits and repository conventions.
|
|
36
|
+
|
|
37
|
+
Truth and ADR are one knowledge system: after both ordered passes, review the related documents together and resolve contradictions between current-state Truth, decision ownership, and consequences. Do not report completion while a material current claim remains inconsistent or ownerless.
|
|
38
|
+
|
|
39
|
+
## Writing and verification
|
|
40
|
+
|
|
41
|
+
- Follow the repository's language and document shape.
|
|
42
|
+
- Preserve exact identifiers, config keys, commands, and error text.
|
|
43
|
+
- Use project-relative paths in canonical documents.
|
|
44
|
+
- Ground every fact, path, owner, and alternative in supplied or inspected evidence.
|
|
45
|
+
- Label historical and superseded evidence explicitly; never silently promote it to current behavior.
|
|
46
|
+
- Add dated evolution only for former facts or decisions that remain useful for rollback, compatibility, feature repetition, incident reasoning, or understanding a meaningful transition.
|
|
47
|
+
- Repair every written Truth or ADR owner to the canonical format in `knowledge-format.md`; do not defer a discovered format mismatch.
|
|
48
|
+
- Repair mojibake and preserve valid Markdown encoding.
|
|
49
|
+
- Re-run focused and exhaustive searches after writing; every plausible hit must be the selected owner, an explicit reference, historical or version-bound evidence, or a narrowed non-overlapping claim.
|
|
50
|
+
|
|
51
|
+
## Return
|
|
52
|
+
|
|
53
|
+
Return a brief completion note with changed paths or the evidence-backed no-edit reasons. Response format is not part of the contract.
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { ProjectContext } from "./types.js";
|
|
2
|
+
export declare const SESSION_BINDING_TTL_MS: number;
|
|
2
3
|
export declare function sessionBindingRegistryPath(project: ProjectContext): string;
|
|
3
4
|
export declare function bindSessionToPlan(project: ProjectContext, sessionKey: string | undefined, planPath: string): void;
|
|
4
5
|
export declare function unbindSession(project: ProjectContext, sessionKey: string | undefined): void;
|
|
5
6
|
/** Remove registry entries whose bound plan is no longer present under active tasks. */
|
|
6
|
-
export declare function pruneStaleSessionBindings(project: ProjectContext): string[];
|
|
7
|
+
export declare function pruneStaleSessionBindings(project: ProjectContext, nowMs?: number): string[];
|
|
7
8
|
export declare function resolveSessionBoundPlan(project: ProjectContext, sessionKey: string | undefined): string | null;
|
|
@@ -3,6 +3,7 @@ import path from "node:path";
|
|
|
3
3
|
import { readJsonFile, withFileLock, writeJsonFile } from "./io.js";
|
|
4
4
|
import { ensureInsideDir } from "./paths.js";
|
|
5
5
|
const SESSION_SCOPE_BINDING_KEY = "$session";
|
|
6
|
+
export const SESSION_BINDING_TTL_MS = 7 * 24 * 60 * 60 * 1000;
|
|
6
7
|
export function sessionBindingRegistryPath(project) {
|
|
7
8
|
return path.join(project.clawDir, "runtime", "session-bindings.json");
|
|
8
9
|
}
|
|
@@ -26,8 +27,22 @@ export function unbindSession(project, sessionKey) {
|
|
|
26
27
|
});
|
|
27
28
|
}
|
|
28
29
|
/** Remove registry entries whose bound plan is no longer present under active tasks. */
|
|
29
|
-
export function pruneStaleSessionBindings(project) {
|
|
30
|
+
export function pruneStaleSessionBindings(project, nowMs = Date.now()) {
|
|
30
31
|
const removed = [];
|
|
32
|
+
const registryPath = sessionBindingRegistryPath(project);
|
|
33
|
+
if (fs.existsSync(registryPath)) {
|
|
34
|
+
try {
|
|
35
|
+
if (nowMs - fs.statSync(registryPath).mtimeMs >= SESSION_BINDING_TTL_MS) {
|
|
36
|
+
const registry = readRegistry(project);
|
|
37
|
+
removed.push(...Object.keys(registry.bindings));
|
|
38
|
+
fs.unlinkSync(registryPath);
|
|
39
|
+
return removed;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
catch {
|
|
43
|
+
return removed;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
31
46
|
updateRegistry(project, (registry) => {
|
|
32
47
|
for (const [key, relativePath] of Object.entries(registry.bindings)) {
|
|
33
48
|
const normalizedRelative = typeof relativePath === "string" ? relativePath.replace(/\\/g, "/") : "";
|
|
@@ -58,6 +73,12 @@ export function resolveSessionBoundPlan(project, sessionKey) {
|
|
|
58
73
|
unbindSession(project, normalizedKey);
|
|
59
74
|
return null;
|
|
60
75
|
}
|
|
76
|
+
try {
|
|
77
|
+
fs.utimesSync(sessionBindingRegistryPath(project), new Date(), new Date());
|
|
78
|
+
}
|
|
79
|
+
catch {
|
|
80
|
+
// Binding freshness is advisory; resolution remains valid.
|
|
81
|
+
}
|
|
61
82
|
return planPath;
|
|
62
83
|
}
|
|
63
84
|
function bindingKey(project, sessionKey) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-bindings.js","sourceRoot":"","sources":["../../src/session-bindings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAQ7C,MAAM,yBAAyB,GAAG,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"session-bindings.js","sourceRoot":"","sources":["../../src/session-bindings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAQ7C,MAAM,yBAAyB,GAAG,UAAU,CAAC;AAC7C,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAE9D,MAAM,UAAU,0BAA0B,CAAC,OAAuB;IAChE,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,SAAS,EAAE,uBAAuB,CAAC,CAAC;AAC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AAQ,CAAC,CAAC;IACxC,CAAC,CAAC,CAAC;AACL,CAAC;AAED,SAAS,YAAY,CAAC,OAAuB;IAC3C,MAAM,YAAY,GAAG,0BAA0B,CAAC,OAAO,CAAC,CAAC;IACzD,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,YAAY,CAAC,EAAE,CAAC;QACjC,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC;IACtC,CAAC;IACD,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,YAAY,CAAkC,YAAY,CAAC,CAAC;QAC7E,OAAO;YACL,OAAO,EAAE,CAAC;YACV,QAAQ,EAAE,QAAQ,CAAC,QAAQ,IAAI,OAAO,QAAQ,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE;SAC9F,CAAC;IACJ,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC;IACtC,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ProjectContext } from "./types.js";
|
|
2
|
+
export type TaskLifecycleMaintenanceResult = {
|
|
3
|
+
archivedTasks: number;
|
|
4
|
+
prunedArchivedTasks: number;
|
|
5
|
+
expiredTaskDirectoriesRemoved: number;
|
|
6
|
+
emptyDatedDirectoriesRemoved: number;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Coordinates the task lifecycle without merging the policies themselves:
|
|
10
|
+
* archive eligibility, archive retention, and inactivity TTL are evaluated in
|
|
11
|
+
* that order so archived work gets a recovery window before final deletion.
|
|
12
|
+
*/
|
|
13
|
+
export declare function runTaskLifecycleMaintenance(project: ProjectContext, now: Date): TaskLifecycleMaintenanceResult;
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { readJsonFile } from "./io.js";
|
|
4
|
+
import { listTaskDirectories } from "./context.js";
|
|
5
|
+
import { enforceTaskRetention } from "./task-retention.js";
|
|
6
|
+
const WORKFLOW_TASK_TTL_MS = 30 * 24 * 60 * 60 * 1000;
|
|
7
|
+
/**
|
|
8
|
+
* Coordinates the task lifecycle without merging the policies themselves:
|
|
9
|
+
* archive eligibility, archive retention, and inactivity TTL are evaluated in
|
|
10
|
+
* that order so archived work gets a recovery window before final deletion.
|
|
11
|
+
*/
|
|
12
|
+
export function runTaskLifecycleMaintenance(project, now) {
|
|
13
|
+
const cutoffDate = previousLocalDate(now);
|
|
14
|
+
const archivedDatedTasks = archiveDatedTaskDirectoriesBefore(project, cutoffDate);
|
|
15
|
+
const archivedLegacyTasks = archiveLegacyTaskDirectoriesBefore(project, cutoffDate);
|
|
16
|
+
const retention = enforceTaskRetention(project, undefined, now.getTime(), {
|
|
17
|
+
includeDatedTasks: false,
|
|
18
|
+
includeLegacyTasks: false,
|
|
19
|
+
});
|
|
20
|
+
const expiredTaskDirectoriesRemoved = pruneExpiredTaskDirectories(project, now.getTime());
|
|
21
|
+
const emptyDatedDirectoriesRemoved = removeEmptyDatedTaskDirectories(project);
|
|
22
|
+
return {
|
|
23
|
+
archivedTasks: archivedDatedTasks + archivedLegacyTasks + retention.archivedTasks.length,
|
|
24
|
+
prunedArchivedTasks: retention.prunedArchivedTasks.length,
|
|
25
|
+
expiredTaskDirectoriesRemoved,
|
|
26
|
+
emptyDatedDirectoriesRemoved,
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
function pruneExpiredTaskDirectories(project, nowMs) {
|
|
30
|
+
let removed = 0;
|
|
31
|
+
for (const root of [project.tasksDir, path.join(project.clawDir, "archive", "tasks")]) {
|
|
32
|
+
for (const task of listTaskDirectories({ tasksDir: root })) {
|
|
33
|
+
const updatedAt = readPlanUpdatedAt(path.join(task.taskDir, "plan.json"));
|
|
34
|
+
if (updatedAt === null || nowMs - updatedAt < WORKFLOW_TASK_TTL_MS)
|
|
35
|
+
continue;
|
|
36
|
+
try {
|
|
37
|
+
fs.rmSync(task.taskDir, { recursive: true, force: true });
|
|
38
|
+
removed += 1;
|
|
39
|
+
}
|
|
40
|
+
catch {
|
|
41
|
+
// A locked or concurrently updated task is retried by the next pass.
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return removed;
|
|
46
|
+
}
|
|
47
|
+
function removeEmptyDatedTaskDirectories(project) {
|
|
48
|
+
return [project.tasksDir, path.join(project.clawDir, "archive", "tasks")]
|
|
49
|
+
.reduce((removed, root) => removed + removeEmptyDatedDirectories(root), 0);
|
|
50
|
+
}
|
|
51
|
+
function removeEmptyDatedDirectories(root) {
|
|
52
|
+
if (!fs.existsSync(root))
|
|
53
|
+
return 0;
|
|
54
|
+
let removed = 0;
|
|
55
|
+
for (const entry of fs.readdirSync(root, { withFileTypes: true })) {
|
|
56
|
+
if (!entry.isDirectory() || !/^\d{4}-\d{2}-\d{2}$/.test(entry.name))
|
|
57
|
+
continue;
|
|
58
|
+
const directory = path.join(root, entry.name);
|
|
59
|
+
if (fs.readdirSync(directory).length > 0)
|
|
60
|
+
continue;
|
|
61
|
+
fs.rmdirSync(directory);
|
|
62
|
+
removed += 1;
|
|
63
|
+
}
|
|
64
|
+
return removed;
|
|
65
|
+
}
|
|
66
|
+
function archiveDatedTaskDirectoriesBefore(project, cutoffDate) {
|
|
67
|
+
if (!fs.existsSync(project.tasksDir))
|
|
68
|
+
return 0;
|
|
69
|
+
const archiveRoot = path.join(project.clawDir, "archive", "tasks");
|
|
70
|
+
let archivedTaskCount = 0;
|
|
71
|
+
for (const entry of fs.readdirSync(project.tasksDir, { withFileTypes: true })) {
|
|
72
|
+
if (!entry.isDirectory() || !/^\d{4}-\d{2}-\d{2}$/.test(entry.name) || entry.name >= cutoffDate)
|
|
73
|
+
continue;
|
|
74
|
+
const sourceDateDir = path.join(project.tasksDir, entry.name);
|
|
75
|
+
const taskCount = fs.readdirSync(sourceDateDir, { withFileTypes: true }).filter((child) => child.isDirectory()).length;
|
|
76
|
+
moveDateDirectory(sourceDateDir, path.join(archiveRoot, entry.name));
|
|
77
|
+
archivedTaskCount += taskCount;
|
|
78
|
+
}
|
|
79
|
+
return archivedTaskCount;
|
|
80
|
+
}
|
|
81
|
+
function moveDateDirectory(sourceDateDir, targetDateDir) {
|
|
82
|
+
fs.mkdirSync(path.dirname(targetDateDir), { recursive: true });
|
|
83
|
+
if (!fs.existsSync(targetDateDir)) {
|
|
84
|
+
fs.renameSync(sourceDateDir, targetDateDir);
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
for (const child of fs.readdirSync(sourceDateDir, { withFileTypes: true })) {
|
|
88
|
+
const source = path.join(sourceDateDir, child.name);
|
|
89
|
+
let target = path.join(targetDateDir, child.name);
|
|
90
|
+
let suffix = 1;
|
|
91
|
+
while (fs.existsSync(target)) {
|
|
92
|
+
target = path.join(targetDateDir, `${child.name}--${suffix}`);
|
|
93
|
+
suffix += 1;
|
|
94
|
+
}
|
|
95
|
+
fs.renameSync(source, target);
|
|
96
|
+
}
|
|
97
|
+
fs.rmdirSync(sourceDateDir);
|
|
98
|
+
}
|
|
99
|
+
function archiveLegacyTaskDirectoriesBefore(project, cutoffDate) {
|
|
100
|
+
const archiveRoot = path.join(project.clawDir, "archive", "tasks");
|
|
101
|
+
let archivedTaskCount = 0;
|
|
102
|
+
for (const task of listTaskDirectories(project)) {
|
|
103
|
+
if (/^\d{4}-\d{2}-\d{2}[\\/]/.test(task.relativePath))
|
|
104
|
+
continue;
|
|
105
|
+
const updatedAt = readPlanUpdatedAt(path.join(task.taskDir, "plan.json"));
|
|
106
|
+
if (!updatedAt || localDate(new Date(updatedAt)) >= cutoffDate)
|
|
107
|
+
continue;
|
|
108
|
+
moveDirectoryWithCollision(task.taskDir, path.join(archiveRoot, task.relativePath));
|
|
109
|
+
archivedTaskCount += 1;
|
|
110
|
+
}
|
|
111
|
+
return archivedTaskCount;
|
|
112
|
+
}
|
|
113
|
+
function readPlanUpdatedAt(planPath) {
|
|
114
|
+
if (!fs.existsSync(planPath))
|
|
115
|
+
return null;
|
|
116
|
+
try {
|
|
117
|
+
const plan = readJsonFile(planPath);
|
|
118
|
+
const timestamp = typeof plan.updatedAt === "string" ? Date.parse(plan.updatedAt) : Number.NaN;
|
|
119
|
+
return Number.isFinite(timestamp) ? timestamp : fs.statSync(planPath).mtimeMs;
|
|
120
|
+
}
|
|
121
|
+
catch {
|
|
122
|
+
return fs.statSync(planPath).mtimeMs;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
function moveDirectoryWithCollision(sourceDir, targetDir) {
|
|
126
|
+
fs.mkdirSync(path.dirname(targetDir), { recursive: true });
|
|
127
|
+
let target = targetDir;
|
|
128
|
+
let suffix = 1;
|
|
129
|
+
while (fs.existsSync(target)) {
|
|
130
|
+
target = `${targetDir}--${suffix}`;
|
|
131
|
+
suffix += 1;
|
|
132
|
+
}
|
|
133
|
+
fs.renameSync(sourceDir, target);
|
|
134
|
+
}
|
|
135
|
+
function localDate(now) {
|
|
136
|
+
return `${now.getFullYear()}-${String(now.getMonth() + 1).padStart(2, "0")}-${String(now.getDate()).padStart(2, "0")}`;
|
|
137
|
+
}
|
|
138
|
+
function previousLocalDate(now) {
|
|
139
|
+
const previous = new Date(now.getFullYear(), now.getMonth(), now.getDate() - 1);
|
|
140
|
+
return localDate(previous);
|
|
141
|
+
}
|
|
142
|
+
//# sourceMappingURL=task-lifecycle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"task-lifecycle.js","sourceRoot":"","sources":["../../src/task-lifecycle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACnD,OAA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AC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC3D,IAAI,MAAM,GAAG,SAAS,CAAC;IACvB,IAAI,MAAM,GAAG,CAAC,CAAC;IACf,OAAO,EAAE,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;QAC7B,MAAM,GAAG,GAAG,SAAS,KAAK,MAAM,EAAE,CAAC;QACnC,MAAM,IAAI,CAAC,CAAC;IACd,CAAC;IACD,EAAE,CAAC,UAAU,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;AACnC,CAAC;AAED,SAAS,SAAS,CAAC,GAAS;IAC1B,OAAO,GAAG,GAAG,CAAC,WAAW,EAAE,IAAI,MAAM,CAAC,GAAG,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC;AACzH,CAAC;AAED,SAAS,iBAAiB,CAAC,GAAS;IAClC,MAAM,QAAQ,GAAG,IAAI,IAAI,CAAC,GAAG,CAAC,WAAW,EAAE,EAAE,GAAG,CAAC,QAAQ,EAAE,EAAE,GAAG,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,CAAC;IAChF,OAAO,SAAS,CAAC,QAAQ,CAAC,CAAC;AAC7B,CAAC"}
|
package/dist/src/types.d.ts
CHANGED
|
@@ -148,7 +148,7 @@ export type WorkflowGuidanceGoalTool = {
|
|
|
148
148
|
reason: string;
|
|
149
149
|
};
|
|
150
150
|
export type WorkflowGuidance = {
|
|
151
|
-
stage: "requirements" | "review" | "discussion" | "execution" | "done" | "deposition" | "paused";
|
|
151
|
+
stage: "requirements" | "review" | "discussion" | "execution" | "done" | "deposition" | "paused" | "left";
|
|
152
152
|
summary: string;
|
|
153
153
|
nextsteps: string[];
|
|
154
154
|
nextTask?: {
|
|
@@ -251,6 +251,16 @@ export type PlanViewModel = {
|
|
|
251
251
|
refreshOn: Array<"plan.write" | "plan.edit" | "plan.done">;
|
|
252
252
|
};
|
|
253
253
|
};
|
|
254
|
+
export type SimplePlanView = {
|
|
255
|
+
status: PlanStatus;
|
|
256
|
+
goal: {
|
|
257
|
+
text: string;
|
|
258
|
+
};
|
|
259
|
+
tasks: Array<{
|
|
260
|
+
title: string;
|
|
261
|
+
}>;
|
|
262
|
+
rules: string[];
|
|
263
|
+
};
|
|
254
264
|
export type PlanReviewInput = {
|
|
255
265
|
planContent: PlanDocument;
|
|
256
266
|
isSubPlan: boolean;
|
|
@@ -393,6 +403,7 @@ export type PlanWriteInput = {
|
|
|
393
403
|
content?: PlanDocument;
|
|
394
404
|
parentTaskId?: number;
|
|
395
405
|
parentPlanFile?: string;
|
|
406
|
+
deferParentMutation?: boolean;
|
|
396
407
|
reviewer?: PlanReviewer;
|
|
397
408
|
workflowDefinitions?: string;
|
|
398
409
|
host?: string;
|
|
@@ -421,6 +432,11 @@ export type SubplanWriteInput = {
|
|
|
421
432
|
templateFile?: string;
|
|
422
433
|
ownerSessionKey?: string;
|
|
423
434
|
host?: string;
|
|
435
|
+
/**
|
|
436
|
+
* Creates the child plan without writing the parent linkage. Session focus
|
|
437
|
+
* coordination uses this to journal parent linkage and focus as one commit.
|
|
438
|
+
*/
|
|
439
|
+
deferParentMutation?: boolean;
|
|
424
440
|
};
|
|
425
441
|
export type PlanEditInput = {
|
|
426
442
|
cwd: string;
|
|
@@ -442,6 +458,7 @@ export type PlanEditInput = {
|
|
|
442
458
|
workflowDefinitions?: string;
|
|
443
459
|
host?: string;
|
|
444
460
|
ownerSessionKey?: string;
|
|
461
|
+
deferSubplanClosure?: boolean;
|
|
445
462
|
operations?: PlanMutationOperation[];
|
|
446
463
|
};
|
|
447
464
|
export type PlanMutationOperation = {
|
|
@@ -530,6 +547,7 @@ export type PlanShowResult = {
|
|
|
530
547
|
archived?: true;
|
|
531
548
|
plan: PlanDocument;
|
|
532
549
|
planView: PlanViewModel;
|
|
550
|
+
simplePlanView: SimplePlanView;
|
|
533
551
|
};
|
|
534
552
|
export type SwitchTaskInput = {
|
|
535
553
|
cwd: string;
|