@agentprojectcontext/apx 1.14.1 → 1.15.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentprojectcontext/apx",
3
- "version": "1.14.1",
3
+ "version": "1.15.0",
4
4
  "description": "APX — unified CLI + daemon for the Agent Project Context (APC) standard.",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -25,6 +25,7 @@
25
25
  "smoke": "node src/daemon/smoke.js",
26
26
  "test": "node --test --test-reporter=spec tests/*.test.js",
27
27
  "upgrade": "npm install && npm install -g .",
28
+ "prepack": "node scripts/sync-apc-skill.js",
28
29
  "postinstall": "node src/cli/postinstall.js"
29
30
  },
30
31
  "dependencies": {
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: apc-context
3
3
  description: "ALWAYS activate when the project has a .apc/ directory or AGENTS.md file. Do not wait to be asked. Read .apc/ before making any assumption about agents, memory, or project structure. Activate on: .apc/, AGENTS.md, 'which agents', 'list agents', 'agent context', 'who are the agents', any question about agents or memory in this project. IMPORTANT: if .apc/migrate.md exists, open the conversation with a migration offer before answering anything else. If the user declines, delete .apc/migrate.md immediately so it is not shown again."
4
- homepage: https://github.com/agentprojectcontext/apx
4
+ homepage: https://github.com/agentprojectcontext/agentprojectcontext
5
5
  ---
6
6
 
7
7
  # Agent Project Context
@@ -20,27 +20,47 @@ Before doing anything else, check if `.apc/migrate.md` exists:
20
20
  cat .apc/migrate.md 2>/dev/null
21
21
  ```
22
22
 
23
- If it exists, offer to migrate before answering anything else. Read detected files, separate durable
24
- project context from runtime/private state, and migrate only what belongs in APC.
23
+ If it exists, open with this offer before answering anything else:
24
+
25
+ > I see this project was initialized with Agent Project Context (APC).
26
+ >
27
+ > I found context files that may need migration:
28
+ > [list files from .apc/migrate.md]
29
+ >
30
+ > I can read them, separate durable project context from runtime/private state, and migrate only
31
+ > what belongs in APC.
32
+ >
33
+ > Want me to start?
25
34
 
26
35
  If the user says no or later, delete `.apc/migrate.md` so the offer is not repeated.
27
36
 
28
37
  ## Migration rule: think, do not copy
29
38
 
39
+ Read detected files first. Also read `AGENTS.md` if it exists.
40
+
30
41
  Classify content:
31
42
 
32
43
  | Content | Action |
33
44
  |---|---|
34
- | Agent definitions: role, model, skills, description | Put in `.apc/agents/<slug>.md` and/or `AGENTS.md` |
45
+ | Agent definitions: name, model, description | Put in `.apc/agents/<name>.md` and/or `AGENTS.md` |
35
46
  | Shared project rules, stack notes, commands, testing policy | Keep in `AGENTS.md` |
36
47
  | Reusable instruction blocks | Move to `.apc/skills/<name>.md` |
37
- | Durable safe facts useful to all contributors | Add to `.apc/agents/<slug>/memory.md` only after curation |
48
+ | Durable safe facts useful to all contributors | Add to `.apc/agents/<name>/memory.md` only after curation |
38
49
  | MCP expectations without secrets | Add to `.apc/mcps.json` |
39
50
  | Raw sessions, transcripts, conversations, messages, tool logs | Do not move into `.apc/`; leave with source runtime |
40
51
  | Secrets, tokens, credentials, private headers | Do not store in repository |
41
52
  | IDE UI settings or personal aliases | Leave in IDE/user config |
42
53
  | Instructions to store sessions under `.apc/` | Drop as obsolete |
43
54
 
55
+ After migration:
56
+
57
+ 1. Update `AGENTS.md` as the root project contract.
58
+ 2. Create or update `.apc/agents/`, `.apc/skills/`, `.apc/mcps.json` as needed.
59
+ 3. Do not create `.apc/**/sessions`, `.apc/messages`, or `.apc/conversations`.
60
+ 4. Delete obsolete source files only when their useful project context was migrated or intentionally dropped.
61
+ 5. Delete `.apc/migrate.md`.
62
+ 6. Summarize what moved, what stayed local, and what was dropped.
63
+
44
64
  ## APC structure
45
65
 
46
66
  ```text
@@ -48,8 +68,8 @@ AGENTS.md ← root project contract
48
68
  .apc/
49
69
  project.json ← project metadata
50
70
  .gitignore ← safety guard
51
- agents/<slug>.md ← agent definition
52
- agents/<slug>/memory.md ← optional curated project memory
71
+ agents/<name>.md ← agent definition
72
+ agents/<name>/memory.md ← optional curated project memory
53
73
  skills/<name>.md ← reusable project instructions
54
74
  mcps.json ← MCP hints without secrets
55
75
  ```
@@ -57,7 +77,7 @@ AGENTS.md ← root project contract
57
77
  Do not store:
58
78
 
59
79
  ```text
60
- .apc/agents/<slug>/sessions/
80
+ .apc/agents/<name>/sessions/
61
81
  .apc/sessions/
62
82
  .apc/conversations/
63
83
  .apc/messages/
@@ -68,16 +88,41 @@ Do not store:
68
88
  .apc/secrets/
69
89
  ```
70
90
 
91
+ ## Visibility rules
92
+
93
+ | Data | Visibility | Commit? |
94
+ |---|---|---|
95
+ | Agent definitions, skills, project rules | `stable` / `project` | Yes |
96
+ | Curated safe `memory.md` | `project` | Yes, if team-safe |
97
+ | MCP hints without secrets | `project` | Yes |
98
+ | Sessions, conversations, messages | `local` | No; runtime-owned |
99
+ | Secrets, tokens, `*.secret.json`, `*.env` | `private` | Never |
100
+ | Caches, temp files, databases | `ephemeral` | No |
101
+
71
102
  ## Operating rules
72
103
 
73
104
  1. Read `AGENTS.md` and relevant `.apc/` files before assuming project context.
74
- 2. Read agent definitions from `.apc/agents/<slug>.md` when present.
75
- 3. Read curated project memory from `.apc/agents/<slug>/memory.md` when present.
105
+ 2. Read agent definitions from `.apc/agents/<name>.md` when present.
106
+ 3. Read curated project memory from `.apc/agents/<name>/memory.md` when present.
76
107
  4. Write only durable, safe, curated facts to APC memory.
77
108
  5. Never write raw sessions, transcripts, messages, conversations, or tool logs into `.apc/`.
78
109
  6. Keep secrets out of APC and out of git.
79
110
  7. Treat `.apc/mcps.json` as MCP configuration hints, not as an MCP implementation.
80
111
 
112
+ ## Normalization
113
+
114
+ If agent formats are broken or use legacy fields (role, skills in YAML), offer to normalize:
115
+
116
+ ```yaml
117
+ ---
118
+ name: agent-name
119
+ model: inherit
120
+ description: Semantic activation trigger
121
+ ---
122
+ ```
123
+
124
+ Identify and fix inconsistencies in `model` (use technical IDs or `inherit`) and ensure `description` is present for semantic activation.
125
+
81
126
  ## Sessions
82
127
 
83
128
  Sessions belong to the runtime that created them.
@@ -88,23 +133,28 @@ Examples:
88
133
  Codex runtime storage
89
134
  Claude Code runtime storage
90
135
  OpenCode runtime storage
91
- ~/.apx/projects/<project-id>/agents/<slug>/sessions/
136
+ ~/.apx/projects/<project-id>/agents/<name>/sessions/
92
137
  ```
93
138
 
94
139
  At task end, provide the user a concise result. If project memory should be updated, write a short
95
- sanitized fact to `.apc/agents/<slug>/memory.md` only when useful and safe.
140
+ sanitized fact to `.apc/agents/<name>/memory.md` only when useful and safe.
96
141
 
97
142
  ## APX
98
143
 
99
- APX can provide a local daemon, MCP management, Telegram bridge, routines, and runtime dispatch
100
- across Codex, Claude Code, OpenCode, Aider, Cursor Agent, Gemini CLI, Qwen Code, or direct LLM
101
- engines. Those are APX runtime features, not APC portable-core requirements.
144
+ Read `.apc/project.json` if present. It may contain an `apx` field:
102
145
 
103
- The APX super-agent uses `~/.apx/projects/default` for system-level work when no project is named.
104
- APX routines can run heartbeat, shell, Telegram, project agent, or super-agent tasks on a schedule.
146
+ - `"installed"`: APX is available; use `apx` commands when useful.
147
+ - `"declined"`: user chose not to install; do not suggest or run APX.
148
+ - missing or `null`: unknown; do not assume APX is available.
105
149
 
106
- APX runtime state belongs outside the repository:
150
+ If APX is installed, it may manage runtime state outside the repository:
107
151
 
108
152
  ```text
109
153
  ~/.apx/projects/<project-id>/
110
154
  ```
155
+
156
+ APX can provide a local daemon, MCP management, Telegram bridge, routines, and runtime dispatch
157
+ across Codex, Claude Code, OpenCode, Aider, or direct LLM engines. Those are APX runtime features,
158
+ not APC portable-core requirements.
159
+
160
+ Never use APX to write secrets or raw sessions into `.apc/`.
@@ -1,29 +1,34 @@
1
1
  ---
2
2
  name: apx
3
- description: "APX CLI skill. Activate ONLY when the user asks about running agents, coordinating between agents, or explicitly uses apx commands. Provides: apx run, apx exec, apx memory, apx mcp, apx session, apx messages tail. Do NOT activate just because .apc/ exists — project context is handled by the apc-context skill. Activate on: 'apx run', 'apx exec', 'run an agent', 'coordinate agents', 'multi-agent', 'apx memory', 'apx mcp', 'daemon'."
3
+ description: "APX CLI skill. Activate when: user asks to run or coordinate agents, use MCP tools from .apc/mcps.json, install agents from a team workspace, or explicitly mentions apx commands. Do NOT activate just because .apc/ exists — that is handled by the apc-context skill. Activate on: 'apx run', 'apx exec', 'run an agent', 'coordinate agents', 'MCP not working', 'install agent', 'team agents', 'apx memory', 'daemon'."
4
4
  homepage: https://github.com/agentprojectcontext/apx
5
5
  ---
6
6
 
7
7
  # APX — Agent Project Context Runtime
8
8
 
9
- This project uses **APX**. The daemon runs on `127.0.0.1:7430` and auto-starts on first `apx` call.
10
- Your current session, project, and agent are already injected above this block — refer to them.
9
+ The daemon runs on `127.0.0.1:7430` and auto-starts on first `apx` call.
11
10
 
12
- APX runtime state belongs outside `.apc/`, under `~/.apx/projects/<project-id>/`.
11
+ APX reads APC project context from `.apc/`, but APX runtime state belongs outside the repository
12
+ under `~/.apx/projects/<project-id>/`.
13
+
14
+ The APX super-agent has an always-available default workspace at `~/.apx/projects/default`.
15
+ When no project is named, system-level work belongs there.
13
16
 
14
17
  ---
15
18
 
16
- ## Discover the project
19
+ ## Coordinate with other agents
17
20
 
18
- ```bash
19
- apx agent list # agents in AGENTS.md + their roles/models
20
- apx mcp list # MCP servers available to this project
21
- ```
21
+ **First: can you spawn a subagent natively in this IDE?**
22
22
 
23
- ## Coordinate with other agents
23
+ If yes do that. No APX needed. Claude Code, Cursor, and other IDEs can spawn subagents directly using your current context.
24
+
25
+ Use `apx run` only when:
26
+ - The user explicitly asks to run the agent in a specific external runtime ("run this in Codex", "run the QA agent outside this session")
27
+ - You need to run an agent in a runtime different from the one you're in
28
+ - You're orchestrating from outside any IDE (e.g. a script, Telegram bot, CI)
24
29
 
25
30
  ```bash
26
- # Full external session (best for complex, multi-step tasks)
31
+ # Run agent in an external runtime full isolated session
27
32
  apx run <slug> --runtime claude-code "<prompt>"
28
33
  apx run <slug> --runtime codex "<prompt>"
29
34
  apx run <slug> --runtime opencode "<prompt>"
@@ -32,54 +37,105 @@ apx run <slug> --runtime cursor-agent "<prompt>"
32
37
  apx run <slug> --runtime gemini-cli "<prompt>"
33
38
  apx run <slug> --runtime qwen-code "<prompt>"
34
39
 
35
- # Quick one-shot LLM call (requires engine API key in ~/.apx/config.json)
40
+ # Example: run the qa agent in codex with a specific task
41
+ apx run qa --runtime codex "run the full test suite and report failures"
42
+ ```
43
+
44
+ The output is the agent's full stdout. If it printed `APC_RESULT: <value>`, that value is captured as structured output.
45
+
46
+ ```bash
47
+ # Quick one-shot LLM call (no external CLI needed, uses ~/.apx/config.json engine key)
36
48
  apx exec <slug> "<prompt>"
37
49
  ```
38
50
 
39
- The output of `apx run` / `apx exec` is the agent's full stdout.
40
- If the agent printed `APC_RESULT: <value>`, that value is also captured as structured output.
51
+ ## Command accuracy
52
+
53
+ Do not invent APX subcommands. Before telling another runtime to call APX, verify the exact CLI
54
+ form with `apx --help` or `apx <command> --help`.
55
+
56
+ Known Telegram form:
57
+
58
+ ```bash
59
+ apx telegram status
60
+ apx telegram send "message"
61
+ apx telegram send "message" --chat 123456
62
+ ```
63
+
64
+ Do not use guessed aliases such as `apx send-telegram` or `apx telegram "message"` unless current
65
+ `apx --help` shows that exact form.
41
66
 
42
- ## Memory — durable, safe facts
67
+ ## MCP tools
68
+
69
+ MCPs declared in `.apc/mcps.json` are proxied through the APX daemon. Use `apx mcp` only for MCPs registered there — not for MCPs that are already running locally in your IDE session.
70
+
71
+ ```bash
72
+ apx mcp list # MCPs registered in .apc/mcps.json
73
+ apx mcp tools <server> # tools a server exposes
74
+ apx mcp run <server> <tool> '<json>' # call a tool
75
+
76
+ # Example:
77
+ apx mcp tools filesystem
78
+ apx mcp run filesystem read_file '{"path": "README.md"}'
79
+ ```
80
+
81
+ ## Memory
82
+
83
+ Write memory only for durable, safe project facts. Do not store raw transcripts or secrets.
43
84
 
44
85
  ```bash
45
86
  apx memory <slug> # read agent's memory.md
46
- apx memory <slug> --append "<fact>" # append a durable note (non-destructive)
87
+ apx memory <slug> --append "<fact>" # append a durable note
47
88
  apx memory <slug> --replace < file.md # replace entire memory from stdin
48
89
  ```
49
90
 
50
- Write to memory only when you discover safe project context the agent should know on future runs.
91
+ ## Sessions
92
+
93
+ Sessions are APX runtime state. They do not belong in `.apc/`.
94
+
95
+ ```bash
96
+ apx session new <slug> --title "What you did" # create APX local session file
97
+ apx session list <slug> # list sessions
98
+ apx session check # exits 1 if session already active
99
+ ```
51
100
 
52
101
  ## Observe activity
53
102
 
54
103
  ```bash
55
- apx messages tail # last 50 messages, all channels
56
- apx messages tail --channel runtime # only agent invocations (in/out)
57
- apx messages tail --channel telegram # Telegram conversation history
104
+ apx messages tail # last 50 messages, all channels
105
+ apx messages chat --channel telegram -n 20 # chat view with user/agent/system type
106
+ apx messages tail --channel runtime # only agent invocations
58
107
  apx messages tail --agent <slug> -n 20
59
- apx session list <slug> # sessions for a specific agent
60
108
  ```
61
109
 
62
- ## MCP tools
110
+ Message rows expose `type` (`user`, `agent`, `tool`, `system`) and `actor_id`; use `messages chat`
111
+ when you need a readable transcript.
112
+
113
+ ## APX tool permissions
63
114
 
64
115
  ```bash
65
- apx mcp list # registered MCP servers
66
- apx mcp tools <server> # list tools a server exposes
67
- apx mcp run <server> <tool> '<json>' # call a tool directly
116
+ apx permission show
117
+ apx permission set automatico # total | automatico | permiso
68
118
  ```
69
119
 
70
- ## Anti-collision guard
120
+ `automatico` runs read/list/safe shell checks directly and asks before destructive shell, MCP,
121
+ runtime, outbound, config, or filesystem mutation actions.
122
+
123
+ ## Routines
71
124
 
72
- Before starting a long task, prevent duplicate runs:
73
125
  ```bash
74
- apx session check # exits 1 if a session is already active for this agent
126
+ apx routine list
127
+ apx routine get <name>
128
+ apx routine history <name>
129
+ apx routine add clima --kind super_agent --schedule every:5m \
130
+ --permission-mode total \
131
+ --spec '{"prompt":"Check weather and send Telegram update."}'
75
132
  ```
76
133
 
77
- ## APC_RESULT how to signal your return value
134
+ Routine kinds: `heartbeat`, `exec_agent`, `super_agent`, `telegram`, `shell`.
135
+
136
+ ## APC_RESULT
78
137
 
79
- Print this on the last meaningful line of your output:
138
+ Print on the last meaningful line of your output so the invoker captures it:
80
139
  ```
81
140
  APC_RESULT: <one-line summary or value>
82
141
  ```
83
- The invoker (`apx run`, super-agent, Telegram bot) captures it as structured output.
84
- Keep it factual and short. It becomes the session result stored in APX local runtime state, not
85
- inside `.apc/`.