@agentprojectcontext/apx 1.34.0 → 1.36.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 (75) 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/core/stores/conversations.js +27 -2
  43. package/src/host/daemon/api/exec.js +2 -0
  44. package/src/host/daemon/api/skills.js +140 -6
  45. package/src/host/daemon/api/super-agent.js +56 -1
  46. package/src/host/daemon/index.js +17 -0
  47. package/src/interfaces/cli/branding.js +53 -0
  48. package/src/interfaces/cli/commands/skills.js +254 -0
  49. package/src/interfaces/cli/index.js +84 -2
  50. package/src/interfaces/web/dist/assets/index-Cm0KyPoZ.css +1 -0
  51. package/src/interfaces/web/dist/assets/index-DJKA763h.js +628 -0
  52. package/src/interfaces/web/dist/assets/index-DJKA763h.js.map +1 -0
  53. package/src/interfaces/web/dist/index.html +2 -2
  54. package/src/interfaces/web/src/App.tsx +0 -1
  55. package/src/interfaces/web/src/components/chat/ChatList.tsx +412 -0
  56. package/src/interfaces/web/src/components/chat/MessageBubble.tsx +21 -1
  57. package/src/interfaces/web/src/components/settings/AppearancePanel.tsx +1 -1
  58. package/src/interfaces/web/src/components/settings/MemoryPanel.tsx +69 -1
  59. package/src/interfaces/web/src/components/settings/SkillsInspectorPanel.tsx +222 -0
  60. package/src/interfaces/web/src/hooks/useChat.ts +54 -2
  61. package/src/interfaces/web/src/i18n/en.ts +12 -1
  62. package/src/interfaces/web/src/i18n/es.ts +12 -1
  63. package/src/interfaces/web/src/lib/api/agents.ts +1 -1
  64. package/src/interfaces/web/src/lib/api/skills.ts +70 -0
  65. package/src/interfaces/web/src/screens/ProjectScreen.tsx +3 -5
  66. package/src/interfaces/web/src/screens/SettingsScreen.tsx +12 -6
  67. package/src/interfaces/web/src/screens/modules/VoiceScreen.tsx +1 -1
  68. package/src/interfaces/web/src/screens/project/ChatTab.tsx +120 -87
  69. package/src/interfaces/web/src/types/daemon.ts +10 -0
  70. package/src/core/agent/prompts/action-discipline.md +0 -24
  71. package/src/core/agent/prompts/super-agent-base.md +0 -42
  72. package/src/interfaces/web/dist/assets/index-DdmSRtsz.css +0 -1
  73. package/src/interfaces/web/dist/assets/index-M4FspaCH.js +0 -613
  74. package/src/interfaces/web/dist/assets/index-M4FspaCH.js.map +0 -1
  75. package/src/interfaces/web/src/screens/project/ThreadsTab.tsx +0 -100
@@ -29,9 +29,13 @@ import askQuestions from "./handlers/ask-questions.js";
29
29
  import createTask from "./handlers/create-task.js";
30
30
  import listTasks from "./handlers/list-tasks.js";
31
31
  import discoverTools from "./handlers/discover-tools.js";
32
+ import gitStatus from "./handlers/git-status.js";
33
+ import gitDiff from "./handlers/git-diff.js";
34
+ import gitLog from "./handlers/git-log.js";
35
+ import gitShow from "./handlers/git-show.js";
32
36
  import { createPermissionGuard } from "./helpers.js";
33
37
  import { buildBridgedTools, DEFAULT_CATEGORIES } from "./registry-bridge.js";
34
- import { TOOLS } from "./names.js";
38
+ import { TOOLS, CODE_CHANNEL_TOOLS } from "./names.js";
35
39
  import { CHANNELS } from "#core/constants/channels.js";
36
40
 
37
41
  const NATIVE_TOOLS = [
@@ -66,6 +70,10 @@ const NATIVE_TOOLS = [
66
70
  createTask,
67
71
  listTasks,
68
72
  discoverTools,
73
+ gitStatus,
74
+ gitDiff,
75
+ gitLog,
76
+ gitShow,
69
77
  ];
70
78
 
71
79
  // Registry-backed bridges. Categories can be overridden per-process via env
@@ -135,6 +143,15 @@ const FULL_CHANNELS = new Set([
135
143
  CHANNELS.API,
136
144
  CHANNELS.WEB,
137
145
  CHANNELS.CODE,
146
+ CHANNELS.WEB_CODE,
147
+ ]);
148
+
149
+ // Coding surfaces — even on the lightweight set, these channels get the
150
+ // git_* tools promoted into the base so the model can inspect the repo
151
+ // without round-tripping through discover_tools every turn.
152
+ const CODE_CHANNELS = new Set([
153
+ CHANNELS.CODE,
154
+ CHANNELS.WEB_CODE,
138
155
  ]);
139
156
 
140
157
  // Category labels for grouping the discover_tools catalog. Native tools have no
@@ -172,6 +189,10 @@ const NATIVE_CATEGORY = {
172
189
  [TOOLS.LIST_FILES]: "files",
173
190
  [TOOLS.SEARCH_FILES]: "files",
174
191
  [TOOLS.RUN_SHELL]: "shell",
192
+ [TOOLS.GIT_STATUS]: "code",
193
+ [TOOLS.GIT_DIFF]: "code",
194
+ [TOOLS.GIT_LOG]: "code",
195
+ [TOOLS.GIT_SHOW]: "code",
175
196
  };
176
197
 
177
198
  function categoryOf(tool) {
@@ -200,14 +221,24 @@ export const BASE_TOOL_SCHEMAS = ALL_TOOLS
200
221
 
201
222
  const schemaName = (s) => s?.function?.name || s?.name;
202
223
 
224
+ // Code-channel base = BASE + git_* tools. Pre-computed once.
225
+ const CODE_BASE_TOOL_NAMES = new Set([...BASE_TOOL_NAMES, ...CODE_CHANNEL_TOOLS]);
226
+ const CODE_BASE_TOOL_SCHEMAS = ALL_TOOLS
227
+ .filter((t) => CODE_BASE_TOOL_NAMES.has(t.name))
228
+ .map((t) => t.schema);
229
+
203
230
  /**
204
- * Choose the INITIAL tool schema list for a channel. Full channels get the
205
- * whole registry; lightweight channels (telegram/desktop/deck/web_sidebar) get
206
- * the base set and expand on demand via discover_tools. `full: true` forces the
207
- * complete registry regardless of channel.
231
+ * Choose the INITIAL tool schema list for a channel.
232
+ * - FULL_CHANNELS (api, web, code, web_code, routine) get the whole registry.
233
+ * - CODE_CHANNELS overlap with FULL, but when something forces a smaller set
234
+ * (CODE_PLAN_TOOLS allowlist) the git_* tools are still in their base.
235
+ * - Everything else is "lightweight" and starts on BASE_TOOL_NAMES.
236
+ *
237
+ * `full: true` forces the complete registry regardless of channel.
208
238
  */
209
239
  export function schemasForChannel(channel, { full = false } = {}) {
210
240
  if (full || FULL_CHANNELS.has(channel)) return TOOL_SCHEMAS;
241
+ if (CODE_CHANNELS.has(channel)) return CODE_BASE_TOOL_SCHEMAS;
211
242
  return BASE_TOOL_SCHEMAS;
212
243
  }
213
244
 
@@ -117,6 +117,27 @@ const DEFAULT_CONFIG = {
117
117
  compact_model: "ollama:gemma4:31b-cloud", // light LLM for compaction (Ollama, local endpoint)
118
118
  compact_fallback_model: "", // "" → falls back to super_agent.model (APX default)
119
119
  },
120
+ skills: {
121
+ // Skill Inspector — opt-in test feature. When enabled, the static
122
+ // "Available skills" hint block (slug dump) is removed from the system
123
+ // prompt; instead a local RAG inspects each turn's user prompt and
124
+ // injects either the matching skill's body (high confidence) or a hint
125
+ // to call load_skill (mid confidence). Below threshold → nothing.
126
+ // Re-evaluated every turn → natural decay (a skill that stopped matching
127
+ // disappears next turn).
128
+ // Embedding provider is whatever memory.embeddings resolves to (defaults
129
+ // to local: ollama → gemini → openai → offline TF). No paid keys needed.
130
+ inspector: {
131
+ enabled: false,
132
+ load_threshold: 0.55,
133
+ hint_threshold: 0.40,
134
+ margin: 0.04,
135
+ max_loaded: 1,
136
+ max_hints: 2,
137
+ prompt_floor: 8,
138
+ body_char_cap: 6000,
139
+ },
140
+ },
120
141
  voice: {
121
142
  // Text-to-speech configuration. Selector reads voice.tts.provider; "auto"
122
143
  // probes engines in preference order (piper → elevenlabs → openai →
@@ -1,55 +1,45 @@
1
1
  ---
2
2
  name: apx
3
- description: "APX CLI umbrella — which sub-skill handles each operation (sessions, MCPs, routines, tasks, telegram, projects, agents, runtimes). Activate when the user mentions `apx`, the APX daemon, or wants to coordinate/run/delegate agents. Not for `.apc/` alone (use apc-context). Triggers: 'apx', 'apx run', 'apx daemon', 'coordinate agents', 'apx help'."
3
+ description: "APX CLI umbrella — routes operations to sub-skills (sessions, MCPs, routines, tasks, telegram, projects, agents, runtimes). Activate on `apx`, the APX daemon, or coordinating/running/delegating agents. Not for `.apc/` alone (use apc-context). Triggers: 'apx', 'apx run', 'apx daemon', 'coordinate agents'."
4
4
  homepage: https://github.com/agentprojectcontext/apx
5
5
  ---
6
6
 
7
7
  # APX — Agent Project Context Runtime
8
8
 
9
- APX is a daemon (`127.0.0.1:7430`, auto-starts on first call) that turns external coding CLIs (Claude Code, Codex, OpenCode, Aider, …) and configurable agents into a unified orchestration surface.
9
+ APX is a daemon (`127.0.0.1:7430`, auto-starts on first call) that turns external coding CLIs (Claude Code, Codex, OpenCode, Aider, …) and configurable agents into a unified orchestration surface. It reads APC project context from `.apc/` (committed) but keeps runtime state outside the repo under `~/.apx/projects/<project-id>/`. Super-agent has a default workspace at `~/.apx/projects/default` for system-level work.
10
10
 
11
- It reads APC project context from `.apc/` (committed) but keeps runtime state outside the repo under `~/.apx/projects/<project-id>/`. The super-agent has a default workspace at `~/.apx/projects/default` for system-level work.
11
+ ## When to use APX (vs. native subagent)
12
12
 
13
- ---
14
-
15
- ## When to use APX (vs. spawning a subagent natively)
16
-
17
- If you can spawn a subagent natively in the IDE you're in (Claude Code, Cursor, …) — **do that**. No APX needed.
18
-
19
- Use APX when:
20
- - The user explicitly asks for a specific external runtime ("run this in Codex", "delegate to OpenCode").
21
- - You need to run an agent in a runtime different from the one you're in.
22
- - You're orchestrating from outside any IDE (a script, Telegram bot, CI, routine).
23
-
24
- ---
13
+ If you can spawn a subagent natively in the current IDE (Claude Code, Cursor, …) — **do that**. No APX needed. Use APX when:
14
+ - User explicitly asks for a specific external runtime ("run this in Codex", "delegate to OpenCode").
15
+ - You need an agent in a runtime different from the one you're in.
16
+ - Orchestrating from outside any IDE (script, Telegram bot, CI, routine).
25
17
 
26
- ## Sub-skill index — open the one that matches the task
18
+ ## Sub-skill index
27
19
 
28
20
  | Topic | Sub-skill | When |
29
21
  |-------|-----------|------|
30
- | Delegate to an external coding CLI | **apx-runtime** | `apx run <agent> --runtime claude-code\|codex\|...` |
31
- | List / read / resume / summarise / continue sessions across engines | **apx-sessions** | `apx session resume`, `apx sessions list`, "import a codex session" |
32
- | Use a registered MCP tool | **apx-mcp** | `apx mcp run`, "call MCP filesystem", "the MCP is failing" |
33
- | Add / configure / use a project agent | **apx-agent** | "add an agent", "import from vault", per-agent model, agent memory |
34
- | Register / list / configure a project | **apx-project** | "register this project", `apx project list`, per-project config |
22
+ | Delegate to external coding CLI | **apx-runtime** | `apx run <agent> --runtime claude-code\|codex\|...` |
23
+ | List/read/resume/summarise/continue sessions | **apx-sessions** | `apx session resume`, `apx sessions list`, "import a codex session" |
24
+ | Use a registered MCP tool | **apx-mcp** | `apx mcp run`, "call MCP filesystem", "MCP failing" |
25
+ | Add/configure/use a project agent | **apx-agent** | "add an agent", vault import, per-agent model, agent memory |
26
+ | Register/list/configure a project | **apx-project** | "register this project", `apx project list`, per-project config |
35
27
  | Per-project TODO list | **apx-task** | "add a task", "remind me to…", "what's pending" |
36
- | Scheduled / recurring agents | **apx-routine** | `apx routine add`, every-5m, cron-like jobs |
28
+ | Scheduled/recurring agents | **apx-routine** | `apx routine add`, every-5m, cron-like jobs |
37
29
  | Telegram I/O | **apx-telegram** | configure bot, channels, send a message |
38
30
  | Voice channel (TTS, speech) — *optional* | **apx-voice** | only if voice is being set up |
39
- | Build a new MCP server — *internal/dev* | **apx-mcp-builder** | when developing a brand-new MCP from scratch |
40
- | Author a new APX skill — *internal/dev* | **apx-skill-builder** | when adding to APX itself |
41
-
42
- > Sub-skills marked *internal/dev* are not pushed to IDE skill dirs by default. They live in the APX repo and are loaded by APX itself; install one to your IDE with `apx skills add <slug> --global` if you want it there.
31
+ | Build a new MCP server — *internal/dev* | **apx-mcp-builder** | authoring a brand-new MCP from scratch |
32
+ | Author a new APX skill — *internal/dev* | **apx-skill-builder** | adding to APX itself |
43
33
 
44
- ---
34
+ > *internal/dev* sub-skills aren't pushed to IDE skill dirs by default. They live in the APX repo; install to IDE with `apx skills add <slug> --global`.
45
35
 
46
36
  ## Generic patterns (apply to every sub-skill)
47
37
 
48
- ### Verify commands before recommending them
38
+ ### Verify commands before recommending
49
39
 
50
- Do not invent APX subcommands. Confirm exact CLI form with `apx --help` or `apx <command> --help` before telling another runtime to invoke APX. Avoid guessed aliases (e.g. `apx send-telegram` is *not* a thing — see apx-telegram).
40
+ Don't invent APX subcommands. Confirm exact form with `apx --help` or `apx <command> --help` before telling another runtime to invoke APX. Avoid guessed aliases (e.g. `apx send-telegram` is not a thing — see apx-telegram).
51
41
 
52
- ### `APC_RESULT` contract — structured return values
42
+ ### `APC_RESULT` contract
53
43
 
54
44
  When you want APX to capture a structured value from an agent (any runtime), instruct the agent to print on its last meaningful line:
55
45
 
@@ -57,7 +47,7 @@ When you want APX to capture a structured value from an agent (any runtime), ins
57
47
  APC_RESULT: <one-line value>
58
48
  ```
59
49
 
60
- APX's `extractApfResult()` parses that and stores it as the session's `result` field. Useful for automation, routines, and CI.
50
+ APX's `extractApfResult()` parses that and stores it as the session's `result` field. Useful for automation, routines, CI.
61
51
 
62
52
  ### Tool permissions
63
53
 
@@ -66,16 +56,16 @@ apx permission show
66
56
  apx permission set automatico # total | automatico | permiso
67
57
  ```
68
58
 
69
- `automatico` runs read/list/safe shell checks directly and asks before destructive shell, MCP, runtime, outbound, config, or filesystem mutation actions.
59
+ `automatico` runs read/list/safe shell checks directly; asks before destructive shell, MCP, runtime, outbound, config, or filesystem mutation.
70
60
 
71
61
  ### Memory
72
62
 
73
- Write memory only for durable, safe project facts. Do not store raw transcripts or secrets.
63
+ Write memory only for durable, safe project facts. No raw transcripts or secrets.
74
64
 
75
65
  ```bash
76
66
  apx memory <slug> # read agent's memory.md
77
- apx memory <slug> --append "<fact>" # append a durable note
78
- apx memory <slug> --replace < file.md # replace entire memory from stdin
67
+ apx memory <slug> --append "<fact>" # append durable note
68
+ apx memory <slug> --replace < file.md # replace entire memory from stdin
79
69
  ```
80
70
 
81
71
  ### Observe activity
@@ -86,10 +76,8 @@ apx messages chat --channel telegram -n 20 # readable chat view
86
76
  apx messages tail --channel runtime --agent <slug> -n 20
87
77
  ```
88
78
 
89
- ---
90
-
91
79
  ## Anti-patterns
92
80
 
93
- - Don't activate APX-sessions inside a request that's purely about `apx run` orchestration — use apx-runtime.
94
- - Don't activate apx-mcp-builder unless the user is actually authoring a new MCP server (it's a deep developer guide, not a usage guide).
81
+ - Don't activate apx-sessions inside a request that's purely about `apx run` orchestration — use apx-runtime.
82
+ - Don't activate apx-mcp-builder unless the user is actually authoring a new MCP server (deep dev guide, not usage).
95
83
  - Don't push state to `.apc/` that belongs in `~/.apx/projects/<id>/` (sessions, conversations, runtime logs).
@@ -1,26 +1,23 @@
1
1
  ---
2
2
  name: apx-agency-agents
3
- description: "Manage the APX agent vault — reusable agent templates (Roby, Cody, Rocky, Tessa, Max, Arch, Sid, Vera, Finn + generic dev/marketing/ops/qa/support). Load to spawn a specialist, list templates, import one into a project, create a template, or hide/restore a bundled default. Triggers: 'spawn agent', 'use Cody/Rocky/Tessa', 'list agents', 'agent vault', 'import agent', 'new agent'."
3
+ description: "APX agent vault — reusable templates (Roby, Cody, Rocky, Tessa, Max, Arch, Sid, Vera, Finn + generic dev/marketing/ops/qa/support). Spawn a specialist, list, import into a project, create, or hide/restore a bundled default. Triggers: 'spawn agent', 'use Cody/Rocky/Tessa', 'list agents', 'agent vault', 'import agent', 'new agent'."
4
4
  ---
5
5
 
6
6
  # apx-agency-agents — the APX agent vault
7
7
 
8
- The vault is the **global, project-agnostic library of agent templates** in APX. Two layers, deduped per-slug, with the user layer winning:
8
+ Global, project-agnostic library of agent templates. Two layers, deduped per-slug, user wins:
9
9
 
10
10
  | Layer | Where | Mutability |
11
11
  |---|---|---|
12
- | **Bundled** | `<repo>/assets/agent-vault-defaults/<slug>.md` | Read-only on disk. Always visible unless tombstoned. |
13
- | **User** | `~/.apx/agents/<slug>.md` | Read-write. Overrides the bundled with the same slug. |
14
- | **Tombstones** | `~/.apx/agents/.removed.json` | List of bundled slugs the user explicitly hid. |
12
+ | **Bundled** | `<repo>/assets/agent-vault-defaults/<slug>.md` | Read-only. Visible unless tombstoned. |
13
+ | **User** | `~/.apx/agents/<slug>.md` | Read-write. Overrides bundled with same slug. |
14
+ | **Tombstones** | `~/.apx/agents/.removed.json` | Bundled slugs the user hid. |
15
15
 
16
- Listing returns `bundled ∪ user`, with `source: "bundled" | "user" | "user-override"` per entry. Editing a bundled entry is **copy-on-write** — it materializes into the user layer the moment you save. Deleting a bundled entry **tombstones** it (you can restore later); deleting a user-only entry physically removes the file.
16
+ Listing returns `bundled ∪ user`, with `source: "bundled" | "user" | "user-override"`. Editing a bundled entry is **copy-on-write** (materializes into user layer on save). Deleting bundled **tombstones** (restorable); deleting user-only removes the file.
17
17
 
18
- ## Bundled starter pack
19
-
20
- APX ships 14 templates out of the box, two families:
18
+ ## Bundled starter pack (14 templates)
21
19
 
22
20
  ### Named team (from nicho-apps)
23
- A characterful crew already used in production by NichoApps:
24
21
 
25
22
  | Slug | Role | Strength |
26
23
  |---|---|---|
@@ -35,28 +32,19 @@ A characterful crew already used in production by NichoApps:
35
32
  | `finn-billing` | Billing / commercial ops | Stripe, invoicing, plan logic |
36
33
 
37
34
  ### Generic specialists (from PandaProject)
38
- Plain functional roles — useful when you want capabilities without a persona:
39
35
 
40
- | Slug | Role |
41
- |---|---|
42
- | `development` | Engineering & code |
43
- | `marketing` | Marketing & growth |
44
- | `ops` | Ops, deploys & incidents |
45
- | `qa` | Quality assurance & testing |
46
- | `support` | Customer support & escalations |
36
+ `development`, `marketing`, `ops`, `qa`, `support` — plain functional roles without a persona.
47
37
 
48
- Bundled templates ship with `language: es` and **no `model:` set** — they inherit the project/global default model. Set a model on import or by editing the vault file directly.
38
+ Bundled templates ship with `language: es` and **no `model:`** — they inherit the project/global default. Set a model on import or by editing the vault file.
49
39
 
50
- ## Concrete commands
40
+ ## Commands
51
41
 
52
42
  ```bash
53
- # List the vault (bundled + your overrides, with [bundled] / [user] / [override] tags)
43
+ # List (bundled + overrides, tagged [bundled]/[user]/[override])
54
44
  apx agent vault list
45
+ apx agent vault list --all # include tombstoned
55
46
 
56
- # Include tombstoned bundled defaults (the ones you hid)
57
- apx agent vault list --all
58
-
59
- # Create a new template (writes ~/.apx/agents/<slug>.md)
47
+ # Create (writes ~/.apx/agents/<slug>.md)
60
48
  apx agent vault add reviewer \
61
49
  --role "Code reviewer" \
62
50
  --model ollama:llama3.2:3b \
@@ -64,36 +52,32 @@ apx agent vault add reviewer \
64
52
  --skills code-review,git \
65
53
  --description "Reviews PRs and pushes back on hand-wavy diffs."
66
54
 
67
- # Delete a template:
68
- # - user-only slug → file is physically deleted
69
- # - bundled slug → tombstoned, hidden from listings
55
+ # Delete: user-only → physical delete; bundled → tombstone
70
56
  apx agent vault rm tessa-qa
57
+ apx agent vault restore tessa-qa # un-tombstone
71
58
 
72
- # Bring back a tombstoned bundled default
73
- apx agent vault restore tessa-qa
74
-
75
- # Import a vault template into the current project
59
+ # Import into current project
76
60
  apx agent import cody-developer
77
- apx agent import tessa-qa --copy # copy into .apc/agents/ for local edits
78
- apx agent import roby-orchestrator --force # overwrite an existing local def
61
+ apx agent import tessa-qa --copy # copy into .apc/agents/ for local edits
62
+ apx agent import roby-orchestrator --force
79
63
 
80
- # Inside the daemon's tool API, the same flow:
64
+ # Daemon tool API equivalents:
81
65
  list_vault_agents()
82
66
  import_agent({ slug: "cody-developer", project: "<name-or-path>" })
83
67
  ```
84
68
 
85
- ## The web equivalents
69
+ ## Web equivalents
86
70
 
87
- The Agent defaults tab (`/p/0/agent-defaults`) has the same CRUD: a "New" button (POST `/agents/vault`), "Edit" per card (PATCH `/agents/vault/:slug`, copy-on-write for bundled), "Delete"/"Hide" (DELETE), and a "Show removed" toggle that surfaces tombstoned bundled defaults with a "Restore" button.
71
+ Agent defaults tab (`/p/0/agent-defaults`): same CRUD "New" (POST `/agents/vault`), per-card "Edit" (PATCH `/agents/vault/:slug`, copy-on-write for bundled), "Delete"/"Hide" (DELETE), "Show removed" toggle with "Restore" button.
88
72
 
89
- ## When to use which agent
73
+ ## Which agent to use
90
74
 
91
- - **User says "spawn/use Cody/Rocky/Tessa/Max/Arch/Sid/Vera/Roby/Finn"** → that exact slug exists in the named team. Import it.
92
- - **User wants a "developer" / "QA" / "marketing" agent without a persona** → use the generic specialists (`development`, `qa`, `marketing`, …).
93
- - **User wants something not in the vault** → either `apx agent vault add <slug>` to create a blank one, or `apx agent add <slug>` directly inside a project for a one-off.
94
- - **Fresh install** → bundled defaults are always present (no sync step); they appear in `apx agent vault list` immediately.
75
+ - User says **"spawn/use Cody/Rocky/Tessa/Max/Arch/Sid/Vera/Roby/Finn"** → import that exact slug from named team.
76
+ - User wants **"developer"/"QA"/"marketing" without a persona** → use generics (`development`, `qa`, `marketing`, …).
77
+ - **Not in vault** → `apx agent vault add <slug>` for a new template, or `apx agent add <slug>` directly in a project for a one-off.
78
+ - **Fresh install** → bundled defaults are always present (no sync step); appear in `apx agent vault list` immediately.
95
79
 
96
- ## Where the files live
80
+ ## File locations
97
81
 
98
82
  ```
99
83
  <APX repo>/assets/agent-vault-defaults/<slug>.md ← canonical bundle (committed)
@@ -101,7 +85,7 @@ The Agent defaults tab (`/p/0/agent-defaults`) has the same CRUD: a "New" button
101
85
  <project>/.apc/agents/<slug>.md ← project-local copy (after import --copy)
102
86
  ```
103
87
 
104
- The vault file format is identical to a project agent file:
88
+ Vault format = project agent format:
105
89
 
106
90
  ```
107
91
  ---
@@ -114,28 +98,28 @@ tools: x, y
114
98
  is_master: false
115
99
  ---
116
100
 
117
- <markdown body — the agent's system prompt extension>
101
+ <markdown body — system prompt extension>
118
102
  ```
119
103
 
120
104
  ## Frontmatter fields the runtime reads
121
105
 
122
106
  | Field | Effect |
123
107
  |---|---|
124
- | `role` | Shown in CLI/web. Appears in the agent's prompt as "Role: …". |
108
+ | `role` | Shown in CLI/web; appears as "Role: …" in prompt. |
125
109
  | `model` | Default model for engine routing. |
126
- | `description` | Shown in `/agents/vault` and the AgentDefaultsTab cards. |
127
- | `language` | Adds "Default language: <code>" to the system prompt. |
128
- | `skills` | Per-agent skill names; relevant skill bodies are loaded by skill resolution. |
129
- | `tools` | Declared tool hints; actual callable tools depend on the invocation surface. |
130
- | `is_master` | If true, marked as a master agent in the project (badge + ordering). |
110
+ | `description` | Shown in `/agents/vault` and AgentDefaultsTab cards. |
111
+ | `language` | Adds "Default language: <code>" to system prompt. |
112
+ | `skills` | Per-agent skill names; bodies loaded by skill resolution. |
113
+ | `tools` | Tool hints; actual callable tools depend on invocation surface. |
114
+ | `is_master` | If true, marked master in project (badge + ordering). |
131
115
 
132
116
  ## Related skills
133
117
 
134
- - **[apx-agent](../apx-agent/SKILL.md)** — per-project agent CRUD (add / edit / memory / list). The vault is the *library*; this skill is the *workshop*.
135
- - **[apx-runtime](../apx-runtime/SKILL.md)** — delegating to external coding CLIs (claude-code, codex, etc) from inside an agent.
118
+ - **[apx-agent](../apx-agent/SKILL.md)** — per-project agent CRUD. Vault = library; this = workshop.
119
+ - **[apx-runtime](../apx-runtime/SKILL.md)** — delegating to external coding CLIs from inside an agent.
136
120
 
137
121
  ## Gotchas
138
122
 
139
- - **Bundled defaults are always present** — there's no sync step. They appear in `apx agent vault list` and in the web UI the moment APX is installed. Removing one tombstones it; editing one copies it to your user layer.
140
- - The slug `roby-orchestrator` is intentionally **not** `roby` — the APX super-agent persona is already named "Roby" via `~/.apx/identity.json`. Importing a project agent called `roby` would shadow that and cause confusion. Use `roby-orchestrator` for a *project-level* orchestrator.
141
- - The `agency-agents` skill in `~/.claude/skills/` pulls from an external GitHub repo (`msitarzewski/agency-agents`). APX bundles a snapshot in `assets/agent-vault-defaults/` so installs are offline-first. To refresh from upstream, edit the bundle and re-commit; existing users' overrides are untouched.
123
+ - **Bundled defaults are always present** — no sync step. Removing tombstones; editing copies to user layer.
124
+ - Slug is `roby-orchestrator`, **not** `roby` — the APX super-agent persona is "Roby" via `~/.apx/identity.json`. A project agent called `roby` would shadow it.
125
+ - The `agency-agents` skill in `~/.claude/skills/` pulls from `msitarzewski/agency-agents` on GitHub. APX bundles a snapshot in `assets/agent-vault-defaults/` so installs are offline-first. To refresh upstream, edit the bundle and re-commit; user overrides are untouched.
@@ -1,19 +1,19 @@
1
1
  ---
2
2
  name: apx-agent
3
- description: How to create, configure, and use project agents in APX. Load when the user wants to "add an agent", import from the vault, set a per-agent model, or write agent memory.
3
+ description: Create, configure, use project agents in APX. Load when user wants to add an agent, import from vault, set a per-agent model, or write agent memory. Triggers: 'add agent', 'new agent', 'import agent', 'agent memory', 'per-agent model'.
4
4
  ---
5
5
 
6
6
  # apx-agent
7
7
 
8
- A project agent is a named persona inside an APC project. Canonical definition: `.apc/agents/<slug>.md` (flat file). `AGENTS.md` is auto-regenerated for discovery. Per-agent runtime data (memory, conversations, sessions) lives under `~/.apx/projects/<apx_id>/agents/<slug>/` and is never committed. APX still reads legacy `.apc/agents/<slug>/memory.md` as a migration fallback only.
8
+ A project agent is a named persona inside an APC project. Definition: `.apc/agents/<slug>.md` (flat); `AGENTS.md` auto-regenerated for discovery. Runtime data (memory, conversations, sessions) under `~/.apx/projects/<apx_id>/agents/<slug>/`, never committed. Legacy `.apc/agents/<slug>/memory.md` still read as migration fallback.
9
9
 
10
10
  ## Concrete CLI calls
11
11
 
12
12
  ```bash
13
- # List agents in the current project (agent commands are cwd-scoped — run from the project root)
13
+ # List (agent commands are cwd-scoped — run from project root)
14
14
  apx agent list
15
15
 
16
- # Create a new agent (writes .apc/agents/<slug>.md, creates runtime dir, regenerates AGENTS.md)
16
+ # Create (writes .apc/agents/<slug>.md, creates runtime dir, regenerates AGENTS.md)
17
17
  apx agent add reviewer \
18
18
  --role "Code reviewer" \
19
19
  --model ollama:llama3.2:3b \
@@ -22,7 +22,7 @@ apx agent add reviewer \
22
22
  --tools read,write,run \
23
23
  --skills code-review,git
24
24
 
25
- # Import an agent template from the global vault (~/.apx/agents/)
25
+ # Import from global vault (~/.apx/agents/)
26
26
  apx agent vault list # see what's available
27
27
  apx agent import <slug> # register vault slug in this project
28
28
  apx agent import <slug> --copy # copy vault .md into .apc/agents/ for local edits
@@ -31,70 +31,67 @@ apx agent import <slug> --force # overwrite existing local definition
31
31
  # Show details (config + memory)
32
32
  apx agent get <slug> # alias: apx agent show <slug>
33
33
 
34
- # Per-agent memory (drives system prompt for that agent; cwd-scoped — run from the project root)
34
+ # Per-agent memory (drives system prompt; cwd-scoped)
35
35
  apx memory <slug> # read
36
- apx memory <slug> --append "fact" # append a line under "## Recent context"
36
+ apx memory <slug> --append "fact" # append under "## Recent context"
37
37
  apx memory <slug> --replace < file.md # full replace from stdin
38
38
  ```
39
39
 
40
- ## What the agent's system prompt looks like
40
+ ## Agent system prompt composition
41
41
 
42
42
  `buildAgentSystem()` (`src/core/agent-system.js`) composes:
43
43
 
44
- 1. Identity block: `You are <slug>` + project name.
44
+ 1. Identity: `You are <slug>` + project name.
45
45
  2. Description (from AGENTS.md).
46
46
  3. Role + Language fields.
47
- 4. Invocation context: `engine | telegram | routine | runtime` — the channel calling the agent.
48
- 5. Memory: `~/.apx/projects/<apx_id>/agents/<slug>/memory.md` if it exists, with legacy `.apc/agents/<slug>/memory.md` as a migration fallback.
49
- 6. Skills declared in the agent's `Skills:` field, each loaded from `.apc/skills/<slug>.md` or the bundled set.
50
- 7. The `apx` meta-skill (so the agent knows how to operate APX).
47
+ 4. Invocation context: `engine | telegram | routine | runtime` — the channel calling.
48
+ 5. Memory: `~/.apx/projects/<apx_id>/agents/<slug>/memory.md` (legacy `.apc/agents/<slug>/memory.md` fallback).
49
+ 6. Skills from agent's `Skills:` field, loaded from `.apc/skills/<slug>.md` or bundled set.
50
+ 7. The `apx` meta-skill (so agent knows how to operate APX).
51
51
  8. ACTION_DISCIPLINE_RULES (fixed footer — anti-ghost, anti-disclaimer, action-first).
52
52
 
53
- That's the prompt the engine sees on every `apx exec <agent>` or `apx chat <agent>`. The super-agent (default APX mode) uses a *different* prompt — see `apx-routine` for when the super-agent runs vs. when an exec_agent runs.
53
+ That's the prompt on every `apx exec <agent>` / `apx chat <agent>`. The super-agent (default APX mode) uses a *different* prompt — see `apx-routine` for super-agent vs exec_agent.
54
54
 
55
- ## Models per agent
55
+ ## Per-agent models
56
56
 
57
- Each agent can set `Model:` in its `.apc/agents/<slug>.md` definition to override the global super-agent model. Leave it empty when the agent should follow the project/global default.
57
+ Set `Model:` in `.apc/agents/<slug>.md` to override the global super-agent model. Leave empty to follow project/global default.
58
58
 
59
59
  ```markdown
60
60
  # .apc/agents/reviewer.md
61
61
  ---
62
62
  Role: Code reviewer
63
- Model: ollama:llama3.2:3b ← this agent uses this model, independent of super_agent.model
63
+ Model: ollama:llama3.2:3b ← independent of super_agent.model
64
64
  Language: es
65
65
  ---
66
66
  ```
67
67
 
68
- When a routine `kind: exec_agent` runs with `spec.agent: reviewer`, it uses that model.
68
+ A routine `kind: exec_agent` with `spec.agent: reviewer` uses that model.
69
69
 
70
70
  ## Anti-examples
71
71
 
72
72
  ```bash
73
- # DON'T hand-write .apc/agents/<slug>.md without matching AGENTS.md regeneration.
73
+ # DON'T hand-write .apc/agents/<slug>.md without regenerating AGENTS.md.
74
74
  echo "..." > /path/.apc/agents/reviewer.md
75
- # ↑ Prefer `apx agent add` or `apx agent import` so AGENTS.md stays consistent.
75
+ # ↑ Use `apx agent add` or `apx agent import` so AGENTS.md stays consistent.
76
76
 
77
- # DON'T set Model: to a provider you don't have keys for.
78
- # An agent with Model: openai:gpt-4o on a machine with no openai.api_key fails on first call.
79
-
80
- # DON'T put long-running context in `Description`. Put it in memory.md.
81
- # Description is one line, Role is a noun phrase, memory is unlimited.
77
+ # DON'T set Model: to a provider without keys fails on first call.
78
+ # DON'T put long-running context in `Description` (one line). Put it in memory.md.
82
79
  ```
83
80
 
84
- ## How agents differ from the super-agent
81
+ ## Super-agent vs project agent
85
82
 
86
83
  | Aspect | Super-agent (default APX) | Project agent |
87
84
  |---|---|---|
88
- | Has tools? | Yes (the full registry) | No (text-in/text-out via callEngine) |
85
+ | Has tools? | Yes (full registry) | No (text-in/text-out via callEngine) |
89
86
  | Loop? | Multi-iteration tool loop | Single call |
90
87
  | System prompt | `super-agent-base.md` + channel template + identity | `buildAgentSystem()` per-agent |
91
- | Conversation persisted in | super-agent surfaces | `<storagePath>/agents/<slug>/conversations/*.md` |
88
+ | Conversation in | super-agent surfaces | `<storagePath>/agents/<slug>/conversations/*.md` |
92
89
  | Configured via | `super_agent.*` in config | `AGENTS.md` + per-agent files |
93
90
 
94
- When in doubt: the super-agent is APX itself; agents are personas inside a project.
91
+ When in doubt: super-agent is APX itself; agents are personas inside a project.
95
92
 
96
93
  ## Don't
97
94
 
98
- - Don't expect a project agent to call tools. It can't. If you want tools, use the super-agent or call MCPs from a routine `kind: shell`.
95
+ - Don't expect a project agent to call tools. It can't. For tools, use super-agent or call MCPs from a routine `kind: shell`.
99
96
  - Don't overwrite `AGENTS.md` manually — `apx agent add/remove` regenerates it. Hand edits get clobbered.
100
97
  - Don't use the same slug across projects expecting shared memory. Memory is per-project.