agent-afk 5.86.0 → 5.87.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.
@@ -12,7 +12,7 @@ failure_modes:
12
12
  ## Sub-agent contract
13
13
  /contract
14
14
 
15
- **Constraint: read-only reconnaissance.** Surveyors and the synthesizer MUST NOT call `edit_file`, `write_file`, or any mutating bash command (no `git commit`, `git push`, `git checkout`, `mv`, `rm`, file redirection, package installs, etc.). Read-only tools only: `read_file`, `grep`, `glob`, `list_directory`, and read-only bash (`git status`, `git log`, `git diff`, `cat`, `ls`, `find`, etc.).
15
+ **Constraint: read-only reconnaissance.** Surveyors and the synthesizer MUST NOT call `edit_file`, `write_file`, or any mutating bash command (no `git commit`, `git push`, `git checkout`, `mv`, `rm`, file redirection, package installs, etc.). Read-only tools only: `read_file`, `grep`, `glob`, `list_directory`, `memory_search`, and read-only bash (`git status`, `git log`, `git diff`, `cat`, `ls`, `find`, etc.). `memory_search` is non-mutating and is the **only** way to reach the cross-session fact archive — it is in scope for this skill, do not strip it from this list.
16
16
 
17
17
  If the survey reveals a fix that's tempting to apply, **return it as a recommendation in the snapshot** — the orchestrator decides whether to act. Even if the invoking brief sounds prescriptive ("draft the edit", "apply the change"), this skill stops at the snapshot and the preamble artifact. The orchestrator dispatches a separate implementation step afterward.
18
18
 
@@ -41,13 +41,17 @@ Before any multi-step implementation (not single-file fixes, not pure Q&A), disp
41
41
  When domain is unspecified, infer from the working directory contents.
42
42
 
43
43
  **Memory surveyor**
44
- Grep the user's auto-memory store (`~/.claude/projects/-<cwd-slug>/memory/`) + any project CLAUDE.md for keywords from the user's current request. Return relevant memory file pointers with 1-line summaries, or "no relevant memory found."
44
+ Call the **`memory_search` tool** with keywords from the user's current request — FTS5 syntax, so `term1 AND term2`, `"exact phrase"`, and `prefix*` all work. Run 2–3 query variants (different keyword angles) before concluding nothing is there; a single miss is not evidence of absence. Then read hot memory at `~/.afk/state/memory/HOT.md` and the project overlay — `AFK.md`, or `CLAUDE.md` on a Claude Code surface — for conventions bearing on this task.
45
+
46
+ **Invariant: do not grep a filesystem path for memory.** `~/.claude/projects/-<cwd-slug>/memory/` is vestigial — it is another product's state tree, its slug is not a literal cwd substitution (underscores hyphenate), and it holds zero files in every project on both the `~/.claude` and `~/.afk` trees. The archive is SQLite at `~/.afk/state/memory/memory.db` and is not greppable; `memory_search` is the only route in. Restoring a path-grep here silently zeroes this third of the recon wave.
47
+
48
+ Return: relevant facts with 1-line summaries, **plus the stores actually consulted** — e.g. `memory_search: 3 queries, 0 hits; HOT.md: read; AFK.md: read` — so the orchestrator can tell "no relevant memory exists" from "the surveyor never looked." If `memory_search` is unavailable on this surface, say so explicitly instead of returning a bare "no relevant memory found."
45
49
 
46
50
  **Synthesize** into a 6-line ground-truth snapshot:
47
51
  - Branch: `<current>`, `<clean|diverged>`, upstream: `<fresh|stale>`
48
52
  - Recent work: last 3 commits or stash items
49
53
  - Infrastructure: CI present? package scripts? authoritative configs for this task
50
- - Memory hits: file refs or "none"
54
+ - Memory hits: facts (1-line each) + which stores were consulted, or `none (consulted: …)`
51
55
  - Implementation risks: e.g. "branch is `main`, don't edit directly"; "CI runs on push"; "memory says prior attempt used approach X"
52
56
  - Epistemic confidence: `<high|medium|low>` — based on how much state could be verified. Flag if working directory is sparse, if domain is unfamiliar, or if key artifacts may be missing.
53
57
 
@@ -33,6 +33,7 @@ export interface CliOptions {
33
33
  worktree?: string | true;
34
34
  worktreeAutoname?: boolean;
35
35
  worktreeBase?: string;
36
+ worktreeOnExit?: 'ask' | 'keep' | 'remove';
36
37
  shellPassthrough?: boolean;
37
38
  provider?: string;
38
39
  dumpPrompt?: string | boolean;
@@ -60,6 +61,8 @@ export interface InteractiveCtx {
60
61
  bgSummarizer?: BackgroundSummarizer;
61
62
  firstTurnHook?: (firstMessage: string) => Promise<void>;
62
63
  initialInput?: string;
64
+ worktreeDisposition?: import('./worktree-disposition.js').WorktreeDisposition;
65
+ resolveWorktreeDisposition?: (canPrompt: boolean) => Promise<void>;
63
66
  getInFlight?: () => boolean;
64
67
  requestResume?: (target: ResolvedResumeTarget) => Promise<ResumeSwapResult>;
65
68
  clearVerdictLedger?: () => void;
@@ -0,0 +1,23 @@
1
+ export type WorktreeDisposition = 'remove' | 'keep-locked' | 'keep-unlocked';
2
+ export type WorktreeExitPolicy = 'ask' | 'keep' | 'remove';
3
+ interface PolicySources {
4
+ cli?: string;
5
+ env?: string;
6
+ config?: string;
7
+ isTTY: boolean;
8
+ console: Pick<Console, 'warn'>;
9
+ }
10
+ export declare function resolveWorktreeExitPolicy(sources: PolicySources): WorktreeExitPolicy;
11
+ export interface WorktreeDispositionDeps {
12
+ picker?: (opts: {
13
+ header: readonly string[];
14
+ options: readonly string[];
15
+ }) => Promise<readonly string[] | null>;
16
+ isTTY: boolean;
17
+ policy: WorktreeExitPolicy;
18
+ turnCount: number;
19
+ hasWorktree: boolean;
20
+ console: Pick<Console, 'warn'>;
21
+ }
22
+ export declare function resolveWorktreeDisposition(deps: WorktreeDispositionDeps): Promise<WorktreeDisposition>;
23
+ export {};
@@ -1,3 +1,4 @@
1
+ import type { WorktreeDisposition } from './worktree-disposition.js';
1
2
  export type ExecFileFn = (file: string, args: string[], opts?: {
2
3
  cwd?: string;
3
4
  }) => Promise<{
@@ -9,6 +10,7 @@ export interface WorktreeHandle {
9
10
  branch: string;
10
11
  cleanup: (opts?: {
11
12
  force?: boolean;
13
+ disposition?: WorktreeDisposition;
12
14
  }) => Promise<void>;
13
15
  }
14
16
  export declare const DEFAULT_BRANCH_PREFIX = "afk/";
@@ -47,6 +47,7 @@ export interface CliConfig {
47
47
  worktreeAutoname?: boolean;
48
48
  worktreeBranchPrefix?: string;
49
49
  worktreeBase?: string;
50
+ worktreeOnExit?: 'ask' | 'keep' | 'remove';
50
51
  suggestGhost?: boolean;
51
52
  thinkingUi?: 'summary' | 'live' | 'digest' | 'off';
52
53
  };
@@ -111,6 +112,7 @@ export interface ConfigFileSchema {
111
112
  worktreeAutoname?: boolean;
112
113
  worktreeBranchPrefix?: string;
113
114
  worktreeBase?: string;
115
+ worktreeOnExit?: 'ask' | 'keep' | 'remove';
114
116
  suggestGhost?: boolean;
115
117
  thinkingUi?: 'summary' | 'live' | 'digest' | 'off';
116
118
  };