agent-afk 5.127.2 → 5.127.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.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: ground-state
3
- description: "Before starting any non-trivial implementation, dispatch a parallel pre-flight reconnaissance wave to triangulate git state, project infrastructure, and prior-session memory. Wave 4 auto-assembles a verified grounding preamble — a session-scoped artifact the orchestrator pastes verbatim into every subsequent sub-agent brief — eliminating stale-worktree reads and silent wrong-path errors before the first edit."
3
+ description: "Before starting any non-trivial implementation, run a pre-flight reconnaissance pass to triangulate git state, project infrastructure, and prior-session memory. Auto-assembles a verified grounding preamble — a session-scoped artifact the orchestrator pastes verbatim into every subsequent sub-agent brief — eliminating stale-worktree reads and silent wrong-path errors before the first edit."
4
4
  read-only: true
5
5
  context: fork
6
6
  failure_modes:
@@ -12,42 +12,59 @@ 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`, `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.
15
+ **Constraint: read-only reconnaissance.** You 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
 
19
- Before any multi-step implementation (not single-file fixes, not pure Q&A), dispatch three parallel reconnaissance sub-agents, each with a narrow target. Adapt the first two surveyors to the domain:
19
+ ## Inline reconnaissance
20
20
 
21
- **State surveyor** *(domain-aware)*
21
+ Run the three surveys below **directly using your own tools**. Do NOT dispatch any sub-agents via the `agent` or `skill` tools — every lookup in this phase is a deterministic read that you execute yourself using `bash`, `glob`, `read_file`, `grep`, `list_directory`, and `memory_search`. Issue all three surveys in a single batched tool-use round where possible.
22
22
 
23
- | Domain | What to survey |
24
- |--------|---------------|
25
- | `software` | Current branch, `git log --oneline -5`, `git status -s`, diff-summary vs `origin/<default-branch>`, stash list. Flag: diverged, uncommitted changes, stale upstream. |
26
- | `research` | Bibliography state (how many papers collected, citation manager in use), data pipeline status (raw data present? processed?), draft status (outline? partial draft? submitted?), publication target and deadline if known. |
27
- | `design` | Design system state (component library version, Figma project structure), brand guidelines version, current design phase (research? wireframes? high-fidelity? handoff?), recent design changes. |
28
- | `business` | Financial data freshness (last updated dates on models/reports), market data recency, stakeholder map (who's involved, who decides), current phase (research? proposal? execution?). |
29
- | *(other)* | Scan for version-controlled artifacts, recent changes, current project phase, and any state that could cause conflicts. |
23
+ ### State survey *(bash)*
30
24
 
31
- **Infrastructure surveyor** *(domain-aware)*
25
+ Issue these commands (combine into one or two bash calls):
26
+ - `git symbolic-ref --short HEAD` — current branch
27
+ - `git rev-parse HEAD` — HEAD SHA
28
+ - `git status -s` — uncommitted changes
29
+ - `git log --oneline -5` — recent commit history
30
+ - `git stash list` — stash state
31
+ - `git rev-list --left-right --count HEAD...@{upstream} 2>/dev/null` — upstream divergence
32
+
33
+ Adapt what you surface to the domain:
34
+
35
+ | Domain | What to flag |
36
+ |--------|-------------|
37
+ | `software` | Branch, recent commits, uncommitted changes, stash, upstream divergence. Flag: diverged, uncommitted, stale. |
38
+ | `research` | Version-controlled artifact state, current phase, publication target/deadline if discoverable. |
39
+ | `design` | Design system version, component library state, current phase, recent file changes. |
40
+ | `business` | Financial model freshness, market data recency, current project phase. |
41
+ | *(other)* | Recent changes, current project phase, any state that could cause conflicts. |
42
+
43
+ When domain is unspecified, infer from working directory contents.
44
+
45
+ ### Infrastructure survey *(bash/glob/read_file)*
46
+
47
+ Check for relevant tooling and configs. Use the domain table below to decide which paths to probe, then probe them yourself. Return a **5-bullet inventory**.
32
48
 
33
49
  | Domain | What to scan |
34
50
  |--------|-------------|
35
- | `software` | CI configs (`.github/workflows/`, `.gitlab-ci.yml`, `Jenkinsfile`), package scripts (`package.json`, `Makefile`, `pyproject.toml`), existing linters/formatters, authoritative config file locations relevant to the task. Return 5-bullet inventory. |
36
- | `research` | Reference manager (Zotero, Mendeley, .bib files), LaTeX setup (template, build system), data analysis tools (Jupyter, R, Python scripts), collaboration tools (Overleaf, shared drives), submission system requirements. Return 5-bullet inventory. |
37
- | `design` | Design tools (Figma, Sketch, Adobe), prototyping tools (Framer, Principle), handoff tools (Zeplin, Storybook), asset pipeline (export scripts, optimization), accessibility testing tools. Return 5-bullet inventory. |
38
- | `business` | Modeling tools (Excel, Google Sheets, financial software), presentation tools (PowerPoint, Google Slides, Pitch), data sources (CRM, analytics platforms), collaboration tools (Notion, Confluence), approval workflows. Return 5-bullet inventory. |
39
- | *(other)* | Scan for tooling, build/export pipelines, collaboration infrastructure, and config files relevant to the stated domain. Return 5-bullet inventory. |
51
+ | `software` | CI configs (`ls .github/workflows/ 2>/dev/null`), package scripts (`package.json`, `Makefile`, `pyproject.toml`), linters/formatters, authoritative config files for the task. |
52
+ | `research` | Reference manager (.bib files), LaTeX setup, data analysis tools (Jupyter, R scripts), collaboration setup. |
53
+ | `design` | Design tool configs, prototyping tools, handoff configs (Storybook), asset pipeline scripts. |
54
+ | `business` | Modeling tool configs, presentation formats, data source configs, collaboration tool structure. |
55
+ | *(other)* | Tooling, build/export pipelines, collaboration infrastructure, config files relevant to the stated domain. |
40
56
 
41
- When domain is unspecified, infer from the working directory contents.
57
+ ### Memory survey *(memory_search + read_file)*
42
58
 
43
- **Memory surveyor**
44
59
  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
60
 
46
- **Invariant: the cross-session memory archive is only reachable via the `memory_search` tool.** The backing store is SQLite (`~/.afk/state/memory/memory.db`) and is not greppable. Do not glob or grep any filesystem path looking for memory — `memory_search` is the only route in. Restoring a path-based lookup here silently zeroes this third of the recon wave.
61
+ **Invariant: the cross-session memory archive is only reachable via the `memory_search` tool.** The backing store is SQLite (`~/.afk/state/memory/memory.db`) and is not greppable. Do not glob or grep any filesystem path looking for memory — `memory_search` is the only route in.
62
+
63
+ 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 fork never looked." If `memory_search` is unavailable on this surface, say so explicitly.
47
64
 
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."
65
+ ## Synthesis
49
66
 
50
- **Synthesize** into a 6-line ground-truth snapshot:
67
+ Assemble the survey results into a **6-line ground-truth snapshot**:
51
68
  - Branch: `<current>`, `<clean|diverged>`, upstream: `<fresh|stale>`
52
69
  - Recent work: last 3 commits or stash items
53
70
  - Infrastructure: CI present? package scripts? authoritative configs for this task
@@ -57,14 +74,14 @@ Return: relevant facts with 1-line summaries, **plus the stores actually consult
57
74
 
58
75
  Surface the snapshot and stop. The orchestrator then uses these verified facts — not assumptions — to decide the next step. This skill never edits files.
59
76
 
60
- ## Wave 4 — Brief Anchor (auto-runs after synthesis)
77
+ ## Brief Anchor (auto-runs after synthesis)
61
78
 
62
- After the 6-line snapshot is assembled, run a fourth step inline (no additional sub-agent dispatch required): construct the **Brief Anchor** — a path-verified grounding preamble the orchestrator pastes verbatim into every subsequent sub-agent brief.
79
+ After the 6-line snapshot is assembled, construct the **Brief Anchor** — a path-verified grounding preamble the orchestrator pastes verbatim into every subsequent sub-agent brief.
63
80
 
64
81
  **Construction procedure:**
65
82
 
66
- 1. From the state surveyor output, extract the verified `cwd` (absolute path from `pwd`), `branch` (from `git symbolic-ref --short HEAD`), and `HEAD` SHA (from `git rev-parse HEAD`).
67
- 2. From the infrastructure surveyor output, extract the 2–4 canonical file paths most relevant to the task (primary config file, main entry point, test root, etc.). For each, run `stat <path>` — include the path only if `stat` exits 0. Paths that fail `stat` are omitted; if zero paths survive, set the list to `(none verified)`.
83
+ 1. From your state survey output, extract the verified `cwd` (absolute path from `pwd`), `branch` (from `git symbolic-ref --short HEAD`), and `HEAD` SHA (from `git rev-parse HEAD`).
84
+ 2. From your infrastructure survey output, extract the 2–4 canonical file paths most relevant to the task. For each, run `stat <path>` — include the path only if `stat` exits 0. Paths that fail `stat` are omitted; if zero paths survive, set the list to `(none verified)`.
68
85
  3. Assemble the preamble block:
69
86
 
70
87
  ```
@@ -81,8 +98,8 @@ After the 6-line snapshot is assembled, run a fourth step inline (no additional
81
98
 
82
99
  **Orchestrator usage contract:**
83
100
 
84
- - Prepend the Brief Anchor verbatim to every sub-agent brief that reads files, runs `git`/`gh` commands, or references explicit paths. Skip for pure-reasoning tasks (no filesystem reads, no path references).
85
- - Sub-agents receiving the anchor `stat` each listed path on entry. A missing path returns `GROUNDING_FAILED:<path>` — the orchestrator re-dispatches once with the corrected path. If the retry also returns `GROUNDING_FAILED`, emit `BRIEF_GROUND_ABORT` with both the expected and actual paths **plus the corrective command** the operator should run — `git worktree list` to find the intended checkout, then `cd <correct-worktree>` (or re-invoke the orchestrator from it) — and halt the wave so the operator resolves the worktree mismatch.
101
+ - Prepend the Brief Anchor verbatim to every sub-agent brief that reads files, runs `git`/`gh` commands, or references explicit paths. Skip for pure-reasoning tasks.
102
+ - Sub-agents receiving the anchor `stat` each listed path on entry. A missing path returns `GROUNDING_FAILED:<path>` — the orchestrator re-dispatches once with the corrected path. If the retry also returns `GROUNDING_FAILED`, emit `BRIEF_GROUND_ABORT` with both the expected and actual paths **plus the corrective command** the operator should run — `git worktree list` to find the intended checkout, then `cd <correct-worktree>` — and halt the wave.
86
103
  - The anchor is session-scoped: one construction pass per `ground-state` invocation. Do not re-invoke `ground-state` mid-session to refresh it; instead pass the existing anchor through.
87
104
 
88
105
  **Skip when:**