@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
@@ -0,0 +1,232 @@
1
+ ---
2
+ name: apx-sessions
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
+ ---
5
+
6
+ # APX Sessions — cross-engine resume, summary, continuation
7
+
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
+
10
+ Storage locations APX scans:
11
+
12
+ | Engine | Where |
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
+ Uninstalled engines are skipped silently. Detected-but-empty engines print `(sin nada)`.
20
+
21
+ ---
22
+
23
+ ## Discovery flow (read first)
24
+
25
+ You start with a vague title, not an id. Do **not** `apx sessions list | grep`. The flow:
26
+
27
+ ```bash
28
+ # 1. Title → id (cross-engine, newest first)
29
+ apx session find "improve web UI"
30
+
31
+ # 2. Gist
32
+ apx session summary <id>
33
+
34
+ # 3. Specifics
35
+ apx session ask <id> "what sidebar changes were left pending?"
36
+ ```
37
+
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
+
40
+ ---
41
+
42
+ ## Finding sessions (`apx session find`)
43
+
44
+ ```bash
45
+ apx session find "<text>" # titles across every engine
46
+ apx session find "<text>" --deep # also greps transcript content
47
+ apx session find "<text>" --engine codex # restrict to one engine
48
+ apx session find "<text>" --dir /path/to/repo # scope (reaches unregistered Claude projects)
49
+ apx session find "<text>" --limit 10 --json
50
+ ```
51
+
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.
53
+
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>`.
55
+
56
+ ---
57
+
58
+ ## Summarize / Ask
59
+
60
+ ```bash
61
+ apx session summary <id> # auto-detect, LLM summary
62
+ apx session summary <id> --engine claude
63
+ apx session summary <id> --max-chunks 8 # bound cost on a huge transcript
64
+
65
+ apx session ask <id> "what did we decide about the sidebar?"
66
+ apx session ask <id> "what files were changed?" --max-chunks 30
67
+ ```
68
+
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`**.
70
+
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.
72
+
73
+ ---
74
+
75
+ ## Listing sessions
76
+
77
+ ```bash
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
83
+ ```
84
+
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.
86
+
87
+ ---
88
+
89
+ ## Resuming by id (`apx session resume <id>`)
90
+
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>`.
95
+
96
+ Flags:
97
+
98
+ | Flag | Effect |
99
+ |------|--------|
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. |
107
+
108
+ ### Recipes
109
+
110
+ ```bash
111
+ # Codex id → summary in apx
112
+ apx session resume 019abc... --summary
113
+
114
+ # Continue a Codex thread inside APX with the reviewer agent
115
+ apx session resume 019abc... --summary --into apx:reviewer
116
+
117
+ # Dump full transcript and grep
118
+ apx session resume 019abc... --full | rg "TODO"
119
+
120
+ # Re-open in native CLI
121
+ apx session resume 019abc... --continue
122
+
123
+ # Known Claude session, skip auto-detect
124
+ apx session resume 2e3c840b-... --engine claude --tail 16k
125
+ ```
126
+
127
+ ---
128
+
129
+ ## Reading content (`apx session get`)
130
+
131
+ ```bash
132
+ # Default: local APC project sessions
133
+ apx session get <id> # metadata
134
+ apx session get <id> --body # full markdown body
135
+ apx session get <id> --json # machine-readable metadata
136
+
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
142
+ ```
143
+
144
+ **Use this to pull a Codex/Claude session into your current context.** Pipe `--full` into a file or prompt:
145
+
146
+ ```bash
147
+ apx session get 019abc... --engine codex --full > /tmp/prev.jsonl
148
+ ```
149
+
150
+ ---
151
+
152
+ ## Daemon requirements
153
+
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 |
159
+
160
+ If the daemon is down, `apx` auto-starts it when needed.
161
+
162
+ ---
163
+
164
+ ## Native APX session commands (legacy, still useful)
165
+
166
+ Manage APX-native sessions (`.md` files in `~/.apx/projects/.../sessions/`). They do **not** see Claude/Codex sessions.
167
+
168
+ ```bash
169
+ apx session new <slug> --title "Investigate bug X"
170
+ apx session list # all agents in current APC project
171
+ apx session list <slug>
172
+ apx session update <id> --status "in progress"
173
+ apx session close <id> --result "Fixed in PR #42"
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
177
+ ```
178
+
179
+ ---
180
+
181
+ ## Disambiguating collisions
182
+
183
+ ```
184
+ $ apx session resume abc123
185
+ ⚠️ session id "abc123" exists in multiple engines:
186
+ - claude /Users/.../-Volumes-work-repo/abc123.jsonl (cwd: /Volumes/work/repo)
187
+ - codex /Users/.../sessions/2026/05/27/rollout-...-abc123.jsonl (cwd: /Volumes/work/repo)
188
+ → re-run with --engine <id> to pick one (apx | claude | codex)
189
+ ```
190
+
191
+ Pick one with `--engine claude` or `--engine codex`.
192
+
193
+ ---
194
+
195
+ ## Tips for callers (LLMs)
196
+
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.
205
+
206
+ ---
207
+
208
+ ## Quick reference
209
+
210
+ ```bash
211
+ # Discovery
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>
217
+
218
+ # Understand
219
+ apx session summary <id>
220
+ apx session ask <id> "<question>"
221
+
222
+ # Read
223
+ apx session get <id> # local APC metadata
224
+ apx session get <id> --engine <id> --full
225
+ apx session get <id> --any --tail 32k
226
+
227
+ # Resume / continue
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>
232
+ ```
@@ -0,0 +1,129 @@
1
+ ---
2
+ name: apx-skill-builder
3
+ scope: internal
4
+ description: Author a new APX skill — file location, frontmatter (name, description, scope), body style, on-demand loader. Load when creating or adding a skill to APX.
5
+ ---
6
+
7
+ # apx-skill-builder
8
+
9
+ A **skill** is a Markdown file the super-agent loads on demand. Inspired by Anthropic's skill-creator, simplified for APX's daemon-served model.
10
+
11
+ ## When to make a skill
12
+
13
+ - **Yes**: topic is bounded (a tool, a config domain, a recurring workflow), instructions need >50 tokens to be safe, not every conversation needs them.
14
+ - **No**: one-off explanations, casual chat, anything fitting in 2-3 lines of the base prompt.
15
+
16
+ ## File location
17
+
18
+ Scanned in priority order:
19
+
20
+ 1. `<repo>/.apc/skills/<slug>/SKILL.md` — project-scoped.
21
+ 2. `~/.apx/skills/<slug>/SKILL.md` — user-global.
22
+ 3. `<repo>/skills/<slug>/SKILL.md` in the APX source — bundled.
23
+
24
+ Layouts: `<slug>/SKILL.md` (dir-style, preferred — supports `references/`, `assets/`) or `<slug>.md` (flat, fine for short).
25
+
26
+ ## Frontmatter
27
+
28
+ ```yaml
29
+ ---
30
+ name: my-skill
31
+ description: One-sentence trigger for the super-agent. Include user-phrases that should cause it to load. Short — appears in skill listings.
32
+ scope: public # public (synced globally) | internal (repo/dev-only) | optional (not pushed by default)
33
+ ---
34
+ ```
35
+
36
+ `description` is what the model sees when deciding `load_skill`. Write it as the *trigger condition*, not a body summary. Omit `scope` → treated as public.
37
+
38
+ **Good**: `"How to register an MCP server. Load BEFORE running 'apx mcp add' — three scopes, gotchas with stdio commands, secrets handling."`
39
+ **Bad**: `"This skill describes APX's MCP system."` (no trigger).
40
+
41
+ ## Body style
42
+
43
+ Opinionated, concrete, anti-example-driven. Read a sibling `skills/apx-*` before writing yours. Shape:
44
+
45
+ 1. **One-paragraph "what this is"** — no preamble.
46
+ 2. **Concrete CLI calls** — most common first.
47
+ 3. **Schema / shape** if files/config are involved.
48
+ 4. **Anti-examples** — at least one "DON'T" with reason. Stops the model inventing flags.
49
+ 5. **Open questions / footnotes** if the surface is incomplete.
50
+
51
+ Length budget: 80-200 lines. Longer → split or move scripts to `<slug>/scripts/`.
52
+
53
+ ## Loader + commands
54
+
55
+ ```js
56
+ // Model emits:
57
+ load_skill({ slug: "my-skill", project_path: "/abs/path/optional" })
58
+ ```
59
+
60
+ Returns the full body for the current turn; not persisted.
61
+
62
+ ```bash
63
+ apx skills list # this project's .apc/skills/ (run from project root)
64
+ apx skills sync # push bundled/public skills to global skill dir
65
+ apx skills status # what's installed vs available
66
+ ```
67
+
68
+ ## Workflow
69
+
70
+ ```bash
71
+ # 1. Pick scope:
72
+ # .apc/skills/<slug>/SKILL.md (project)
73
+ # ~/.apx/skills/<slug>/SKILL.md (user-global)
74
+ # skills/<slug>/SKILL.md (bundled, in repo)
75
+
76
+ # 2. Write
77
+ mkdir -p skills/my-thing
78
+ $EDITOR skills/my-thing/SKILL.md
79
+
80
+ # 3. Verify (daemon picks up on next listSkills() — no restart)
81
+ apx skills list | grep my-thing
82
+
83
+ # 4. Pre-test with the super-agent (default target)
84
+ apx exec "Load the my-thing skill and summarize it in 3 bullets"
85
+ ```
86
+
87
+ ## Anti-examples
88
+
89
+ ```yaml
90
+ ---
91
+ # DON'T omit description — the model can't trigger on slug alone.
92
+ name: vague-stuff
93
+ ---
94
+
95
+ # DON'T pile general advice. ONE topic per skill. A grab-bag is dead weight.
96
+
97
+ # DON'T duplicate apx --help. Skills explain WHEN and WHY, not WHAT.
98
+ # Teach the decision tree ("shared vs runtime", "what to do if it fails").
99
+
100
+ # DON'T leave TODOs in production skills. Delete incomplete sections;
101
+ # move them to spec/backlog/.
102
+ ```
103
+
104
+ ## Optional scaffolding
105
+
106
+ ```
107
+ skills/my-thing/
108
+ ├── SKILL.md ← always
109
+ ├── references/ ← markdown the skill cites
110
+ ├── assets/ ← images, schemas, sample inputs
111
+ └── scripts/ ← shell/node helpers the skill shells out to
112
+ ```
113
+
114
+ Only `SKILL.md` is auto-loaded. Reference others by relative path from the body ("see references/examples.md").
115
+
116
+ ## Existing skills — mimic the style
117
+
118
+ `skills/apx-routine`, `apx-mcp`, `apx-task`, `apx-telegram`, `apx-runtime`, `apx-sessions`, `apx-voice`, `apx-agent`, `apx-project`. Pick the closest topic, copy the structure.
119
+
120
+ ## Maintainer contract
121
+
122
+ `AGENTS.md` rule 6 (regenerated by `apx agent add/import`) requires skills to move in lockstep with feature changes. Update or add the skill in the same PR as the behavior change — especially `skills/apx-*`.
123
+
124
+ ## Don't
125
+
126
+ - Don't ship without frontmatter `description` — loader works, trigger is silent.
127
+ - Don't put secrets inside skills. They're read aloud by an LLM.
128
+ - Don't reference machine-only paths — use `<repo>` or `~/.apx` placeholders.
129
+ - Don't write in third person. The reader is the model. Write to it.
@@ -1,16 +1,16 @@
1
1
  ---
2
2
  name: apx-task
3
- description: Per-project TODO list. Load when the user wants to note, remind, list, or complete a task. Tasks are project-scoped, event-sourced, and addressable by short id prefix. Triggers: 'add a task', 'remind me to…', 'what's pending', 'mark as done'.
3
+ description: Per-project TODO list. Event-sourced, project-scoped, addressable by short id prefix. Load when user wants to note, remind, list, or complete a task. Triggers: 'add a task', 'remind me to…', 'what's pending', 'mark as done', 'open tasks'.
4
4
  ---
5
5
 
6
6
  # apx-task
7
7
 
8
- A `task` is a per-project TODO. Append-only JSONL event log per month under `~/.apx/projects/<apxId>/tasks/YYYY-MM.jsonl`. State is the fold of the event stream. Once created, a task lives forever — `done` and `drop` don't delete events, they record a state transition. `reopen` flips back to `open`.
8
+ A `task` is a per-project TODO. Append-only JSONL event log per month at `~/.apx/projects/<apxId>/tasks/YYYY-MM.jsonl`. State is the fold of the event stream. Once created a task lives forever — `done` and `drop` record state transitions, don't delete events. `reopen` flips back to `open`.
9
9
 
10
10
  ## Concrete CLI calls
11
11
 
12
12
  ```bash
13
- # Add — most common
13
+ # Add
14
14
  apx task add "Review the auth bug" --project iacrmar
15
15
  apx task add "Call the client" --project iacrmar --due 2026-05-30 --tag urgent
16
16
  apx task add "Demo for tester X" --project iacrmar --agent reviewer --tag demo --tag external --source cli
@@ -25,7 +25,7 @@ apx task list --project iacrmar --limit 5
25
25
 
26
26
  # Inspect / mutate
27
27
  apx task show t_abc123 --project iacrmar
28
- apx task show abc --project iacrmar # prefix match (≥3 chars), unique
28
+ apx task show abc --project iacrmar # prefix match (≥3 chars, unique)
29
29
  apx task done t_abc123 --project iacrmar --by manuel
30
30
  apx task drop t_abc123 --project iacrmar # archived (not "done")
31
31
  apx task reopen t_abc123 --project iacrmar
@@ -35,7 +35,7 @@ apx task patch t_abc123 --project iacrmar --tag bug --tag blocker # replaces
35
35
 
36
36
  ## ID format
37
37
 
38
- `t_` + 6 base36 chars (32-bit entropy → ~4B keyspace). Prefix matching works once you have 3 chars and the prefix uniquely identifies a task. If two tasks share a prefix, you get null — use a longer one.
38
+ `t_` + 6 base36 chars (~4B keyspace). Prefix matching works at ≥3 chars when the prefix is unique. If two tasks share a prefix you get null — use a longer one.
39
39
 
40
40
  ## Fields
41
41
 
@@ -43,36 +43,33 @@ apx task patch t_abc123 --project iacrmar --tag bug --tag blocker # replaces
43
43
  |---|---|---|
44
44
  | `title` | always | One imperative line. Required. |
45
45
  | `body` | optional | Longer notes. Markdown OK. |
46
- | `tags` | optional | Free-form strings. Used by `--tag` filter. |
47
- | `due` | optional | ISO date `YYYY-MM-DD`. Listing supports `--due-before`. |
48
- | `agent` | optional | Slug of an agent responsible. Used by `--agent` filter. |
49
- | `source` | auto/optional | Where the task came from (cli, telegram, super-agent). |
50
- | `state` | derived | `open` after create, `done` / `dropped` after their respective ops. |
46
+ | `tags` | optional | Free-form. Used by `--tag` filter. |
47
+ | `due` | optional | ISO `YYYY-MM-DD`. Supports `--due-before`. |
48
+ | `agent` | optional | Slug of responsible agent. Used by `--agent` filter. |
49
+ | `source` | auto/optional | Origin (cli, telegram, super-agent). |
50
+ | `state` | derived | `open` after create, `done`/`dropped` after ops. |
51
51
 
52
52
  ## Super-agent tools
53
53
 
54
- The super-agent has `create_task` and `list_tasks` tools. So a user message like "note that we need to close the auth bug in iacrmar tomorrow" makes the model call:
54
+ The super-agent has `create_task` and `list_tasks`. "Note that we need to close the auth bug in iacrmar tomorrow" model calls:
55
55
 
56
56
  ```json
57
57
  { "name": "create_task",
58
58
  "arguments": { "project": "iacrmar", "title": "Close the auth bug", "due": "<tomorrow>", "tags": ["bug"] } }
59
59
  ```
60
60
 
61
- When the user asks "what's pending in iacrmar?", the model calls `list_tasks({ project: "iacrmar" })`.
62
-
63
- If the user doesn't say which project, the model should `list_projects` first and ask which one — never assume. If the conversation has a project context (Telegram channel pinned to project), the model uses that.
61
+ "What's pending in iacrmar?" `list_tasks({ project: "iacrmar" })`. If user doesn't say which project, `list_projects` first and ask — never assume. If the channel has pinned project context (Telegram), use that.
64
62
 
65
63
  ## Anti-examples
66
64
 
67
65
  ```bash
68
66
  # DON'T add tasks without --project for real work.
69
67
  apx task add "Stuff" # falls back to first registered project (or default=0)
70
- # ↑ Will dump into a project you may not have meant. Always --project.
71
68
 
72
69
  # DON'T use `done` when the task is no longer relevant. Use `drop`.
73
- apx task done t_abc # implies "I completed this work"
74
- apx task drop t_abc # implies "this is no longer needed; archive without completion"
75
- # Reporting / metrics distinguish them.
70
+ apx task done t_abc # "I completed this work"
71
+ apx task drop t_abc # "no longer needed; archive without completion"
72
+ # Reporting/metrics distinguish them.
76
73
  ```
77
74
 
78
75
  ## Endpoint surface
@@ -90,6 +87,6 @@ GET /projects/:pid/tasks-summary → { open, done, dropped, overdue,
90
87
 
91
88
  ## Don't
92
89
 
93
- - Don't use tasks for reminders that need to *fire* — that's a future routine kind (`task-due-notify`, not built yet). Tasks are a list, not a scheduler.
94
- - Don't depend on `done` deleting the task. It doesn't. The event log stays.
95
- - Don't grep `~/.apx/projects/<id>/tasks/*.jsonl` for state — use `apx task list` or `getTask()`. The fold logic isn't trivial (later events can override fields).
90
+ - Don't use tasks for reminders that need to *fire* — that's a future routine kind (`task-due-notify`, not built). Tasks are a list, not a scheduler.
91
+ - Don't depend on `done` deleting the task. It doesn't. Event log stays.
92
+ - Don't grep `~/.apx/projects/<id>/tasks/*.jsonl` for state — use `apx task list` or `getTask()`. Fold logic isn't trivial (later events override fields).
@@ -0,0 +1,120 @@
1
+ ---
2
+ name: apx-telegram
3
+ description: APX Telegram plugin — channels, project pinning, master agents, media. Load BEFORE configuring a new bot or routing — multi-channel is the only mode, root bot_token/chat_id are legacy.
4
+ ---
5
+
6
+ # apx-telegram
7
+
8
+ APX polls `getUpdates` and routes messages. Config: `~/.apx/config.json → telegram`. Key model: **each channel can be pinned to a project and a master agent**. Messages on a pinned channel run inside that project, optionally handled by a specific agent instead of the default super-agent.
9
+
10
+ ## 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 auto-reply flag
19
+ "channels": [
20
+ {
21
+ "name": "default",
22
+ "bot_token": "<from BotFather>",
23
+ "chat_id": "<numeric chat id>",
24
+ "project": "iacrmar", // optional: pin to project
25
+ "route_to_agent": "reviewer", // optional: per-channel agent
26
+ "respond_with_engine": true, // optional: override global
27
+ "owner_user_id": "123456789" // optional: via `apx telegram owner`
28
+ }
29
+ ],
30
+ "contacts": [], // global roster (user_id → role)
31
+ "roles": {} // role → allowed tools
32
+ }
33
+ }
34
+ ```
35
+
36
+ Root `telegram.bot_token` / `telegram.chat_id` are **legacy**. Don't write them. If a config still has them and `channels[]` is empty, APX migrates them into `channels[0]` automatically on first read.
37
+
38
+ ## Concrete CLI calls
39
+
40
+ ```bash
41
+ apx telegram setup # template (still emits legacy root fields — prefer channels[])
42
+
43
+ # Channels CRUD
44
+ apx telegram channel add # interactive
45
+ apx telegram channel add clientes --bot-token <T> --chat-id <C> --project iacrmar --agent reviewer
46
+ apx telegram channel list # alias: ls
47
+ apx telegram channel show clientes # alias: get
48
+ apx telegram channel set clientes --project iacrmar
49
+ apx telegram channel set clientes --agent reviewer
50
+ apx telegram channel set clientes --respond-engine false
51
+ apx telegram channel unset clientes --project --agent
52
+ apx telegram channel remove clientes # alias: rm
53
+ apx telegram owner clientes <user_id>
54
+
55
+ # Contacts roster + roles (global; gate which tools a sender may trigger)
56
+ apx telegram contacts
57
+ apx telegram contacts rm <user_id>
58
+ apx telegram role <user_id> <role>
59
+ apx telegram roles
60
+ apx telegram roles set <name> --tools a,b,c # or --tools '*'
61
+ apx telegram roles rm <name>
62
+
63
+ # Polling lifecycle (autostarts with daemon)
64
+ apx telegram start
65
+ apx telegram stop
66
+ apx telegram status
67
+
68
+ # Sending (defaults to first configured channel)
69
+ apx telegram send "text"
70
+ apx telegram send "text" --chat 123456789
71
+ apx telegram send "text" --interrupt # bypass pending-agent queue (also: --force)
72
+
73
+ # Media (daemon HTTP API — no dedicated CLI subcommand yet)
74
+ curl -X POST http://127.0.0.1:7430/telegram/send_photo \
75
+ -H "Authorization: Bearer $(cat ~/.apx/daemon.token)" \
76
+ -H "Content-Type: application/json" \
77
+ -d '{"photo":"/abs/path.png","caption":"...","channel":"clientes"}'
78
+ curl -X POST http://127.0.0.1:7430/telegram/send_voice \
79
+ -H "Authorization: Bearer $(cat ~/.apx/daemon.token)" \
80
+ -H "Content-Type: application/json" \
81
+ -d '{"audio":"/abs/path.ogg","duration":5,"channel":"default"}'
82
+ ```
83
+
84
+ Every `channel` CRUD write triggers `POST /admin/reload` so polling picks up the new wiring without restart.
85
+
86
+ ## What "pin to project" does
87
+
88
+ On a message to a channel with `project: "iacrmar"`:
89
+ 1. The super-agent invocation gets `channelMeta.projectId = <iacrmar's id>`.
90
+ 2. The system prompt resolves project-scoped agents, MCPs, memory.
91
+ 3. Tools (`list_agents`, `list_tasks`, `create_task`, …) default to that project — no need to repeat "in iacrmar" each message.
92
+
93
+ ## What "master agent" does
94
+
95
+ With `route_to_agent: "reviewer"`, messages go through `/projects/:pid/agents/reviewer/chat` instead of `/super-agent/chat`. The agent's `AGENT.md` + memory is used. No tools (project agents are `exec_agent`-shaped — text in, text out). Single LLM call. Use this for persona channels (reviewer, sales, support) instead of the general assistant. Empty = super-agent (default).
96
+
97
+ ## Anti-examples
98
+
99
+ ```bash
100
+ # DON'T write to legacy root fields.
101
+ apx config set telegram.bot_token "<T>" # ← use channels[] via `apx telegram channel`
102
+
103
+ # DON'T expect routing magic from same project on two channels.
104
+ # A channel pins messages TO a project, not vice-versa. Same project from multiple
105
+ # channels is fine, but each channel has its own message log — no unified context.
106
+
107
+ # DON'T set route_to_agent to a non-existent slug.
108
+ apx telegram channel set default --agent nope # silently 404s; verify with channel show
109
+ ```
110
+
111
+ ## Multiple bots, one APX
112
+
113
+ `channels[]` supports multiple `{bot_token, chat_id}` pairs — different bots OR the same bot with different chats. Plugin polls each in parallel; project/agent pinning is per-channel. Wire "client A bot, personal bot, notifications-only bot" as three channels.
114
+
115
+ ## Don't
116
+
117
+ - Write to `telegram.bot_token` / `telegram.chat_id` at root.
118
+ - Expect `apx telegram send` to target a project — it targets a *chat id*. Verify wiring with `apx telegram channel show <name>`.
119
+ - Set `respond_with_engine: false` and then wonder why replies stop. That flag disables auto-reply for the channel.
120
+ - Forget the plugin only fires on listed chat IDs. Other chats are ignored.