@agentprojectcontext/apx 1.34.0 → 1.35.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.
Files changed (65) hide show
  1. package/package.json +1 -1
  2. package/skills/apx/SKILL.md +1 -1
  3. package/src/core/agent/build-agent-system.js +134 -58
  4. package/src/core/agent/channels/voice-context.js +4 -4
  5. package/src/core/agent/prompt-builder.js +176 -123
  6. package/src/core/agent/prompts/channels/code.md +12 -10
  7. package/src/core/agent/prompts/channels/desktop.md +5 -32
  8. package/src/core/agent/prompts/channels/telegram.md +4 -15
  9. package/src/core/agent/prompts/channels/web_code.md +11 -11
  10. package/src/core/agent/prompts/core/agent-base.md +24 -0
  11. package/src/core/agent/prompts/core/project-agent.md +11 -0
  12. package/src/core/agent/prompts/core/super-agent.md +21 -0
  13. package/src/core/agent/prompts/discipline/action.md +10 -0
  14. package/src/core/agent/prompts/discipline/single-segment.md +6 -0
  15. package/src/core/agent/prompts/discipline/two-segment.md +11 -0
  16. package/src/core/agent/self-memory.js +43 -1
  17. package/src/core/agent/skills/index-store.js +307 -0
  18. package/src/core/agent/skills/index.js +15 -1
  19. package/src/core/agent/skills/inspector.js +317 -0
  20. package/src/core/agent/super-agent.js +7 -1
  21. package/src/core/agent/tools/handlers/_git.js +50 -0
  22. package/src/core/agent/tools/handlers/git-diff.js +44 -0
  23. package/src/core/agent/tools/handlers/git-log.js +38 -0
  24. package/src/core/agent/tools/handlers/git-show.js +34 -0
  25. package/src/core/agent/tools/handlers/git-status.js +61 -0
  26. package/src/core/agent/tools/names.js +31 -0
  27. package/src/core/agent/tools/registry.js +36 -5
  28. package/src/core/config/index.js +21 -0
  29. package/src/core/runtime-skills/apx/SKILL.md +27 -39
  30. package/src/core/runtime-skills/apx-agency-agents/SKILL.md +40 -56
  31. package/src/core/runtime-skills/apx-agent/SKILL.md +27 -30
  32. package/src/core/runtime-skills/apx-mcp/SKILL.md +31 -36
  33. package/src/core/runtime-skills/apx-mcp-builder/SKILL.md +37 -51
  34. package/src/core/runtime-skills/apx-project/SKILL.md +20 -29
  35. package/src/core/runtime-skills/apx-routine/SKILL.md +34 -47
  36. package/src/core/runtime-skills/apx-runtime/SKILL.md +32 -50
  37. package/src/core/runtime-skills/apx-sessions/SKILL.md +96 -145
  38. package/src/core/runtime-skills/apx-skill-builder/SKILL.md +53 -77
  39. package/src/core/runtime-skills/apx-task/SKILL.md +18 -21
  40. package/src/core/runtime-skills/apx-telegram/SKILL.md +43 -54
  41. package/src/core/runtime-skills/apx-voice/SKILL.md +36 -56
  42. package/src/host/daemon/api/skills.js +140 -6
  43. package/src/host/daemon/api/super-agent.js +56 -1
  44. package/src/host/daemon/index.js +17 -0
  45. package/src/interfaces/cli/branding.js +53 -0
  46. package/src/interfaces/cli/commands/skills.js +254 -0
  47. package/src/interfaces/cli/index.js +84 -2
  48. package/src/interfaces/web/dist/assets/index-C0fm31dY.js +618 -0
  49. package/src/interfaces/web/dist/assets/index-C0fm31dY.js.map +1 -0
  50. package/src/interfaces/web/dist/assets/index-UcAqlBO6.css +1 -0
  51. package/src/interfaces/web/dist/index.html +2 -2
  52. package/src/interfaces/web/src/components/chat/MessageBubble.tsx +21 -1
  53. package/src/interfaces/web/src/components/settings/MemoryPanel.tsx +68 -0
  54. package/src/interfaces/web/src/components/settings/SkillsInspectorPanel.tsx +222 -0
  55. package/src/interfaces/web/src/hooks/useChat.ts +19 -0
  56. package/src/interfaces/web/src/i18n/en.ts +1 -0
  57. package/src/interfaces/web/src/i18n/es.ts +1 -0
  58. package/src/interfaces/web/src/lib/api/skills.ts +70 -0
  59. package/src/interfaces/web/src/screens/SettingsScreen.tsx +6 -2
  60. package/src/interfaces/web/src/types/daemon.ts +10 -0
  61. package/src/core/agent/prompts/action-discipline.md +0 -24
  62. package/src/core/agent/prompts/super-agent-base.md +0 -42
  63. package/src/interfaces/web/dist/assets/index-DdmSRtsz.css +0 -1
  64. package/src/interfaces/web/dist/assets/index-M4FspaCH.js +0 -613
  65. package/src/interfaces/web/dist/assets/index-M4FspaCH.js.map +0 -1
@@ -1,11 +1,11 @@
1
1
  ---
2
2
  name: apx-runtime
3
- description: Delegate a task to an external coding CLI (claude-code, codex, opencode, aider, cursor-agent, gemini-cli, qwen-code) via `apx run`. APX builds the system prompt, spawns the CLI, and captures the result. Load when delegating work to another AI tool.
3
+ description: Delegate a task to an external coding CLI (claude-code, codex, opencode, aider, cursor-agent, gemini-cli, qwen-code) via `apx run`. APX builds the system prompt, spawns the CLI, captures the result. Load when delegating to another AI tool.
4
4
  ---
5
5
 
6
6
  # apx-runtime
7
7
 
8
- A "runtime" in APX is an external AI coding CLI that APX can invoke headlessly. APX builds the agent's system prompt, spawns the CLI with the right flags, captures the stdout (and the external tool's session id when available), and stores the run metadata as a session file under `~/.apx/projects/<apxId>/agents/<slug>/sessions/` (runtime state — never committed). Some flows also link to the external engine's own transcript path.
8
+ A "runtime" is an external AI coding CLI that APX invokes headlessly. APX builds the agent's system prompt, spawns the CLI with the right flags, captures stdout (and the external session id when available), and stores run metadata as a session file under `~/.apx/projects/<apxId>/agents/<slug>/sessions/` (never committed). Some flows link to the engine's own transcript path.
9
9
 
10
10
  ## Supported runtimes
11
11
 
@@ -17,35 +17,33 @@ A "runtime" in APX is an external AI coding CLI that APX can invoke headlessly.
17
17
  | `aider` | `aider` | `--message "<prompt>" --no-stream` |
18
18
  | `cursor-agent` | `cursor-agent` | headless print mode |
19
19
  | `gemini-cli` | `gemini` | headless prompt mode |
20
- | `qwen-code` | `qwen-code` | passes system prompt separately |
20
+ | `qwen-code` | `qwen-code` | system prompt passed separately |
21
21
 
22
22
  `apx env detect` reports which are installed and reachable.
23
23
 
24
24
  ## Concrete CLI calls
25
25
 
26
26
  ```bash
27
- # What's available on this machine
28
- apx env detect # which runtimes are installed and reachable
29
- apx env list # alias of `apx env detect`
27
+ apx env detect # which runtimes are installed
28
+ apx env list # alias
30
29
 
31
- # Run an agent through an external CLI
32
30
  apx run reviewer --runtime claude-code "Review the diff in src/host/daemon/api/ for memory leaks"
33
31
  apx run scratch --runtime codex "Refactor parseAgentsMd to use a state machine"
34
32
  apx run scratch --runtime opencode "<prompt>"
35
- apx run scratch --runtime codex --timeout 300 "<prompt>" # cap the run (seconds)
36
- apx run scratch --runtime codex - # read the prompt from stdin (large prompts)
33
+ apx run scratch --runtime codex --timeout 300 "<prompt>" # cap (seconds)
34
+ apx run scratch --runtime codex - # prompt from stdin (large prompts)
37
35
  ```
38
36
 
39
37
  Behavior:
40
- 1. APX picks the project from `--project` or cwd.
41
- 2. Reads the agent's `AGENT.md` + memory + skills, builds the system prompt with `buildAgentSystem({ invocation: "runtime", runtime: "<id>" })`.
42
- 3. Spawns the CLI with the right flags. cwd = project path.
43
- 4. Captures stdout. If the runtime printed `APC_RESULT: <value>`, that's the structured result; else the first 200 chars of stdout.
44
- 5. Writes `~/.apx/projects/<apxId>/agents/<slug>/sessions/<YYYY-MM-DD>-<id>.md` with frontmatter linking back to the external tool's own session file (when available).
38
+ 1. APX picks project from `--project` or cwd.
39
+ 2. Reads agent's `AGENT.md` + memory + skills; builds system prompt with `buildAgentSystem({ invocation: "runtime", runtime: "<id>" })`.
40
+ 3. Spawns CLI with the right flags; cwd = project path.
41
+ 4. Captures stdout. If runtime printed `APC_RESULT: <value>`, that's the structured result; else first 200 chars of stdout.
42
+ 5. Writes `~/.apx/projects/<apxId>/agents/<slug>/sessions/<YYYY-MM-DD>-<id>.md` with frontmatter linking back to the external transcript when available.
45
43
 
46
44
  ## Resuming an external session
47
45
 
48
- After a `apx run`, the resulting APC session file references the external transcript:
46
+ The session file references the external transcript:
49
47
 
50
48
  ```yaml
51
49
  # ~/.apx/projects/<apxId>/agents/reviewer/sessions/2026-05-27-claude-code-abc123.md
@@ -56,62 +54,46 @@ session_id: abc123
56
54
  ---
57
55
  ```
58
56
 
59
- All session resume / get / continue / summarise operations live in the
60
- **`apx-sessions`** skill. From here, the most common quick paths:
57
+ Full resume/get/continue/summarise lives in the **`apx-sessions`** skill. Quick paths:
61
58
 
62
59
  ```bash
63
- # Discover the id (or use the one printed by `apx run`)
64
60
  apx sessions list --engine claude --project iacrmar
65
-
66
- # Resume apx auto-detects which engine owns the id
67
- apx session resume <id>
68
- apx session resume <id> --continue # spawn the native CLI to keep going
69
- apx session resume <id> --summary # super-agent summary of the transcript
70
- apx session resume <id> --into apx:<slug> # seed a new APX session with the summary
71
-
72
- # Just read the transcript
73
- apx session get <id> --any --full # or --engine claude --tail 16k
61
+ apx session resume <id> # auto-detects engine
62
+ apx session resume <id> --continue # spawn native CLI to keep going
63
+ apx session resume <id> --summary # super-agent summary
64
+ apx session resume <id> --into apx:<slug> # seed new APX session
65
+ apx session get <id> --any --full # or --engine claude --tail 16k
74
66
  ```
75
67
 
76
- See the `apx-sessions` skill for the full flag reference, collision handling,
77
- and daemon-vs-no-daemon matrix.
68
+ See `apx-sessions` for full flag reference, collision handling, and daemon-vs-no-daemon matrix.
78
69
 
79
70
  ## APC_RESULT contract
80
71
 
81
- When you want APX to capture a structured value from the external runtime, instruct the runtime via the prompt to print on its last line:
72
+ To capture a structured value from the external runtime, instruct it via the prompt to print on its last line:
82
73
 
83
74
  ```
84
75
  APC_RESULT: <one-line value>
85
76
  ```
86
77
 
87
- APX `extractApfResult()` parses that and stores it as the session's `result` field. Useful for return values from automation.
78
+ `extractApfResult()` parses that into the session's `result` field. Useful for automation return values.
88
79
 
89
80
  ## Anti-examples
90
81
 
91
- ```bash
92
- # DON'T expect `apx run` to be interactive. It's headless.
93
- # For interactive, just invoke the CLI directly (e.g. `claude` for Claude Code).
94
-
95
- # DON'T pass huge prompts via the command line (shell args have limits).
96
- # For prompts > ~10KB, use a stdin-friendly route or write a temp file and reference it.
97
-
98
- # DON'T forget that each runtime has its own model selection.
99
- # APX passes the system prompt and the user prompt; it does NOT impose a model on
100
- # the external CLI. The user's external CLI config (e.g. Claude Code's CLAUDE.md
101
- # defaults) wins.
102
- ```
82
+ - DON'T expect `apx run` to be interactive — it's headless. For interactive, invoke the CLI directly (e.g. `claude`).
83
+ - DON'T pass huge prompts via command line (shell arg limits). For >~10KB, use stdin (`-`) or a temp file.
84
+ - DON'T expect APX to impose a model on the external CLI. APX passes system + user prompt only; the external CLI's own config wins.
103
85
 
104
86
  ## When to use which
105
87
 
106
88
  | You want | Pick |
107
89
  |---|---|
108
- | Pair-program with file edits and shell | `claude-code` if the user has Claude Code, else `codex` |
109
- | Lightweight LLM run with no tools | `apx exec <agent> "<prompt>"` (no runtime needed) |
110
- | The super-agent to call other agents | `call_agent` tool (in-process, no spawn) |
111
- | Run something that needs persisted state across days | `apx run` with `claude-code` or `codex` (their sessions persist) |
90
+ | Pair-program with file edits + shell | `claude-code` if installed, else `codex` |
91
+ | Lightweight LLM run, no tools | `apx exec <agent> "<prompt>"` (no runtime needed) |
92
+ | Super-agent to call other agents | `call_agent` tool (in-process, no spawn) |
93
+ | Persisted state across days | `apx run` with `claude-code` or `codex` (their sessions persist) |
112
94
 
113
95
  ## Don't
114
96
 
115
- - Don't run untrusted prompts in `--runtime` of a CLI with broad tool permissions on the user's machine. The CLI may take file write or shell actions.
116
- - Don't expect APX to track tool calls inside the external CLI's transcript. APX captures stdout and the external session path that's it. Inspect the external transcript directly for tool-level audit.
117
- - Don't pick a runtime the user doesn't have installed; `apx env detect` first if unsure.
97
+ - Run untrusted prompts in a `--runtime` CLI with broad tool permissions the CLI may take file/shell actions.
98
+ - Expect APX to track tool calls inside the external transcript. APX captures stdout + external session path only; inspect the external transcript for tool-level audit.
99
+ - Pick a runtime the user doesn't have installed; `apx env detect` first.
@@ -1,281 +1,232 @@
1
1
  ---
2
2
  name: apx-sessions
3
- description: "Manage APX sessions across engines (apx, claude, codex). Find a session by title, list, resume, summarize, ask about, or pull a transcript — without knowing which engine owns it. Triggers: 'apx session find/ask/summary/resume/get', 'find a session', 'resume claude/codex session', 'summarize session', 'get session transcript', 'continue session in apx'. Not for `apx run` orchestration (that's the apx skill)."
3
+ description: "Cross-engine session ops (apx, claude, codex, antigravity): find by title, list, get transcript, summarize, ask, resume, continue. Triggers: 'apx session find/ask/summary/resume/get', 'find/resume/summarize session', 'get session transcript', 'continue session in apx'. Not for `apx run` orchestration (use apx skill)."
4
4
  ---
5
5
 
6
- # APX Sessions — cross-engine resume, summary, and continuation
6
+ # APX Sessions — cross-engine resume, summary, continuation
7
7
 
8
- APX treats every supported engine (apx, claude, codex, antigravity) as a session store. The commands in this skill let you list, read, summarize, and continue sessions **without caring which engine owns them**.
8
+ APX treats every supported engine as a session store. These commands list, read, summarize, and continue sessions **without caring which engine owns them**.
9
9
 
10
- Engine storage locations APX scans:
10
+ Storage locations APX scans:
11
11
 
12
- | Engine | Where APX looks |
12
+ | Engine | Where |
13
13
  |-----------|-----------------------------------------------------------|
14
14
  | apx | `~/.apx/projects/<apx_id>/agents/<slug>/sessions/*.md` |
15
15
  | claude | `~/.claude/projects/<encoded-cwd>/<id>.jsonl` |
16
16
  | codex | `~/.codex/sessions/YYYY/MM/DD/rollout-*.jsonl` |
17
17
  | antigravity | detected only — listing not implemented yet |
18
18
 
19
- Engines not installed on the machine are silently skipped. Detected-but-empty engines show `(sin nada)`.
19
+ Uninstalled engines are skipped silently. Detected-but-empty engines print `(sin nada)`.
20
20
 
21
21
  ---
22
22
 
23
- ## The discovery flow (read this first)
23
+ ## Discovery flow (read first)
24
24
 
25
- You almost never start with a session id — you start with a vague memory of a *title* ("the one about improving the web UI"). Do **not** hand-roll `apx sessions list ... | grep`. The flow is three commands:
25
+ You start with a vague title, not an id. Do **not** `apx sessions list | grep`. The flow:
26
26
 
27
27
  ```bash
28
- # 1. Turn a remembered title into an id (cross-engine, newest first)
28
+ # 1. Title id (cross-engine, newest first)
29
29
  apx session find "improve web UI"
30
30
 
31
- # 2. Get the gist of that session
31
+ # 2. Gist
32
32
  apx session summary <id>
33
33
 
34
- # 3. Ask something specific about it
34
+ # 3. Specifics
35
35
  apx session ask <id> "what sidebar changes were left pending?"
36
36
  ```
37
37
 
38
- `find` prints a "Next:" block with the exact `summary`/`ask`/`resume` commands pre-filled with the top hit's id, so you can copy-paste straight through. **If you're tempted to grep session lists, use `find` instead.**
38
+ `find` prints a "Next:" block with `summary`/`ask`/`resume` pre-filled with the top hit's id. **If tempted to grep session lists, use `find` instead.**
39
39
 
40
40
  ---
41
41
 
42
- ## Finding a session by title or content (`apx session find`)
42
+ ## Finding sessions (`apx session find`)
43
43
 
44
44
  ```bash
45
- apx session find "<text>" # match titles across every engine
46
- apx session find "<text>" --deep # also search inside transcript content
45
+ apx session find "<text>" # titles across every engine
46
+ apx session find "<text>" --deep # also greps transcript content
47
47
  apx session find "<text>" --engine codex # restrict to one engine
48
- apx session find "<text>" --dir /path/to/repo # scope to one project (reaches unregistered Claude projects)
49
- apx session find "<text>" --limit 10 --json # cap results / machine-readable
48
+ apx session find "<text>" --dir /path/to/repo # scope (reaches unregistered Claude projects)
49
+ apx session find "<text>" --limit 10 --json
50
50
  ```
51
51
 
52
- - Default search is **title-only** (fast titles are already indexed per engine).
53
- - `--deep` reads each candidate transcript off disk and greps its content too. Slower; prefer combining it with `--engine`/`--dir` scope.
54
- - Output is one row per match — `DATE | ENGINE | SESSION ID | TITLE` — newest first, followed by ready-to-run `summary`/`ask`/`resume` commands.
52
+ Default is title-only (fast, indexed). `--deep` reads each candidate transcript off disk; combine with `--engine`/`--dir` to scope. Output rows: `DATE | ENGINE | SESSION ID | TITLE`, newest first, plus ready-to-run `summary`/`ask`/`resume` commands.
55
53
 
56
- **Coverage caveat:** an engine can only be enumerated when APX can resolve a project's working directory. Codex always records it; APX uses registered projects; **Claude only lists folders that map back to a registered APX project** (its folder names are a lossy encoding of the cwd). If a Claude session is missing, scope with `--dir <path>` to reach it.
54
+ **Coverage caveat:** an engine is enumerated only when APX can resolve a project cwd. Codex always records it; APX uses registered projects; **Claude only lists folders mapping to a registered APX project** (encoded folder names are lossy). If a Claude session is missing, scope with `--dir <path>`.
57
55
 
58
56
  ---
59
57
 
60
- ## Summarizing a session (`apx session summary`)
58
+ ## Summarize / Ask
61
59
 
62
60
  ```bash
63
- apx session summary <id> # auto-detect engine, print an LLM summary
64
- apx session summary <id> --engine claude # skip auto-detect
61
+ apx session summary <id> # auto-detect, LLM summary
62
+ apx session summary <id> --engine claude
65
63
  apx session summary <id> --max-chunks 8 # bound cost on a huge transcript
66
- ```
67
-
68
- This is the discoverable alias for `apx session resume <id> --summary`. It resolves the owning engine, then prints a 4-bullet summary plus next steps. **Requires the daemon + `super_agent.enabled`.**
69
-
70
- ---
71
64
 
72
- ## Asking questions about a session (`apx session ask`)
73
-
74
- ```bash
75
65
  apx session ask <id> "what did we decide about the sidebar?"
76
66
  apx session ask <id> "what files were changed?" --max-chunks 30
77
67
  ```
78
68
 
79
- RAG-lite Q&A over the transcript. Small transcripts are answered in one shot; large ones are **map-reduced**: each ~48 KB part is mined for question-relevant notes, then a final pass synthesizes the answer. **Requires the daemon + `super_agent.enabled`.**
80
-
81
- How it works and its limits:
69
+ `summary` is the alias for `apx session resume <id> --summary`: resolves engine, prints a 4-bullet summary plus next steps. `ask` is RAG-lite Q&A: small transcripts answer in one shot; large ones are **map-reduced** (each ~48 KB part mined for relevant notes, final pass synthesizes). Both **require the daemon + `super_agent.enabled`**.
82
70
 
83
- - Binary noise (base64 image payloads, which can be the majority of a JSONL transcript) is stripped before chunking.
84
- - Coverage is capped at `--max-chunks` (default 20 ≈ ~960 KB). Bigger transcripts print a truncation warning — raise `--max-chunks` for full coverage at the cost of more (sequential) model calls.
85
- - Speed scales with transcript size: a typical session answers in seconds; a multi-MB Codex rollout can take a couple of minutes.
86
- - Output quality depends on the configured `super_agent.model`. Small/cheap models that "think" (e.g. gemini-2.5-flash) can return thin answers; the command already requests a raised output budget to compensate.
71
+ Limits of `ask`: binary noise (base64 images) is stripped before chunking. Coverage capped at `--max-chunks` (default 20 ≈ 960 KB) — bigger transcripts print a truncation warning; raise `--max-chunks` for full coverage at the cost of more sequential model calls. Speed scales with size (seconds to a couple of minutes). Quality depends on `super_agent.model` — cheap thinking models (e.g. gemini-2.5-flash) can return thin answers.
87
72
 
88
73
  ---
89
74
 
90
75
  ## Listing sessions
91
76
 
92
77
  ```bash
93
- # Every detected engine, every known project — broadest view
94
- apx sessions list
95
-
96
- # Every engine, scoped to one directory (no need for it to be a registered APX project)
97
- apx sessions list --dir /path/to/repo
98
- apx sessions list --project iacrmar # uses a registered APX project's path
99
-
100
- # One engine, all projects
101
- apx sessions list --engine claude
102
- apx sessions list --engine codex
103
-
104
- # One engine, one project
105
- apx sessions list --engine claude --project iacrmar
106
- apx sessions list --engine codex --dir /path/to/repo --limit 10
78
+ apx sessions list # all engines, all projects
79
+ apx sessions list --dir /path/to/repo # all engines, one dir (no registration needed)
80
+ apx sessions list --project iacrmar # all engines, registered project
81
+ apx sessions list --engine claude # one engine, all projects
82
+ apx sessions list --engine codex --dir /path --limit 10 # one engine, one dir
107
83
  ```
108
84
 
109
- Output format per engine: `DATE | SESSION ID | TITLE`, newest first, plus the exact native-CLI resume command at the bottom.
110
-
111
- When no `--engine` is passed, output is grouped by engine with `══ <Engine> ══` headers. Empty engines print `(sin nada)`; un-installed engines are not listed at all.
85
+ Per engine: `DATE | SESSION ID | TITLE` newest first, plus the native-CLI resume command at the bottom. Without `--engine`, output is grouped with `══ <Engine> ══` headers. Empty engines print `(sin nada)`; uninstalled engines are omitted.
112
86
 
113
87
  ---
114
88
 
115
- ## Resuming a session by id (the headline command)
89
+ ## Resuming by id (`apx session resume <id>`)
116
90
 
117
- ```bash
118
- apx session resume <id>
119
- ```
120
-
121
- What it does, in order:
91
+ 1. Searches every engine (apx → claude → codex).
92
+ 2. **One match** → prints metadata (engine, path, cwd, title).
93
+ 3. **Zero matches** → non-zero exit with `session "<id>" not found in any detected engine`.
94
+ 4. **Multiple matches** → prints all, exit 2, asks for `--engine <id>`.
122
95
 
123
- 1. Searches every detected engine for `<id>` (apx → claude → codex).
124
- 2. **One match** → prints metadata: engine, file path, cwd, title.
125
- 3. **Zero matches** → exits non-zero with `session "<id>" not found in any detected engine`.
126
- 4. **Multiple matches (collision)** → prints all of them and exits with code 2, telling you to re-run with `--engine <id>`.
127
-
128
- Then it applies any of the following flags:
96
+ Flags:
129
97
 
130
98
  | Flag | Effect |
131
99
  |------|--------|
132
- | `--engine <apx\|claude\|codex>` | Restrict the search to one engine (skip auto-detection). |
133
- | `--tail N[k\|m]` | Print last N bytes of the transcript (e.g. `--tail 32k`). No daemon required. |
134
- | `--full` / `--body` | Dump the entire transcript. No daemon required. |
135
- | `--summary` | Send the tail to the APX super-agent and print a 4-bullet summary. **Requires daemon + `super_agent.enabled`.** |
136
- | `--continue` | Spawn the engine's native CLI in resume mode (`claude --resume <id>`, `codex resume <id>`) in the recorded cwd. |
137
- | `--into apx[:slug]` | Create a brand-new APX session whose body is the summary of `<id>`. Frontmatter records `parent_session: <engine>:<id>` for lineage. Default slug = the session's original APX agent if any, else the first agent in `AGENTS.md`. |
138
- | `--project <name\|id\|path>` | Used only for `--summary` on apx-native sessions (picks the daemon project). |
100
+ | `--engine <apx\|claude\|codex>` | Skip auto-detection. |
101
+ | `--tail N[k\|m]` | Print last N bytes (e.g. `--tail 32k`). No daemon. |
102
+ | `--full` / `--body` | Dump entire transcript. No daemon. |
103
+ | `--summary` | Tail super-agent 4-bullet summary. **Daemon + `super_agent.enabled`.** |
104
+ | `--continue` | Spawn engine's native CLI in resume mode (`claude --resume <id>`, `codex resume <id>`) in recorded cwd. |
105
+ | `--into apx[:slug]` | Create a new APX session whose body is the summary of `<id>`. Frontmatter records `parent_session: <engine>:<id>`. Default slug = original APX agent if any, else first agent in `AGENTS.md`. |
106
+ | `--project <name\|id\|path>` | Only for `--summary` on apx-native sessions. |
139
107
 
140
- ### Common recipes
108
+ ### Recipes
141
109
 
142
110
  ```bash
143
- # "I have a Codex session id, give me a summary in apx"
111
+ # Codex id summary in apx
144
112
  apx session resume 019abc... --summary
145
113
 
146
- # "I want to keep working on that Codex thread, but in APX with the reviewer agent"
114
+ # Continue a Codex thread inside APX with the reviewer agent
147
115
  apx session resume 019abc... --summary --into apx:reviewer
148
116
 
149
- # "Just dump the full transcript so I can grep it"
117
+ # Dump full transcript and grep
150
118
  apx session resume 019abc... --full | rg "TODO"
151
119
 
152
- # "Re-open in the native CLI, interactively"
120
+ # Re-open in native CLI
153
121
  apx session resume 019abc... --continue
154
122
 
155
- # "I know it's a Claude session, skip auto-detect"
123
+ # Known Claude session, skip auto-detect
156
124
  apx session resume 2e3c840b-... --engine claude --tail 16k
157
125
  ```
158
126
 
159
127
  ---
160
128
 
161
- ## Reading a session's content (`apx session get`)
162
-
163
- `apx session get` is the "fetch and read" command. It has two modes:
164
-
165
- ### Default mode — local APC project sessions
129
+ ## Reading content (`apx session get`)
166
130
 
167
131
  ```bash
168
- apx session get <id> # metadata of the local APC session
132
+ # Default: local APC project sessions
133
+ apx session get <id> # metadata
169
134
  apx session get <id> --body # full markdown body
170
135
  apx session get <id> --json # machine-readable metadata
171
- ```
172
-
173
- ### Engine mode — read any engine's session by id
174
136
 
175
- ```bash
176
- apx session get <id> --engine claude --full # full Claude JSONL
177
- apx session get <id> --engine codex --tail 16k # last 16 KB of a Codex rollout
178
- apx session get <id> --any --full # search every engine, error on collision
179
- apx session get <id> --engine claude --json # JSON metadata only
137
+ # Engine mode: any engine by id
138
+ apx session get <id> --engine claude --full
139
+ apx session get <id> --engine codex --tail 16k
140
+ apx session get <id> --any --full # search all engines, error on collision
141
+ apx session get <id> --engine claude --json
180
142
  ```
181
143
 
182
- **This is the command you want when you're inside Claude and need to ingest a Codex/Claude session as context.** Pipe `--full` into a file or directly into your prompt.
144
+ **Use this to pull a Codex/Claude session into your current context.** Pipe `--full` into a file or prompt:
183
145
 
184
146
  ```bash
185
- # Pull a Codex session into context for the current Claude session
186
147
  apx session get 019abc... --engine codex --full > /tmp/prev.jsonl
187
148
  ```
188
149
 
189
150
  ---
190
151
 
191
- ## Daemon vs. no daemon
152
+ ## Daemon requirements
192
153
 
193
- | Capability | Daemon required? |
194
- |------------|------------------|
195
- | `apx session find ...` | no |
196
- | `apx sessions list ...` | no |
197
- | `apx session get ...` (any mode) | no |
198
- | `apx session resume <id>` (metadata only) | ❌ no |
199
- | `apx session resume <id> --tail / --full` | ❌ no |
200
- | `apx session resume <id> --continue` | ❌ no |
201
- | `apx session resume <id> --summary` / `apx session summary <id>` | ✅ yes (daemon + `super_agent.enabled` in `~/.apx/config.json`) |
202
- | `apx session ask <id> "<q>"` | ✅ yes (daemon + `super_agent.enabled`) |
203
- | `apx session resume <id> --into apx[:slug]` | ⚠️ daemon needed only to compute the summary it embeds; without it, the new session is created with an empty summary block |
154
+ | Capability | Daemon? |
155
+ |------------|---------|
156
+ | `find`, `list`, `get`, `resume <id>` (metadata/tail/full/continue) | no |
157
+ | `resume --summary`, `summary`, `ask` | yes (daemon + `super_agent.enabled` in `~/.apx/config.json`) |
158
+ | `resume --into apx[:slug]` | daemon needed only to compute embedded summary; without it the new session has an empty summary block |
204
159
 
205
160
  If the daemon is down, `apx` auto-starts it when needed.
206
161
 
207
162
  ---
208
163
 
209
- ## Native APX session commands (legacy / still useful)
164
+ ## Native APX session commands (legacy, still useful)
210
165
 
211
- These manage APX-native sessions (the `.md` files in `~/.apx/projects/.../sessions/`). They do **not** see Claude/Codex sessions.
166
+ Manage APX-native sessions (`.md` files in `~/.apx/projects/.../sessions/`). They do **not** see Claude/Codex sessions.
212
167
 
213
168
  ```bash
214
169
  apx session new <slug> --title "Investigate bug X"
215
- apx session list # all agents in the current APC project
216
- apx session list <slug> # one agent
170
+ apx session list # all agents in current APC project
171
+ apx session list <slug>
217
172
  apx session update <id> --status "in progress"
218
173
  apx session close <id> --result "Fixed in PR #42"
219
- apx session check # exit 1 if any APX session is still open
220
- apx session close-stale # auto-close sessions older than 1h
221
- apx session compact <slug> # summarize a conversation durable to disk
174
+ apx session check # exit 1 if any APX session is open
175
+ apx session close-stale # auto-close >1h old
176
+ apx session compact <slug> # summarize a conversation to disk
222
177
  ```
223
178
 
224
- These live next to the new cross-engine commands above; they don't replace each other.
225
-
226
179
  ---
227
180
 
228
181
  ## Disambiguating collisions
229
182
 
230
- If two engines happen to use the same id string for different sessions:
231
-
232
183
  ```
233
184
  $ apx session resume abc123
234
185
  ⚠️ session id "abc123" exists in multiple engines:
235
186
  - claude /Users/.../-Volumes-work-repo/abc123.jsonl (cwd: /Volumes/work/repo)
236
- - codex /Users/.../sessions/2026/05/27/rollout-2026-05-27T10-00-00-abc123.jsonl (cwd: /Volumes/work/repo)
187
+ - codex /Users/.../sessions/2026/05/27/rollout-...-abc123.jsonl (cwd: /Volumes/work/repo)
237
188
  → re-run with --engine <id> to pick one (apx | claude | codex)
238
189
  ```
239
190
 
240
- Pick one with `--engine claude` or `--engine codex` and run again.
191
+ Pick one with `--engine claude` or `--engine codex`.
241
192
 
242
193
  ---
243
194
 
244
195
  ## Tips for callers (LLMs)
245
196
 
246
- 1. **Start with `find`, not grep.** If the user describes a session by topic instead of id, run `apx session find "<text>"`. Never reconstruct this with `apx sessions list | grep` — that's the exact footgun this command replaces.
247
- 2. **Don't ask the user which engine.** Auto-detect handles it. If the CLI prints a collision message, *then* re-run with `--engine`.
248
- 3. **`summary` for the gist, `ask` for specifics.** Use `apx session summary <id>` to orient; use `apx session ask <id> "<q>"` when the user has a concrete question. Both need the daemon + `super_agent.enabled`.
249
- 4. **`ask` on a huge transcript is slow and capped.** If the output warns about truncation and the user needs full coverage, re-run with a higher `--max-chunks`.
250
- 5. **Prefer `--tail N` over `--full`** when feeding a raw transcript into another model — JSONL is verbose, the tail is dense.
251
- 6. **`--into apx:slug` is the bridge** between an external runtime's session and an APX agent. Use it when the user says "let's continue this in apx with the reviewer agent".
252
- 7. **Don't invent ids.** Discover them via `apx session find` or `apx sessions list`.
253
- 8. **`apx session get --any --full`** is the simplest way to import an arbitrary engine session into your context, with no daemon dependency.
197
+ 1. **Start with `find`, not grep.** Never reconstruct via `apx sessions list | grep`.
198
+ 2. **Don't ask the user which engine.** Auto-detect handles it; re-run with `--engine` only on collision.
199
+ 3. **`summary` for the gist, `ask` for specifics.** Both need daemon + `super_agent.enabled`.
200
+ 4. **`ask` on huge transcripts is slow and capped.** Raise `--max-chunks` if truncation warns and full coverage matters.
201
+ 5. **Prefer `--tail N` over `--full`** when feeding raw transcripts to another model — JSONL is verbose, the tail is dense.
202
+ 6. **`--into apx:slug`** is the bridge for "let's continue this in apx with the reviewer agent".
203
+ 7. **Don't invent ids.** Discover them via `find` or `sessions list`.
204
+ 8. **`apx session get --any --full`** is the simplest no-daemon import of any engine session.
254
205
 
255
206
  ---
256
207
 
257
- ## Quick reference card
208
+ ## Quick reference
258
209
 
259
210
  ```bash
260
211
  # Discovery
261
- apx session find "<text>" # find by title across engines (start here)
262
- apx session find "<text>" --deep # also search transcript content
263
- apx sessions list # all engines, all projects
264
- apx sessions list --project <name> # all engines, one project
265
- apx sessions list --engine <id> --dir <path> # one engine, one dir
212
+ apx session find "<text>" # start here
213
+ apx session find "<text>" --deep
214
+ apx sessions list
215
+ apx sessions list --project <name>
216
+ apx sessions list --engine <id> --dir <path>
266
217
 
267
218
  # Understand
268
- apx session summary <id> # LLM summary of any session
269
- apx session ask <id> "<question>" # Q&A over the transcript (map-reduced)
219
+ apx session summary <id>
220
+ apx session ask <id> "<question>"
270
221
 
271
222
  # Read
272
- apx session get <id> # local APC session metadata
273
- apx session get <id> --engine <id> --full # any engine, full transcript
274
- apx session get <id> --any --tail 32k # any engine, last 32 KB
223
+ apx session get <id> # local APC metadata
224
+ apx session get <id> --engine <id> --full
225
+ apx session get <id> --any --tail 32k
275
226
 
276
227
  # Resume / continue
277
- apx session resume <id> # auto-detect engine, show metadata
278
- apx session resume <id> --summary # add super-agent summary
279
- apx session resume <id> --continue # spawn native CLI to keep working
280
- apx session resume <id> --into apx:<slug> # seed a new APX session with the summary
228
+ apx session resume <id>
229
+ apx session resume <id> --summary
230
+ apx session resume <id> --continue
231
+ apx session resume <id> --into apx:<slug>
281
232
  ```