@agentprojectcontext/apx 1.33.1 → 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 (208) hide show
  1. package/package.json +1 -1
  2. package/skills/apx/SKILL.md +49 -61
  3. package/src/core/agent/a2a/reply.js +48 -0
  4. package/src/core/agent/build-agent-system.js +136 -59
  5. package/src/core/agent/channels/voice-context.js +98 -0
  6. package/src/core/agent/memory.js +2 -1
  7. package/src/core/agent/prompt-builder.js +178 -124
  8. package/src/core/agent/prompts/channels/code.md +12 -10
  9. package/src/core/agent/prompts/channels/desktop.md +5 -32
  10. package/src/core/agent/prompts/channels/telegram.md +4 -15
  11. package/src/core/agent/prompts/channels/web_code.md +11 -11
  12. package/src/core/agent/prompts/core/agent-base.md +24 -0
  13. package/src/core/agent/prompts/core/project-agent.md +11 -0
  14. package/src/core/agent/prompts/core/super-agent.md +21 -0
  15. package/src/core/agent/prompts/discipline/action.md +10 -0
  16. package/src/core/agent/prompts/discipline/single-segment.md +6 -0
  17. package/src/core/agent/prompts/discipline/two-segment.md +11 -0
  18. package/src/core/agent/prompts/modes/code-build.md +1 -0
  19. package/src/core/agent/prompts/modes/code-plan.md +1 -0
  20. package/src/core/agent/prompts/modes/index.js +28 -0
  21. package/src/core/agent/self-memory.js +43 -1
  22. package/src/core/agent/skills/index-store.js +307 -0
  23. package/src/core/agent/skills/index.js +15 -1
  24. package/src/core/agent/skills/inspector.js +317 -0
  25. package/src/core/agent/skills/loader.js +22 -18
  26. package/src/core/agent/stream/turn-accumulator.js +73 -0
  27. package/src/core/agent/suggestions.js +37 -0
  28. package/src/core/agent/super-agent.js +7 -1
  29. package/src/core/agent/tools/handlers/_git.js +50 -0
  30. package/src/core/agent/tools/handlers/add-project.js +5 -2
  31. package/src/core/agent/tools/handlers/call-runtime.js +3 -2
  32. package/src/core/agent/tools/handlers/git-diff.js +44 -0
  33. package/src/core/agent/tools/handlers/git-log.js +38 -0
  34. package/src/core/agent/tools/handlers/git-show.js +34 -0
  35. package/src/core/agent/tools/handlers/git-status.js +61 -0
  36. package/src/core/agent/tools/handlers/transcribe-audio.js +1 -1
  37. package/src/core/agent/tools/helpers.js +2 -2
  38. package/src/core/agent/tools/names.js +169 -0
  39. package/src/core/agent/tools/registry-bridge.js +6 -14
  40. package/src/core/agent/tools/registry.js +103 -69
  41. package/src/core/apc/context-copy.js +27 -0
  42. package/src/core/apc/notes.js +19 -0
  43. package/src/core/apc/parser.js +12 -5
  44. package/src/core/apc/paths.js +87 -0
  45. package/src/core/apc/scaffold.js +82 -76
  46. package/src/core/apc/skill-sync.js +10 -0
  47. package/src/{host/daemon/plugins → core/channels}/telegram/dispatch.js +38 -16
  48. package/src/core/config/index.js +24 -2
  49. package/src/core/config/redact.js +95 -0
  50. package/src/core/constants/channels.js +2 -0
  51. package/src/core/constants/code-modes.js +10 -0
  52. package/src/core/constants/index.js +1 -0
  53. package/src/core/deck/manifest.js +186 -0
  54. package/src/core/engines/catalog.js +83 -0
  55. package/src/core/{tools → http-tools}/browser.js +0 -1
  56. package/src/core/{tools → http-tools}/fetch.js +0 -1
  57. package/src/core/{tools → http-tools}/glob.js +0 -1
  58. package/src/core/{tools → http-tools}/grep.js +0 -1
  59. package/src/core/{tools → http-tools}/registry.js +0 -1
  60. package/src/core/{tools → http-tools}/search.js +0 -1
  61. package/src/core/i18n/en.js +9 -0
  62. package/src/core/i18n/es.js +12 -0
  63. package/src/core/i18n/index.js +54 -0
  64. package/src/core/i18n/pt.js +9 -0
  65. package/src/core/identity/telegram.js +2 -1
  66. package/src/core/mcp/runner.js +272 -14
  67. package/src/core/mcp/sources.js +3 -2
  68. package/src/core/routines/index.js +16 -0
  69. package/src/{host/daemon/routines.js → core/routines/runner.js} +36 -103
  70. package/src/core/runtime-skills/apc-context/SKILL.md +159 -0
  71. package/src/core/runtime-skills/apx/SKILL.md +83 -0
  72. package/src/core/runtime-skills/apx-agency-agents/SKILL.md +125 -0
  73. package/src/core/runtime-skills/apx-agent/SKILL.md +97 -0
  74. package/src/core/runtime-skills/apx-mcp/SKILL.md +111 -0
  75. package/src/core/runtime-skills/apx-mcp-builder/SKILL.md +169 -0
  76. package/{skills → src/core/runtime-skills}/apx-project/SKILL.md +20 -29
  77. package/src/core/runtime-skills/apx-routine/SKILL.md +127 -0
  78. package/src/core/runtime-skills/apx-runtime/SKILL.md +99 -0
  79. package/src/core/runtime-skills/apx-sessions/SKILL.md +232 -0
  80. package/src/core/runtime-skills/apx-skill-builder/SKILL.md +129 -0
  81. package/{skills → src/core/runtime-skills}/apx-task/SKILL.md +18 -21
  82. package/src/core/runtime-skills/apx-telegram/SKILL.md +120 -0
  83. package/src/core/runtime-skills/apx-voice/SKILL.md +117 -0
  84. package/src/core/runtime-skills/{claude-code.md → claude-code/SKILL.md} +1 -0
  85. package/src/core/runtime-skills/{codex-cli.md → codex-cli/SKILL.md} +1 -0
  86. package/src/core/runtime-skills/{opencode-cli.md → opencode-cli/SKILL.md} +1 -0
  87. package/src/core/runtime-skills/{openrouter.md → openrouter/SKILL.md} +1 -0
  88. package/src/{host/daemon/env-detect.js → core/runtimes/detect.js} +1 -1
  89. package/src/core/stores/code-sessions.js +50 -2
  90. package/src/core/stores/routine-memory.js +1 -1
  91. package/src/core/stores/sessions-search.js +121 -0
  92. package/src/core/stores/sessions.js +38 -0
  93. package/src/core/vars/index.js +14 -0
  94. package/src/core/vars/interpolate.js +86 -0
  95. package/src/core/vars/sources.js +151 -0
  96. package/src/core/voice/audio-decode.js +38 -0
  97. package/src/core/voice/transcription.js +225 -0
  98. package/src/host/daemon/api/admin-config.js +5 -82
  99. package/src/host/daemon/api/agents.js +5 -5
  100. package/src/host/daemon/api/code.js +17 -169
  101. package/src/host/daemon/api/config.js +3 -4
  102. package/src/host/daemon/api/conversations.js +8 -29
  103. package/src/host/daemon/api/deck.js +37 -404
  104. package/src/host/daemon/api/engines.js +1 -80
  105. package/src/host/daemon/api/exec.js +1 -1
  106. package/src/host/daemon/api/mcps.js +32 -0
  107. package/src/host/daemon/api/routines.js +1 -1
  108. package/src/host/daemon/api/runtimes.js +4 -3
  109. package/src/host/daemon/api/sessions-search.js +24 -140
  110. package/src/host/daemon/api/sessions.js +12 -30
  111. package/src/host/daemon/api/shared.js +2 -1
  112. package/src/host/daemon/api/skills.js +140 -6
  113. package/src/host/daemon/api/super-agent.js +56 -1
  114. package/src/host/daemon/api/telegram.js +1 -11
  115. package/src/host/daemon/api/tools.js +6 -6
  116. package/src/host/daemon/api/transcribe.js +2 -2
  117. package/src/host/daemon/api/vars.js +137 -0
  118. package/src/host/daemon/api/voice.js +13 -290
  119. package/src/host/daemon/api.js +2 -0
  120. package/src/host/daemon/db.js +6 -6
  121. package/src/host/daemon/deck-exec.js +148 -0
  122. package/src/host/daemon/index.js +20 -3
  123. package/src/host/daemon/plugins/telegram/index.js +9 -9
  124. package/src/host/daemon/routines-scheduler.js +64 -0
  125. package/src/host/daemon/smoke.js +3 -2
  126. package/src/host/daemon/whisper-server.js +225 -0
  127. package/src/interfaces/cli/branding.js +53 -0
  128. package/src/interfaces/cli/commands/agent.js +3 -2
  129. package/src/interfaces/cli/commands/command.js +2 -3
  130. package/src/interfaces/cli/commands/messages.js +6 -2
  131. package/src/interfaces/cli/commands/pair.js +5 -4
  132. package/src/interfaces/cli/commands/search.js +1 -1
  133. package/src/interfaces/cli/commands/sessions.js +3 -2
  134. package/src/interfaces/cli/commands/skills.js +290 -55
  135. package/src/interfaces/cli/index.js +84 -2
  136. package/src/interfaces/web/dist/assets/index-C0fm31dY.js +618 -0
  137. package/src/interfaces/web/dist/assets/index-C0fm31dY.js.map +1 -0
  138. package/src/interfaces/web/dist/assets/index-UcAqlBO6.css +1 -0
  139. package/src/interfaces/web/dist/index.html +2 -2
  140. package/src/interfaces/web/package-lock.json +182 -182
  141. package/src/interfaces/web/src/components/ModelCombobox.tsx +2 -1
  142. package/src/interfaces/web/src/components/TelegramChannelDialog.tsx +1 -1
  143. package/src/interfaces/web/src/components/chat/AskAnswersCard.tsx +76 -0
  144. package/src/interfaces/web/src/components/chat/MessageBubble.tsx +37 -4
  145. package/src/interfaces/web/src/components/chat/MessageList.tsx +23 -1
  146. package/src/interfaces/web/src/components/chat/ModelPicker.tsx +3 -1
  147. package/src/interfaces/web/src/components/code/CodeArtifactsTab.tsx +4 -4
  148. package/src/interfaces/web/src/components/code/CodeChangesTab.tsx +1 -1
  149. package/src/interfaces/web/src/components/code/CodeFileTree.tsx +3 -2
  150. package/src/interfaces/web/src/components/code/CodeFileViewer.tsx +3 -2
  151. package/src/interfaces/web/src/components/code/CodeTerminal.tsx +3 -2
  152. package/src/interfaces/web/src/components/config/GlobalConfigEditor.tsx +2 -1
  153. package/src/interfaces/web/src/components/deck/WidgetRow.tsx +2 -1
  154. package/src/interfaces/web/src/components/inputs/KeyValueList.tsx +93 -0
  155. package/src/interfaces/web/src/components/inputs/VarTokenInput.tsx +449 -0
  156. package/src/interfaces/web/src/components/settings/DefaultRouterCard.tsx +2 -1
  157. package/src/interfaces/web/src/components/settings/EnginesPanel.tsx +2 -2
  158. package/src/interfaces/web/src/components/settings/MemoryPanel.tsx +73 -4
  159. package/src/interfaces/web/src/components/settings/SkillsInspectorPanel.tsx +222 -0
  160. package/src/interfaces/web/src/components/settings/providers/ProviderCard.tsx +3 -2
  161. package/src/interfaces/web/src/components/settings/providers/ProviderModal.tsx +3 -2
  162. package/src/interfaces/web/src/components/ui/chat-input.tsx +5 -4
  163. package/src/interfaces/web/src/components/ui/sidebar.tsx +3 -2
  164. package/src/interfaces/web/src/components/voice/VoiceProviderModal.tsx +2 -1
  165. package/src/interfaces/web/src/constants/index.ts +1 -1
  166. package/src/interfaces/web/src/hooks/useChat.ts +19 -0
  167. package/src/interfaces/web/src/i18n/en.ts +175 -7
  168. package/src/interfaces/web/src/i18n/es.ts +180 -15
  169. package/src/interfaces/web/src/lib/api/mcps.ts +25 -0
  170. package/src/interfaces/web/src/lib/api/skills.ts +70 -0
  171. package/src/interfaces/web/src/lib/api/vars.ts +38 -0
  172. package/src/interfaces/web/src/lib/api.ts +1 -0
  173. package/src/interfaces/web/src/screens/ProjectScreen.tsx +8 -31
  174. package/src/interfaces/web/src/screens/SettingsScreen.tsx +6 -2
  175. package/src/interfaces/web/src/screens/modules/CodeScreen.tsx +1 -1
  176. package/src/interfaces/web/src/screens/modules/DeckScreen.tsx +4 -3
  177. package/src/interfaces/web/src/screens/modules/DesktopScreen.tsx +7 -6
  178. package/src/interfaces/web/src/screens/modules/VoiceScreen.tsx +4 -3
  179. package/src/interfaces/web/src/screens/project/AgentDetailScreen.tsx +1 -1
  180. package/src/interfaces/web/src/screens/project/ConfigTab.tsx +132 -1
  181. package/src/interfaces/web/src/screens/project/McpsTab.tsx +549 -104
  182. package/src/interfaces/web/src/screens/project/RoutinesTab.tsx +1 -1
  183. package/src/interfaces/web/src/screens/project/VarsTab.tsx +300 -0
  184. package/src/interfaces/web/src/types/daemon.ts +15 -0
  185. package/skills/apx-agency-agents/SKILL.md +0 -141
  186. package/skills/apx-agent/SKILL.md +0 -100
  187. package/skills/apx-mcp-builder/SKILL.md +0 -183
  188. package/skills/apx-routine/SKILL.md +0 -140
  189. package/skills/apx-runtime/SKILL.md +0 -117
  190. package/skills/apx-sessions/SKILL.md +0 -281
  191. package/skills/apx-skill-builder/SKILL.md +0 -153
  192. package/skills/apx-telegram/SKILL.md +0 -131
  193. package/skills/apx-voice/SKILL.md +0 -137
  194. package/src/core/agent/prompts/action-discipline.md +0 -24
  195. package/src/core/agent/prompts/super-agent-base.md +0 -42
  196. package/src/host/daemon/transcription.js +0 -538
  197. package/src/host/daemon/whisper-transcribe.py +0 -73
  198. package/src/interfaces/web/dist/assets/index-Aaiw8BZN.css +0 -1
  199. package/src/interfaces/web/dist/assets/index-DPqtjDjh.js +0 -602
  200. package/src/interfaces/web/dist/assets/index-DPqtjDjh.js.map +0 -1
  201. /package/src/{host/daemon → core/apc}/projects-helpers.js +0 -0
  202. /package/src/{host/daemon/plugins → core/channels}/telegram/ask.js +0 -0
  203. /package/src/{host/daemon/plugins → core/channels}/telegram/helpers.js +0 -0
  204. /package/src/{host/daemon/plugins → core/channels}/telegram/media.js +0 -0
  205. /package/src/core/{tools → http-tools}/index.js +0 -0
  206. /package/src/{host/daemon/compact.js → core/stores/conversations-compactor.js} +0 -0
  207. /package/src/{host/daemon → core/stores}/conversations.js +0 -0
  208. /package/src/{host/daemon → core/util}/thinking.js +0 -0
@@ -1,281 +0,0 @@
1
- ---
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)."
4
- ---
5
-
6
- # APX Sessions — cross-engine resume, summary, and continuation
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**.
9
-
10
- Engine storage locations APX scans:
11
-
12
- | Engine | Where APX looks |
13
- |-----------|-----------------------------------------------------------|
14
- | apx | `~/.apx/projects/<apx_id>/agents/<slug>/sessions/*.md` |
15
- | claude | `~/.claude/projects/<encoded-cwd>/<id>.jsonl` |
16
- | codex | `~/.codex/sessions/YYYY/MM/DD/rollout-*.jsonl` |
17
- | antigravity | detected only — listing not implemented yet |
18
-
19
- Engines not installed on the machine are silently skipped. Detected-but-empty engines show `(sin nada)`.
20
-
21
- ---
22
-
23
- ## The discovery flow (read this first)
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:
26
-
27
- ```bash
28
- # 1. Turn a remembered title into an id (cross-engine, newest first)
29
- apx session find "improve web UI"
30
-
31
- # 2. Get the gist of that session
32
- apx session summary <id>
33
-
34
- # 3. Ask something specific about it
35
- apx session ask <id> "what sidebar changes were left pending?"
36
- ```
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.**
39
-
40
- ---
41
-
42
- ## Finding a session by title or content (`apx session find`)
43
-
44
- ```bash
45
- apx session find "<text>" # match titles across every engine
46
- apx session find "<text>" --deep # also search inside transcript content
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
50
- ```
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.
55
-
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.
57
-
58
- ---
59
-
60
- ## Summarizing a session (`apx session summary`)
61
-
62
- ```bash
63
- apx session summary <id> # auto-detect engine, print an LLM summary
64
- apx session summary <id> --engine claude # skip auto-detect
65
- 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
-
72
- ## Asking questions about a session (`apx session ask`)
73
-
74
- ```bash
75
- apx session ask <id> "what did we decide about the sidebar?"
76
- apx session ask <id> "what files were changed?" --max-chunks 30
77
- ```
78
-
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:
82
-
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.
87
-
88
- ---
89
-
90
- ## Listing sessions
91
-
92
- ```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
107
- ```
108
-
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.
112
-
113
- ---
114
-
115
- ## Resuming a session by id (the headline command)
116
-
117
- ```bash
118
- apx session resume <id>
119
- ```
120
-
121
- What it does, in order:
122
-
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:
129
-
130
- | Flag | Effect |
131
- |------|--------|
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). |
139
-
140
- ### Common recipes
141
-
142
- ```bash
143
- # "I have a Codex session id, give me a summary in apx"
144
- apx session resume 019abc... --summary
145
-
146
- # "I want to keep working on that Codex thread, but in APX with the reviewer agent"
147
- apx session resume 019abc... --summary --into apx:reviewer
148
-
149
- # "Just dump the full transcript so I can grep it"
150
- apx session resume 019abc... --full | rg "TODO"
151
-
152
- # "Re-open in the native CLI, interactively"
153
- apx session resume 019abc... --continue
154
-
155
- # "I know it's a Claude session, skip auto-detect"
156
- apx session resume 2e3c840b-... --engine claude --tail 16k
157
- ```
158
-
159
- ---
160
-
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
166
-
167
- ```bash
168
- apx session get <id> # metadata of the local APC session
169
- apx session get <id> --body # full markdown body
170
- apx session get <id> --json # machine-readable metadata
171
- ```
172
-
173
- ### Engine mode — read any engine's session by id
174
-
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
180
- ```
181
-
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.
183
-
184
- ```bash
185
- # Pull a Codex session into context for the current Claude session
186
- apx session get 019abc... --engine codex --full > /tmp/prev.jsonl
187
- ```
188
-
189
- ---
190
-
191
- ## Daemon vs. no daemon
192
-
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 |
204
-
205
- If the daemon is down, `apx` auto-starts it when needed.
206
-
207
- ---
208
-
209
- ## Native APX session commands (legacy / still useful)
210
-
211
- These manage APX-native sessions (the `.md` files in `~/.apx/projects/.../sessions/`). They do **not** see Claude/Codex sessions.
212
-
213
- ```bash
214
- 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
217
- apx session update <id> --status "in progress"
218
- 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
222
- ```
223
-
224
- These live next to the new cross-engine commands above; they don't replace each other.
225
-
226
- ---
227
-
228
- ## Disambiguating collisions
229
-
230
- If two engines happen to use the same id string for different sessions:
231
-
232
- ```
233
- $ apx session resume abc123
234
- ⚠️ session id "abc123" exists in multiple engines:
235
- - 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)
237
- → re-run with --engine <id> to pick one (apx | claude | codex)
238
- ```
239
-
240
- Pick one with `--engine claude` or `--engine codex` and run again.
241
-
242
- ---
243
-
244
- ## Tips for callers (LLMs)
245
-
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.
254
-
255
- ---
256
-
257
- ## Quick reference card
258
-
259
- ```bash
260
- # 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
266
-
267
- # Understand
268
- apx session summary <id> # LLM summary of any session
269
- apx session ask <id> "<question>" # Q&A over the transcript (map-reduced)
270
-
271
- # 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
275
-
276
- # 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
281
- ```
@@ -1,153 +0,0 @@
1
- ---
2
- name: apx-skill-builder
3
- scope: internal
4
- description: How to author a new APX skill — file location, frontmatter (name, description, scope), body style, and how the super-agent loads it on demand. Load when creating or adding a skill to APX.
5
- ---
6
-
7
- # apx-skill-builder
8
-
9
- A **skill** in APX is a Markdown file the super-agent loads on demand to learn how to do something. Inspired by Anthropic's skill-creator pattern, simplified for APX's daemon-served model.
10
-
11
- ## When to make a skill (vs. inlining in the system prompt)
12
-
13
- - **Make a skill** when the topic is bounded (a tool, a config domain, a recurring workflow), the instructions need >50 tokens to be safe, and not every conversation needs them.
14
- - **Don't** make a skill for one-off explanations, casual chat, or stuff that fits in 2-3 lines in the base prompt.
15
-
16
- ## File location
17
-
18
- Three places APX scans, in priority order:
19
-
20
- 1. `<repo>/.apc/skills/<slug>/SKILL.md` — project-scoped (only this project's super-agent sees it).
21
- 2. `~/.apx/skills/<slug>/SKILL.md` — user-global (all projects).
22
- 3. `<repo>/skills/<slug>/SKILL.md` in the APX source — bundled (ships with the package).
23
-
24
- Either layout works:
25
- - `<slug>/SKILL.md` (dir-style, preferred — lets you ship `references/`, `assets/`, etc.)
26
- - `<slug>.md` (flat-style, fine for short ones)
27
-
28
- ## Frontmatter
29
-
30
- The file MUST open with YAML frontmatter:
31
-
32
- ```yaml
33
- ---
34
- name: my-skill
35
- description: One-sentence trigger for the super-agent. Include the user-phrases that should cause it to load. Keep it short — appears in skill listings.
36
- scope: public # public (pushed to IDE skill dirs by default) | internal (repo/dev-only) | optional
37
- ---
38
- ```
39
-
40
- `description` is what the model sees when deciding whether to call `load_skill`. Write it as the *trigger condition*, not a summary of the body.
41
-
42
- `scope` controls distribution: `public` skills are installed globally by `apx skills sync` / `--global`; `internal` ones stay in the APX repo (dev guides like this one); `optional` ones are available but not pushed by default. Omit it and the skill is treated as public.
43
-
44
- **Good**: `"How to register an MCP server. Load BEFORE running 'apx mcp add' — three scopes, gotchas with stdio commands, secrets handling."`
45
-
46
- **Bad**: `"This skill describes APX's MCP system."` (no trigger; the model won't know when it matters).
47
-
48
- ## Body style
49
-
50
- Opinionated, concrete, anti-example-driven. Every other APX skill in `skills/apx-*` follows the same shape — read one before writing yours:
51
-
52
- 1. **One-paragraph "what this is"** (no preamble, no marketing).
53
- 2. **Concrete CLI calls** the user runs, with the most common case first.
54
- 3. **Schema / shape** if the topic involves files or config.
55
- 4. **Anti-examples** — at least one "DON'T do this" with the reason. This is what stops the model from inventing flags.
56
- 5. **Open questions / footnotes** if the surface is incomplete.
57
-
58
- Length budget: 80-200 lines. If it's longer, split into sub-skills or move scripts into `<slug>/scripts/`.
59
-
60
- ## How the super-agent loads it
61
-
62
- ```js
63
- // The model emits a tool call:
64
- load_skill({ slug: "my-skill", project_path: "/abs/path/optional" })
65
- ```
66
-
67
- That returns the full body. The agent uses the content in-context for that turn; it doesn't persist.
68
-
69
- The user can list installed skills with:
70
- ```bash
71
- apx skills list # lists this project's .apc/skills/ (cwd-scoped — run from the project root)
72
- apx skills sync # push bundled/public skills to the global skill dir
73
- apx skills status # show what's installed vs available
74
- ```
75
-
76
- ## Workflow: create + register
77
-
78
- ```bash
79
- # 1. Pick scope
80
- # Project-scoped: .apc/skills/<slug>/SKILL.md
81
- # User-global: ~/.apx/skills/<slug>/SKILL.md
82
- # Bundled (in repo): skills/<slug>/SKILL.md
83
-
84
- # 2. Write the file
85
- mkdir -p skills/my-thing
86
- $EDITOR skills/my-thing/SKILL.md
87
-
88
- # 3. The daemon picks it up on next listSkills() — no restart needed unless
89
- # you've changed the scaffold sync. Confirm:
90
- apx skills list | grep my-thing
91
-
92
- # 4. Pre-test with the super-agent (it's the default target — no agent name needed):
93
- apx exec "Load the my-thing skill and summarize it in 3 bullets"
94
- ```
95
-
96
- ## Anti-examples
97
-
98
- ```yaml
99
- ---
100
- # DON'T omit description — the model can't trigger on the slug alone.
101
- name: vague-stuff
102
- ---
103
-
104
- # DON'T pile general advice into the body. Pick ONE topic per skill.
105
- # A skill that says "lots of useful tips about everything" is dead weight
106
- # in the model's mental cache.
107
-
108
- # DON'T duplicate apx --help. Skills explain WHEN and WHY, not just WHAT.
109
- # `apx mcp add --help` already lists flags. The skill teaches the decision
110
- # tree ("when shared vs runtime", "what to do if it fails").
111
-
112
- # DON'T leave TODOs in production skills. If a section is incomplete,
113
- # delete it from the skill and add it to spec/backlog/.
114
- ```
115
-
116
- ## Skill scaffolding (optional `<slug>/`)
117
-
118
- ```
119
- skills/my-thing/
120
- ├── SKILL.md ← the body (always)
121
- ├── references/ ← markdown files the skill cites
122
- │ └── examples.md
123
- ├── assets/ ← images, JSON schemas, sample inputs
124
- └── scripts/ ← shell / node scripts the skill may shell out to
125
- └── verify.sh
126
- ```
127
-
128
- The super-agent only sees `SKILL.md` automatically. `references/` and `scripts/` are addressable via paths from inside the body (e.g. "see references/examples.md"). Use this for skills with lots of supporting material.
129
-
130
- ## Existing APX skills — copy the style
131
-
132
- - `skills/apx-routine/SKILL.md` — routine kind selection + pipeline.
133
- - `skills/apx-mcp/SKILL.md` — three-scope MCP configuration.
134
- - `skills/apx-task/SKILL.md` — TODO management.
135
- - `skills/apx-telegram/SKILL.md` — channel ↔ project ↔ agent wiring.
136
- - `skills/apx-runtime/SKILL.md` — external CLIs (claude-code, codex, …).
137
- - `skills/apx-sessions/SKILL.md` — cross-engine list, resume, summary, `--into apx`.
138
- - `skills/apx-voice/SKILL.md` — TTS engine setup.
139
- - `skills/apx-agent/SKILL.md` — per-project agents.
140
- - `skills/apx-project/SKILL.md` — project registration + typology.
141
-
142
- Pick the closest topic, mimic the structure, then write yours.
143
-
144
- ## Maintainer contract
145
-
146
- `AGENTS.md` rule 6 (regenerated by `apx agent add/import`) requires skills to move in lockstep with feature changes. When you add or change APX behavior, update or add the skill in the same PR — especially under `skills/apx-*`.
147
-
148
- ## Don't
149
-
150
- - Don't ship a skill without the frontmatter `description` — the loader can read the file but the trigger is silent.
151
- - Don't put secrets inside skills. They're meant to be read aloud by an LLM.
152
- - Don't reference filesystem paths that only exist on your machine — use `<repo>` or `~/.apx` placeholders.
153
- - Don't write skills in third person. The reader is the model. Write to it.
@@ -1,131 +0,0 @@
1
- ---
2
- name: apx-telegram
3
- description: How APX talks to Telegram — channels, project pinning, master agents, media. Load BEFORE configuring a new bot or routing — multi-channel is the only mode now, the root bot_token/chat_id fields are legacy.
4
- ---
5
-
6
- # apx-telegram
7
-
8
- APX runs a Telegram plugin that polls `getUpdates` and routes messages. Config lives in `~/.apx/config.json → telegram`. The relationship to remember: **each channel can be pinned to a project and to a master agent**. Messages arriving on a pinned channel automatically run inside that project, optionally handled by a specific agent instead of the default APX super-agent.
9
-
10
- ## The shape
11
-
12
- ```json
13
- {
14
- "telegram": {
15
- "enabled": true,
16
- "poll_interval_ms": 1500,
17
- "route_to_agent": "", // global default master agent (empty = super-agent)
18
- "respond_with_engine": true, // global default for "should the LLM auto-reply?"
19
- "channels": [
20
- {
21
- "name": "default",
22
- "bot_token": "<from BotFather>",
23
- "chat_id": "<your numeric chat id>",
24
- "project": "iacrmar", // optional: pin this channel to that project
25
- "route_to_agent": "reviewer", // optional: this agent handles messages on this channel
26
- "respond_with_engine": true, // optional: override the global default
27
- "owner_user_id": "123456789" // optional: per-channel owner (set via `apx telegram owner`)
28
- }
29
- ],
30
- "contacts": [], // global roster (user_id → role); see `apx telegram contacts`
31
- "roles": {} // role → allowed tools; see `apx telegram roles`
32
- }
33
- }
34
- ```
35
-
36
- The old `telegram.bot_token` / `telegram.chat_id` at the root are **legacy**. Don't write to them. If a config still has them and `channels[]` is empty, APX migrates them into `channels[0]` automatically with a warning on first read.
37
-
38
- ## Concrete CLI calls
39
-
40
- ```bash
41
- # Print the config template to get started
42
- apx telegram setup # note: still emits root bot_token/chat_id — prefer channels[] below
43
-
44
- # Channels CRUD
45
- apx telegram channel add # interactive wizard
46
- apx telegram channel add clientes --bot-token <T> --chat-id <C> --project iacrmar --agent reviewer
47
- apx telegram channel list # alias: ls
48
- apx telegram channel show clientes # alias: get
49
- apx telegram channel set clientes --project iacrmar
50
- apx telegram channel set clientes --agent reviewer
51
- apx telegram channel set clientes --respond-engine false
52
- apx telegram channel unset clientes --project --agent
53
- apx telegram channel remove clientes # alias: rm
54
- apx telegram owner clientes <user_id> # set the per-channel owner
55
-
56
- # Contacts roster + roles (global; gate which tools a sender may trigger)
57
- apx telegram contacts # list the global roster
58
- apx telegram contacts rm <user_id>
59
- apx telegram role <user_id> <role> # assign a role to a contact
60
- apx telegram roles # list role → tools mappings
61
- apx telegram roles set <name> --tools a,b,c # or --tools '*' for all
62
- apx telegram roles rm <name>
63
-
64
- # Polling lifecycle (rarely needed — autostart with daemon)
65
- apx telegram start
66
- apx telegram stop
67
- apx telegram status
68
-
69
- # Sending (defaults to first configured channel; use --chat for explicit chat id)
70
- apx telegram send "text"
71
- apx telegram send "text" --chat 123456789
72
- apx telegram send "text" --interrupt # bypass the pending-agent queue (also: --force)
73
-
74
- # Media (daemon HTTP API — no dedicated CLI subcommand yet)
75
- curl -X POST http://127.0.0.1:7430/telegram/send_photo \
76
- -H "Authorization: Bearer $(cat ~/.apx/daemon.token)" \
77
- -H "Content-Type: application/json" \
78
- -d '{"photo":"/abs/path.png","caption":"...","channel":"clientes"}'
79
- curl -X POST http://127.0.0.1:7430/telegram/send_voice \
80
- -H "Authorization: Bearer $(cat ~/.apx/daemon.token)" \
81
- -H "Content-Type: application/json" \
82
- -d '{"audio":"/abs/path.ogg","duration":5,"channel":"default"}'
83
- ```
84
-
85
- Every `channel` CRUD write triggers `POST /admin/reload` so the polling plugin picks up the new wiring without a daemon restart.
86
-
87
- ## What "pin to project" actually does
88
-
89
- When a message arrives on a channel with `project: "iacrmar"`:
90
- 1. The super-agent invocation gets `channelMeta.projectId = <iacrmar's id>`.
91
- 2. The system prompt resolves project-scoped data (agents, MCPs, memory) for that turn.
92
- 3. The agent can call tools (`list_agents`, `list_tasks`, `create_task`, …) and they default to that project — the user doesn't have to say "in iacrmar" every message.
93
-
94
- ## What "master agent" actually does
95
-
96
- With `route_to_agent: "reviewer"` on the channel, incoming messages go through `/projects/:pid/agents/reviewer/chat` instead of `/super-agent/chat`. The agent's `AGENT.md` system prompt + memory is used. No tools (project agents are `exec_agent`-shaped — text in, text out). Single LLM call.
97
-
98
- Use this when you want a Telegram channel to feel like talking to a specific persona (a reviewer, a sales agent, a customer support agent) instead of the general APX assistant.
99
-
100
- If `route_to_agent` is empty: the channel goes through the super-agent (default APX mode).
101
-
102
- ## Anti-examples
103
-
104
- ```bash
105
- # DON'T write to telegram.bot_token / telegram.chat_id directly.
106
- apx config set telegram.bot_token "<T>"
107
- # ↑ Those fields are legacy. Use channels[] via `apx telegram channel`.
108
-
109
- # DON'T add the same project to two channels expecting routing magic.
110
- # A channel pins messages TO a project, not the other way around. The same
111
- # project can be addressed from multiple channels — fine. But that doesn't
112
- # unify the conversation contexts; each channel has its own message log.
113
-
114
- # DON'T set route_to_agent to a non-existent slug.
115
- apx telegram channel set default --agent nope
116
- # ↑ Will silently route to a 404 — the channel's messages won't get a reply
117
- # until you fix it. `apx telegram channel show <name>` to verify.
118
- ```
119
-
120
- ## Multiple bots, one APX
121
-
122
- `channels[]` supports multiple `{bot_token, chat_id}` pairs. Each can be a different bot OR the same bot with different chats. The plugin polls each in parallel. Project / agent pinning is per-channel.
123
-
124
- This is how you wire "I have a client A bot, a personal bot, and a notifications-only bot": three channels, three (possibly) different bots, distinct project pins.
125
-
126
- ## Don't
127
-
128
- - Don't write to `telegram.bot_token` / `telegram.chat_id` at root.
129
- - Don't expect `apx telegram send` to target a project — it sends to a *chat id* (or the channel's configured `chat_id`). Use `apx telegram channel show <name>` to verify wiring.
130
- - Don't set `respond_with_engine: false` and then wonder why messages aren't getting replies. That flag turns auto-reply off for the channel.
131
- - Don't forget that the Telegram plugin only fires on chat IDs you've listed. Messages from other chats are ignored.