arcane-cli 0.14.0 → 0.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.
Files changed (65) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +253 -253
  3. package/dist/assets/.arcane/agents/agent-policies-template.md +414 -414
  4. package/dist/assets/.arcane/governance/agent-policies.md +414 -414
  5. package/dist/assets/.arcane/governance/agent-work-queue-model.md +61 -61
  6. package/dist/assets/.arcane/governance/cicd-standards.md +227 -227
  7. package/dist/assets/.arcane/governance/development-methodology.md +384 -384
  8. package/dist/assets/.arcane/governance/git-conventions.md +759 -759
  9. package/dist/assets/.arcane/governance/naming-conventions.md +142 -142
  10. package/dist/assets/.arcane/governance/new-business-setup.md +182 -182
  11. package/dist/assets/.arcane/governance/portable-bootstrap.md +101 -101
  12. package/dist/assets/.arcane/governance/product-excellence-standards.md +211 -211
  13. package/dist/assets/.arcane/governance/testing-standards.md +158 -158
  14. package/dist/assets/.arcane/governance/universal-agent-rules.md +108 -108
  15. package/dist/assets/.arcane/image-prompts/adelaide-image-prompt.md +140 -140
  16. package/dist/assets/.arcane/image-prompts/alexander-image-prompt.md +138 -138
  17. package/dist/assets/.arcane/image-prompts/bess-image-prompt.md +139 -139
  18. package/dist/assets/.arcane/image-prompts/circe-image-prompt.md +143 -143
  19. package/dist/assets/.arcane/image-prompts/custodio-image-prompt.md +140 -140
  20. package/dist/assets/.arcane/image-prompts/iris-image-prompt.md +139 -139
  21. package/dist/assets/.arcane/image-prompts/kellar-image-prompt.md +141 -141
  22. package/dist/assets/.arcane/image-prompts/lafayette-image-prompt.md +140 -140
  23. package/dist/assets/.arcane/image-prompts/lince-image-prompt.md +142 -142
  24. package/dist/assets/.arcane/image-prompts/mercurio-image-prompt.md +140 -140
  25. package/dist/assets/.arcane/image-prompts/merlin-image-prompt.md +139 -139
  26. package/dist/assets/.arcane/image-prompts/prospero-image-prompt.md +141 -141
  27. package/dist/assets/.claude/commands/spell-enchant.md +9 -9
  28. package/dist/assets/.github/agents/adelaide.agent.md +44 -44
  29. package/dist/assets/.github/agents/alexander.agent.md +43 -43
  30. package/dist/assets/.github/agents/bess.agent.md +42 -42
  31. package/dist/assets/.github/agents/circe.agent.md +43 -43
  32. package/dist/assets/.github/agents/custodio.agent.md +44 -44
  33. package/dist/assets/.github/agents/iris.agent.md +43 -43
  34. package/dist/assets/.github/agents/kellar.agent.md +43 -43
  35. package/dist/assets/.github/agents/lafayette.agent.md +42 -42
  36. package/dist/assets/.github/agents/lince.agent.md +43 -43
  37. package/dist/assets/.github/agents/mercurio.agent.md +43 -43
  38. package/dist/assets/.github/agents/merlin.agent.md +44 -44
  39. package/dist/assets/.github/agents/prospero.agent.md +43 -43
  40. package/dist/assets/.github/prompts/spell-close-session.prompt.md +17 -5
  41. package/dist/assets/.github/prompts/spell-commit-work.prompt.md +24 -6
  42. package/dist/assets/.github/prompts/spell-create-pull-request.prompt.md +12 -3
  43. package/dist/assets/.github/prompts/spell-enchant.prompt.md +385 -385
  44. package/dist/assets/.github/prompts/spell-feedback.prompt.md +113 -113
  45. package/dist/assets/.github/prompts/spell-full-cycle.prompt.md +202 -201
  46. package/dist/assets/.github/prompts/spell-implement.prompt.md +101 -101
  47. package/dist/assets/.github/prompts/spell-open-session.prompt.md +20 -5
  48. package/dist/assets/.github/prompts/spell-scope.prompt.md +263 -263
  49. package/dist/assets/agents/architecture-lead.yaml +61 -61
  50. package/dist/assets/agents/collaborator.yaml +59 -59
  51. package/dist/assets/agents/devops.yaml +60 -60
  52. package/dist/assets/agents/frontend-dev.yaml +60 -60
  53. package/dist/assets/agents/fullstack-dev.yaml +59 -59
  54. package/dist/assets/agents/marketing-strategist.yaml +60 -60
  55. package/dist/assets/agents/mobile-dev.yaml +59 -59
  56. package/dist/assets/agents/operations-comms.yaml +58 -58
  57. package/dist/assets/agents/orchestrator.yaml +60 -60
  58. package/dist/assets/agents/qa-lead.yaml +60 -60
  59. package/dist/assets/agents/research-analyst.yaml +59 -59
  60. package/dist/assets/agents/security-ops.yaml +61 -61
  61. package/dist/index.js +323 -7
  62. package/dist/index.js.map +1 -1
  63. package/package.json +72 -72
  64. package/dist/assets/.claude/commands/spell-eas-ios-deploy.md +0 -9
  65. package/dist/assets/.github/prompts/spell-eas-ios-deploy.prompt.md +0 -183
@@ -1,414 +1,414 @@
1
- ---
2
- title: Agent Policies
3
- audience: both
4
- status: active
5
- distributable: true
6
- tags: [agent, policy, security]
7
- ---
8
-
9
- # Agent Policies
10
-
11
- Defines what agents are and are not authorized to do when operating in this environment.
12
-
13
- ## Executive Summary
14
-
15
- - Agents are constrained operational tools, not autonomous business decision-makers.
16
- - The baseline model is least privilege: non-root execution, scoped workspace, and explicit prohibited actions.
17
- - A hardening backlog defines the path from baseline safeguards to production-grade controls.
18
- - Use this file as the normative policy reference for agent behavior boundaries.
19
-
20
- ---
21
-
22
- ## Execution Model
23
-
24
- Agents run inside an agent runtime (your orchestrator) that mediates model inference, tool access, and inter-agent coordination. Agent autonomy is governed by per-agent, per-repo power levels (see the power-level matrix below).
25
-
26
- | Property | Generic Baseline |
27
- | --------------------- | ------------------------------------------------------------------------- |
28
- | Runs as | A dedicated non-root user — **never root** |
29
- | Model inference | Provider-agnostic; configure one or more model providers as needed |
30
- | Tools profile | Scoped to the minimum needed (e.g. shell, file read/write, web fetch) |
31
- | Agent workspaces | Each agent gets an isolated workspace directory |
32
- | Agent-to-agent | Orchestrators may spawn subagents; specialist/leaf agents may not |
33
- | Conversation scope | Isolated per-channel/peer conversation contexts |
34
-
35
- > **Supported clients (examples):** the runtime may front a variety of agent clients — GitHub Copilot, Claude Code, Codex, and others. Do not assume a single deployment; configure for the clients you actually use.
36
-
37
- ---
38
-
39
- ## Per-Repo Power Level Matrix
40
-
41
- Agent autonomy is gamified into ascending power levels. Each level grants broader authority:
42
-
43
- | Level | Authority |
44
- | --------- | -------------------------------------------------------------------------- |
45
- | Spectator | Human-only. No autonomous action (e.g. repo creation). |
46
- | Apprentice | Read and propose; changes queued for human merge. |
47
- | Wizard | Scoped autonomous edits in approved paths; PRs queued for review. |
48
- | Sorcerer | Autonomous topic-branch work; PRs queued for review. |
49
- | Magus | Self-merge within approved scope (fast-forward only). |
50
- | Archmage | Broadest autonomous authority within an approved repo. |
51
-
52
- Assign a default power level per agent × per repo. Human approval and commit governance still apply in interactive sessions.
53
-
54
- **Notes:**
55
-
56
- - Repo creation remains Spectator-level (human only), regardless of an agent's assigned power level.
57
- - Grant the lowest level that lets an agent do its job; promote only after an autonomous fix-verify loop is validated for that agent.
58
-
59
- ---
60
-
61
- ## Agent-to-Agent Topology
62
-
63
- Spawn rights are configured per agent. Use a small number of orchestrators; keep most agents as leaf nodes that cannot spawn subagents.
64
-
65
- - **Orchestrators** delegate work to specialists and aggregate their results.
66
- - **Leaf nodes** perform a single role (development, QA, research, comms) and report results upward; they cannot spawn subagents.
67
- - Promote a leaf to an orchestrator only once its autonomous behavior is validated.
68
-
69
- ---
70
-
71
- ## MCP Integration
72
-
73
- Agents may integrate external tools and services through MCP (Model Context Protocol) servers.
74
-
75
- **Permission model:** Keep write operations in an approve-all (human-approval) mode. Unattended write calls should fail closed (deny) rather than execute silently.
76
-
77
- **Per-agent scoping:** Where the runtime cannot scope MCP servers per agent, enforce boundaries through spawn rights (orchestrators control task assignment) and filesystem scope (see the approved-paths registry for your deployment).
78
-
79
- **Access boundaries:** An agent may be intentionally denied access to one org/service while retaining access to another (a least-privilege split). Verify the split behaves as expected — the denied target should return an unauthorized error.
80
-
81
- **MCP change control rule:** Never enable a fully automatic write mode. Adding a new MCP server (new org, new service, new auth pattern) is a **Medium**-risk change — it requires explicit approval and a recorded decision if it changes the agent's reachable network surface.
82
-
83
- ---
84
-
85
- ## Guiding Principle
86
-
87
- An agent is operational infrastructure. It executes defined tasks. It does not make business decisions, handle financial transactions without explicit approval, or access systems outside its defined scope.
88
-
89
- ---
90
-
91
- ## Remote Change Control
92
-
93
- When agents can be driven through remote channels (chat, messaging, CLI, IDE), apply the same governance quality expected in interactive editor sessions.
94
-
95
- ### Role Split (Default)
96
-
97
- - A front-door orchestrator captures and triages remote requests.
98
- - A designated privileged executor handles high-risk runtime/config changes.
99
- - The orchestrator may execute low-risk documentation-only updates directly in approved paths.
100
-
101
- ### Required Workflow
102
-
103
- Every remote environment change follows this sequence:
104
-
105
- 1. **Request capture** — restate the requested change and intended outcome.
106
- 2. **Risk class assignment** — classify as low/medium/high before execution.
107
- 3. **Approval gate** — obtain explicit human approval before apply.
108
- 4. **Pre-change backup** — snapshot relevant config/artifacts before mutation.
109
- 5. **Apply** — execute the scoped change (delegate high-risk to the privileged executor).
110
- 6. **Verify** — run deterministic checks and report results.
111
- 7. **Document** — update canonical docs (policy/runbook/journal/TODO/decisions as needed).
112
- 8. **Commit proposal** — prepare a commit message and request explicit approval.
113
-
114
- ### Risk Classes
115
-
116
- | Class | Examples | Executor |
117
- | ------ | ----------------------------------------------------------------------------------------- | --------------------------------------------- |
118
- | Low | Doc-only updates, journal entries, decision/TODO edits, read-only diagnostics | Orchestrator |
119
- | Medium | Runtime policy edits, channel allowlist changes, agent routing updates | Orchestrator, with explicit approval |
120
- | High | Auth boundary changes, gateway security settings, privileged tool-scope expansion | Privileged executor (delegated), then reported back |
121
-
122
- ### Evidence Requirements (Remote Sessions)
123
-
124
- Each completed remote change should preserve traceability by recording:
125
-
126
- - request and session identifiers
127
- - channel
128
- - acting agent and delegated executor (if any)
129
- - change scope and risk class
130
- - approver identity and timestamp
131
- - backup reference
132
- - verification outcome
133
- - rollback reference
134
- - links to updated docs and the proposed/approved commit
135
-
136
- When evidence cannot be captured in a single step, queue a TODO immediately and mark the change as partially complete.
137
-
138
- ### Commit Hygiene for Remote Changes
139
-
140
- - **Author identity:** commits are authored under the human owner's identity ({OPERATOR_EMAIL}).
141
- - **Agent identity:** record the acting agent ({AGENT_NAME}) and the model/provider used.
142
- - Use Conventional Commits format: `type(scope): description`.
143
- - Show the full proposed commit and obtain approval before executing `git commit`.
144
-
145
- ---
146
-
147
- ## Autonomy Behavior: Discover-Then-Escalate (In-Scope Only)
148
-
149
- To reduce friction without weakening security, agents must follow this behavior when asked to inspect code:
150
-
151
- 1. If the requested repo/path is under an approved root, attempt read-only discovery first.
152
- 2. Use non-destructive checks (`ls`, `find`, file reads, git metadata reads) inside approved roots.
153
- 3. Only request operator clarification after in-scope discovery fails.
154
- 4. Never probe paths outside approved roots.
155
-
156
- **Intent:** fail-closed on boundaries, but avoid unnecessary "no access" responses for already-approved locations.
157
-
158
- ---
159
-
160
- ## Repo Context Bootstrap Requirement
161
-
162
- Before meaningful autonomous work in any newly cloned repo, agents must verify context artifacts exist (or create a task to add them):
163
-
164
- - `README.md` (or equivalent project orientation)
165
- - `CLAUDE.md` and/or `.github/copilot-instructions.md` (agent instruction surface)
166
- - Any project-local contribution/architecture guidance docs
167
-
168
- ---
169
-
170
- ## Actionable Recommendation Policy
171
-
172
- Any recommendation that could lead to a **monetary cost, account creation, subscription, purchase, license, or irreversible action** must follow these guardrails.
173
-
174
- ### Classification
175
-
176
- | Tier | Trigger | Requirement |
177
- | ----------------- | -------------------------------------------------------------------------------------------------------- | --------------------------------------------- |
178
- | **Informational** | No cost or commitment implied | None — provide the recommendation normally |
179
- | **Actionable** | Could lead to spending money, creating accounts, signing up for services, or making irreversible changes | Apply all guardrails below |
180
- | **High-Stakes** | Significant cost (>$50), long-term contracts, or decisions that are difficult to reverse | Apply guardrails + explicit confirmation gate |
181
-
182
- ### Guardrails for Actionable & High-Stakes Recommendations
183
-
184
- 1. **Flag it explicitly.** State clearly: _"This recommendation would involve a purchase/subscription/commitment."_ Never let a recommendation lead to a spending decision without the operator knowing.
185
-
186
- 2. **Verify before recommending.** When evaluating real-world tools, products, or services:
187
- - Use current, verifiable information — **never assume** capabilities, pricing, or features.
188
- - If unable to verify, say so: _"I cannot confirm the current state of [X] — verify before purchasing."_
189
- - Never fabricate product comparisons or capability rankings from stale training data.
190
-
191
- 3. **Present alternatives including free/no-cost options.** Always include at least one zero-cost alternative when one exists.
192
-
193
- 4. **State confidence level.** If the recommendation is based on general knowledge rather than verified current data, say so explicitly: _"Based on general knowledge (not verified as of today)."_
194
-
195
- 5. **Confirmation gate for High-Stakes.** For >$50 or contract commitments, require explicit operator confirmation before proceeding. Format:
196
-
197
- > ⚠️ **This would involve [cost/commitment].** Alternatives: [list]. Confirm before proceeding.
198
-
199
- 6. **Consider downstream implications.** Before recommending any tool, service, or approach, evaluate:
200
- - Does this require a paid subscription or license?
201
- - Is there a free tier or alternative that achieves the same goal?
202
- - Is this reversible if it doesn't work out?
203
- - What is the operator likely to do with this recommendation?
204
-
205
- ### What This Means in Practice
206
-
207
- - Recommending a paid image-generation service over one the operator already has access to? **Flag the cost and name the no-additional-cost alternative.**
208
- - Suggesting an npm package vs a built-in solution? Informational — no cost gate needed.
209
- - Recommending a cloud service tier? **High-Stakes** — present pricing, alternatives, and require confirmation.
210
-
211
- ---
212
-
213
- ## Permitted Actions
214
-
215
- Permitted actions are agent- and deployment-specific. As a baseline, an agent may:
216
-
217
- - Read and write within its own approved workspace.
218
- - Generate content (listings, copy, documentation) for human review.
219
- - Read and write to designated business data directories when explicitly configured.
220
- - Read, flag, and queue operational workflows — never execute irreversible actions (fulfillment, publishing, payment) without approval.
221
-
222
- Define the concrete permitted-actions list per agent in that agent's configuration.
223
-
224
- ---
225
-
226
- ## Prohibited Actions
227
-
228
- - Executing commands with root/elevated privileges (agents run as a dedicated non-root user).
229
- - Accessing any directory outside the agent's designated scope.
230
- - Making financial transactions without explicit human approval.
231
- - Accessing credential stores or password managers.
232
- - Sending external communications (email, social posts) without a human review queue.
233
- - Modifying security-relevant configuration without human approval.
234
- - Using personal Git credentials or SSH keys — agents must use scoped, dedicated credentials.
235
-
236
- ---
237
-
238
- ## Escalation Rules
239
-
240
- If an agent encounters a situation outside its defined parameters, it should:
241
-
242
- 1. Stop the current action.
243
- 2. Log the situation with full context.
244
- 3. Queue for human review.
245
- 4. Not attempt to resolve ambiguity autonomously.
246
-
247
- ---
248
-
249
- ## Branch Discipline
250
-
251
- **Agents must never commit directly to main.** All work happens on topic branches. This prevents collisions when multiple agents or human operators work in parallel.
252
-
253
- **Required workflow for all agents:**
254
-
255
- 1. **Create a topic branch** before making any changes:
256
-
257
- ```bash
258
- git checkout -b {your-slug}/type/short-description origin/main
259
- ```
260
-
261
- Example: `lafayette/feat/api-endpoint`, `merlin/docs/architecture-update`
262
-
263
- 2. **Commit** with proper attribution (author identity + required trailers per your git conventions).
264
-
265
- 3. **Sync with main before opening a PR** — always fetch and rebase on the latest `origin/main` before pushing or creating a PR, even if you think no one else has merged:
266
-
267
- ```bash
268
- git fetch origin
269
- git rebase origin/main
270
- # If conflicts arise: resolve each file → git add <file> → git rebase --continue
271
- # If rebase is unrecoverable: git rebase --abort, report to operator
272
- ```
273
-
274
- **Rule:** Never open a PR against a base that is ahead of your branch. Never push a branch with unresolved conflicts. Resolve locally — the PR must be clean and CI-green before review.
275
-
276
- 4. **Push the branch** to origin (after rebase).
277
-
278
- 5. **Merge or queue** based on your power level:
279
- - **Magus+ power level:** self-merge via `git merge --ff-only`, push main, delete branch.
280
- - **Below Magus:** push the branch, report the branch name, and queue for human merge.
281
-
282
- 6. **Delete the branch** (local and remote) after merge.
283
-
284
- **Branch naming format:** `{agent-slug}/type/short-description`
285
-
286
- - The agent-slug prefix makes ownership obvious and prevents naming collisions.
287
- - Use standard commit types: `feat`, `fix`, `docs`, `refactor`, `chore`, etc.
288
-
289
- **What happens if ff-only fails:** Another actor merged to main first. This should not happen if you followed step 3. If it does, rebase and retry:
290
-
291
- ```bash
292
- git fetch origin
293
- git rebase origin/main
294
- git checkout main
295
- git merge --ff-only {your-slug}/type/short-description
296
- ```
297
-
298
- ### Multi-Agent Concurrency Rules
299
-
300
- When more than one agent may work in the same repository simultaneously:
301
-
302
- 1. **One agent per feature branch.** A feature branch is its owner's exclusive territory. No other agent reads from or writes to it without explicit handoff from the operator.
303
- 2. **Feature folders follow branches.** A `features/{id}-{slug}/` directory is owned by the agent whose branch name contains `{id}-{slug}`. Other agents must not modify another agent's active feature folder.
304
- 3. **Stale branch detection.** Before creating a new branch, fetch and check for an existing branch for the same work item; if one exists, report it rather than creating a duplicate.
305
- 4. **Append-only progress logs.** Never overwrite or truncate `features/{id}-{slug}/progress.txt`. Use `>>`, not `>`.
306
- 5. **Story ownership.** Only the agent assigned to a feature modifies that feature's `stories.json`. If the assigned agent does not match your slug, halt and report.
307
- 6. **No cross-repo mutations without coordination.** If a story requires changes in two repos, complete and push one before starting the second. Never hold uncommitted changes across two repos simultaneously.
308
- 7. **Merge window.** When two agents have PRs open for the same repo, the first to merge wins; the second must rebase before merging. The operator coordinates merge order if there are conflicts.
309
-
310
- ---
311
-
312
- ## Planning Artifact Routing Policy
313
-
314
- When producing planning artifacts (PRD, architecture, stories.json, UX specs), agents **must** write outputs to the correct location for their lifecycle stage:
315
-
316
- | Stage | Artifact destination | Example path |
317
- | ----------------------- | --------------------------------------------------- | ----------------------------------------- |
318
- | **Concept / Prototype** | A governed ventures/prototype directory | `ventures/widget-app/PRD.md` |
319
- | **Feature** | `features/{id}-{slug}/` in the **target code repo** | `features/42-calibration/architecture.md` |
320
-
321
- **Never** write planning artifacts to:
322
-
323
- - The agent's own workspace root.
324
- - The root of a code repo (e.g. alongside `src/`).
325
- - Temporary or unversioned locations.
326
-
327
- Planning artifacts are the reproducible source of truth — code can be regenerated from them. They must live in a git-tracked, governed location.
328
-
329
- ---
330
-
331
- ## Repo Routing Rules
332
-
333
- Agents must place artifacts in the correct repository. Misrouting (e.g. code in a docs repo) wastes operator time and pollutes workspaces.
334
-
335
- | Artifact Type | Target Repository | Examples |
336
- | -------------------------------- | --------------------------------------------------------- | ----------------------------------------------- |
337
- | Application code, POCs, features | The appropriate code repo | API endpoints, UI components, tests, migrations |
338
- | Documentation, governance, ADRs | The docs/governance repo | Policies, playbooks, journal entries, decisions |
339
- | Infrastructure-as-code | The infra directory or a dedicated infra repo | Terraform modules, scripts |
340
- | Feature planning artifacts | The repo where the code will live, under `features/{id}-{slug}/` | PRD.md, architecture.md, stories.json |
341
-
342
- **Rules:**
343
-
344
- 1. **Code never goes in the docs repo** unless it is infrastructure-as-code or the feature is explicitly scoped to the docs repo.
345
- 2. **If no existing code repo fits**, the agent must ask the operator to identify or create the target repo. Repo creation is always Spectator-level (human-only).
346
- 3. **Delegation must include the target repo.** When an orchestrator delegates work, the delegation message must specify which repo the work targets. If ambiguous, ask the operator before delegating.
347
- 4. **POC code** without a permanent home should go in an operator-designated repo or a new repo — never in the docs repo by default.
348
-
349
- ---
350
-
351
- ## PR Notification & Hygiene
352
-
353
- Agents creating pull requests must ensure the operator is aware and that PRs do not accumulate unreviewed.
354
-
355
- ### PR Creation Requirements
356
-
357
- 1. **Work item linking is encouraged** for traceability; for small ops/doc PRs it may be omitted.
358
- 2. **PR title** follows Conventional Commits format: `type(scope): description`.
359
- 3. **PR description** must include: summary of changes, rationale, verification steps, and any linked work item ID.
360
-
361
- ### PR Notification
362
-
363
- When an agent creates or updates a PR, notify the operator (routed through the orchestrator) with: repo name, PR link, work item ID (if any), and a one-line summary.
364
-
365
- ### PR Hygiene Cadence
366
-
367
- - **At the start of every session:** list all open PRs across repos; flag PRs older than 3 days as stale.
368
- - **7-day threshold:** PRs open longer than 7 days without activity are flagged for closure. The operator decides whether to merge, update, or abandon.
369
- - **After merge:** the merging actor (agent or human) deletes the source branch (local and remote).
370
-
371
- ---
372
-
373
- ## Hardening Baseline (Policy)
374
-
375
- This section defines the minimum hardening policy baseline for production operations. It is normative for runbooks and future automation.
376
-
377
- ### Execution Restriction Baseline
378
-
379
- Agents must not execute command classes that can escalate privileges, alter host security posture, or exfiltrate credentials.
380
-
381
- **Deny classes:**
382
-
383
- - Privilege escalation commands (e.g. `sudo`, `su`, root shell pivots).
384
- - Direct host package-manager mutation without explicit approval.
385
- - Kernel/network control-plane changes (firewall, sysctl, host service management).
386
- - Credential/file scraping patterns targeting SSH keys, browser stores, password vaults, or shell history.
387
- - Destructive filesystem operations outside approved workspace roots.
388
-
389
- **Allow by default:**
390
-
391
- - Read operations and non-destructive edits inside approved workspace roots.
392
- - Project-local tooling needed for business workflows under approved directories.
393
-
394
- ### Filesystem Scope Baseline
395
-
396
- - Each agent has a default writable workspace root.
397
- - Additional writable roots require explicit per-deployment approval and must be documented in agent config.
398
- - Paths outside approved roots are read-deny and write-deny by policy.
399
- - Cross-business writes are denied unless a shared integration directory is explicitly approved.
400
-
401
- ### Generic Runtime Hardening Principles
402
-
403
- Regardless of the specific runtime, apply these timeless controls:
404
-
405
- - **Run the agent as a non-root user.** Never grant the runtime root privileges.
406
- - **Limit network exposure.** Bind gateways to loopback or a private network; do not expose them publicly. Authenticate any remote access with a token sourced from a secret reference, never a literal.
407
- - **Scope filesystem access.** Restrict the runtime to its workspace and config directories; lock down config-file permissions so only the owning user can read them.
408
- - **Enforce strict channel policies in production.** Replace permissive test values (open DM policy, wildcard allowlists) with pairing/allowlist policies before going live.
409
- - **Deny self-modification.** Prevent agents from editing their own runtime configuration.
410
- - **Keep secrets out of the command line.** Use secret references (environment variables) and interactive prompts that do not echo.
411
-
412
- ---
413
-
414
- _Expand with specific allow/deny lists as agents are created for each deployment._
1
+ ---
2
+ title: Agent Policies
3
+ audience: both
4
+ status: active
5
+ distributable: true
6
+ tags: [agent, policy, security]
7
+ ---
8
+
9
+ # Agent Policies
10
+
11
+ Defines what agents are and are not authorized to do when operating in this environment.
12
+
13
+ ## Executive Summary
14
+
15
+ - Agents are constrained operational tools, not autonomous business decision-makers.
16
+ - The baseline model is least privilege: non-root execution, scoped workspace, and explicit prohibited actions.
17
+ - A hardening backlog defines the path from baseline safeguards to production-grade controls.
18
+ - Use this file as the normative policy reference for agent behavior boundaries.
19
+
20
+ ---
21
+
22
+ ## Execution Model
23
+
24
+ Agents run inside an agent runtime (your orchestrator) that mediates model inference, tool access, and inter-agent coordination. Agent autonomy is governed by per-agent, per-repo power levels (see the power-level matrix below).
25
+
26
+ | Property | Generic Baseline |
27
+ | --------------------- | ------------------------------------------------------------------------- |
28
+ | Runs as | A dedicated non-root user — **never root** |
29
+ | Model inference | Provider-agnostic; configure one or more model providers as needed |
30
+ | Tools profile | Scoped to the minimum needed (e.g. shell, file read/write, web fetch) |
31
+ | Agent workspaces | Each agent gets an isolated workspace directory |
32
+ | Agent-to-agent | Orchestrators may spawn subagents; specialist/leaf agents may not |
33
+ | Conversation scope | Isolated per-channel/peer conversation contexts |
34
+
35
+ > **Supported clients (examples):** the runtime may front a variety of agent clients — GitHub Copilot, Claude Code, Codex, and others. Do not assume a single deployment; configure for the clients you actually use.
36
+
37
+ ---
38
+
39
+ ## Per-Repo Power Level Matrix
40
+
41
+ Agent autonomy is gamified into ascending power levels. Each level grants broader authority:
42
+
43
+ | Level | Authority |
44
+ | --------- | -------------------------------------------------------------------------- |
45
+ | Spectator | Human-only. No autonomous action (e.g. repo creation). |
46
+ | Apprentice | Read and propose; changes queued for human merge. |
47
+ | Wizard | Scoped autonomous edits in approved paths; PRs queued for review. |
48
+ | Sorcerer | Autonomous topic-branch work; PRs queued for review. |
49
+ | Magus | Self-merge within approved scope (fast-forward only). |
50
+ | Archmage | Broadest autonomous authority within an approved repo. |
51
+
52
+ Assign a default power level per agent × per repo. Human approval and commit governance still apply in interactive sessions.
53
+
54
+ **Notes:**
55
+
56
+ - Repo creation remains Spectator-level (human only), regardless of an agent's assigned power level.
57
+ - Grant the lowest level that lets an agent do its job; promote only after an autonomous fix-verify loop is validated for that agent.
58
+
59
+ ---
60
+
61
+ ## Agent-to-Agent Topology
62
+
63
+ Spawn rights are configured per agent. Use a small number of orchestrators; keep most agents as leaf nodes that cannot spawn subagents.
64
+
65
+ - **Orchestrators** delegate work to specialists and aggregate their results.
66
+ - **Leaf nodes** perform a single role (development, QA, research, comms) and report results upward; they cannot spawn subagents.
67
+ - Promote a leaf to an orchestrator only once its autonomous behavior is validated.
68
+
69
+ ---
70
+
71
+ ## MCP Integration
72
+
73
+ Agents may integrate external tools and services through MCP (Model Context Protocol) servers.
74
+
75
+ **Permission model:** Keep write operations in an approve-all (human-approval) mode. Unattended write calls should fail closed (deny) rather than execute silently.
76
+
77
+ **Per-agent scoping:** Where the runtime cannot scope MCP servers per agent, enforce boundaries through spawn rights (orchestrators control task assignment) and filesystem scope (see the approved-paths registry for your deployment).
78
+
79
+ **Access boundaries:** An agent may be intentionally denied access to one org/service while retaining access to another (a least-privilege split). Verify the split behaves as expected — the denied target should return an unauthorized error.
80
+
81
+ **MCP change control rule:** Never enable a fully automatic write mode. Adding a new MCP server (new org, new service, new auth pattern) is a **Medium**-risk change — it requires explicit approval and a recorded decision if it changes the agent's reachable network surface.
82
+
83
+ ---
84
+
85
+ ## Guiding Principle
86
+
87
+ An agent is operational infrastructure. It executes defined tasks. It does not make business decisions, handle financial transactions without explicit approval, or access systems outside its defined scope.
88
+
89
+ ---
90
+
91
+ ## Remote Change Control
92
+
93
+ When agents can be driven through remote channels (chat, messaging, CLI, IDE), apply the same governance quality expected in interactive editor sessions.
94
+
95
+ ### Role Split (Default)
96
+
97
+ - A front-door orchestrator captures and triages remote requests.
98
+ - A designated privileged executor handles high-risk runtime/config changes.
99
+ - The orchestrator may execute low-risk documentation-only updates directly in approved paths.
100
+
101
+ ### Required Workflow
102
+
103
+ Every remote environment change follows this sequence:
104
+
105
+ 1. **Request capture** — restate the requested change and intended outcome.
106
+ 2. **Risk class assignment** — classify as low/medium/high before execution.
107
+ 3. **Approval gate** — obtain explicit human approval before apply.
108
+ 4. **Pre-change backup** — snapshot relevant config/artifacts before mutation.
109
+ 5. **Apply** — execute the scoped change (delegate high-risk to the privileged executor).
110
+ 6. **Verify** — run deterministic checks and report results.
111
+ 7. **Document** — update canonical docs (policy/runbook/journal/TODO/decisions as needed).
112
+ 8. **Commit proposal** — prepare a commit message and request explicit approval.
113
+
114
+ ### Risk Classes
115
+
116
+ | Class | Examples | Executor |
117
+ | ------ | ----------------------------------------------------------------------------------------- | --------------------------------------------- |
118
+ | Low | Doc-only updates, journal entries, decision/TODO edits, read-only diagnostics | Orchestrator |
119
+ | Medium | Runtime policy edits, channel allowlist changes, agent routing updates | Orchestrator, with explicit approval |
120
+ | High | Auth boundary changes, gateway security settings, privileged tool-scope expansion | Privileged executor (delegated), then reported back |
121
+
122
+ ### Evidence Requirements (Remote Sessions)
123
+
124
+ Each completed remote change should preserve traceability by recording:
125
+
126
+ - request and session identifiers
127
+ - channel
128
+ - acting agent and delegated executor (if any)
129
+ - change scope and risk class
130
+ - approver identity and timestamp
131
+ - backup reference
132
+ - verification outcome
133
+ - rollback reference
134
+ - links to updated docs and the proposed/approved commit
135
+
136
+ When evidence cannot be captured in a single step, queue a TODO immediately and mark the change as partially complete.
137
+
138
+ ### Commit Hygiene for Remote Changes
139
+
140
+ - **Author identity:** commits are authored under the human owner's identity ({OPERATOR_EMAIL}).
141
+ - **Agent identity:** record the acting agent ({AGENT_NAME}) and the model/provider used.
142
+ - Use Conventional Commits format: `type(scope): description`.
143
+ - Show the full proposed commit and obtain approval before executing `git commit`.
144
+
145
+ ---
146
+
147
+ ## Autonomy Behavior: Discover-Then-Escalate (In-Scope Only)
148
+
149
+ To reduce friction without weakening security, agents must follow this behavior when asked to inspect code:
150
+
151
+ 1. If the requested repo/path is under an approved root, attempt read-only discovery first.
152
+ 2. Use non-destructive checks (`ls`, `find`, file reads, git metadata reads) inside approved roots.
153
+ 3. Only request operator clarification after in-scope discovery fails.
154
+ 4. Never probe paths outside approved roots.
155
+
156
+ **Intent:** fail-closed on boundaries, but avoid unnecessary "no access" responses for already-approved locations.
157
+
158
+ ---
159
+
160
+ ## Repo Context Bootstrap Requirement
161
+
162
+ Before meaningful autonomous work in any newly cloned repo, agents must verify context artifacts exist (or create a task to add them):
163
+
164
+ - `README.md` (or equivalent project orientation)
165
+ - `CLAUDE.md` and/or `.github/copilot-instructions.md` (agent instruction surface)
166
+ - Any project-local contribution/architecture guidance docs
167
+
168
+ ---
169
+
170
+ ## Actionable Recommendation Policy
171
+
172
+ Any recommendation that could lead to a **monetary cost, account creation, subscription, purchase, license, or irreversible action** must follow these guardrails.
173
+
174
+ ### Classification
175
+
176
+ | Tier | Trigger | Requirement |
177
+ | ----------------- | -------------------------------------------------------------------------------------------------------- | --------------------------------------------- |
178
+ | **Informational** | No cost or commitment implied | None — provide the recommendation normally |
179
+ | **Actionable** | Could lead to spending money, creating accounts, signing up for services, or making irreversible changes | Apply all guardrails below |
180
+ | **High-Stakes** | Significant cost (>$50), long-term contracts, or decisions that are difficult to reverse | Apply guardrails + explicit confirmation gate |
181
+
182
+ ### Guardrails for Actionable & High-Stakes Recommendations
183
+
184
+ 1. **Flag it explicitly.** State clearly: _"This recommendation would involve a purchase/subscription/commitment."_ Never let a recommendation lead to a spending decision without the operator knowing.
185
+
186
+ 2. **Verify before recommending.** When evaluating real-world tools, products, or services:
187
+ - Use current, verifiable information — **never assume** capabilities, pricing, or features.
188
+ - If unable to verify, say so: _"I cannot confirm the current state of [X] — verify before purchasing."_
189
+ - Never fabricate product comparisons or capability rankings from stale training data.
190
+
191
+ 3. **Present alternatives including free/no-cost options.** Always include at least one zero-cost alternative when one exists.
192
+
193
+ 4. **State confidence level.** If the recommendation is based on general knowledge rather than verified current data, say so explicitly: _"Based on general knowledge (not verified as of today)."_
194
+
195
+ 5. **Confirmation gate for High-Stakes.** For >$50 or contract commitments, require explicit operator confirmation before proceeding. Format:
196
+
197
+ > ⚠️ **This would involve [cost/commitment].** Alternatives: [list]. Confirm before proceeding.
198
+
199
+ 6. **Consider downstream implications.** Before recommending any tool, service, or approach, evaluate:
200
+ - Does this require a paid subscription or license?
201
+ - Is there a free tier or alternative that achieves the same goal?
202
+ - Is this reversible if it doesn't work out?
203
+ - What is the operator likely to do with this recommendation?
204
+
205
+ ### What This Means in Practice
206
+
207
+ - Recommending a paid image-generation service over one the operator already has access to? **Flag the cost and name the no-additional-cost alternative.**
208
+ - Suggesting an npm package vs a built-in solution? Informational — no cost gate needed.
209
+ - Recommending a cloud service tier? **High-Stakes** — present pricing, alternatives, and require confirmation.
210
+
211
+ ---
212
+
213
+ ## Permitted Actions
214
+
215
+ Permitted actions are agent- and deployment-specific. As a baseline, an agent may:
216
+
217
+ - Read and write within its own approved workspace.
218
+ - Generate content (listings, copy, documentation) for human review.
219
+ - Read and write to designated business data directories when explicitly configured.
220
+ - Read, flag, and queue operational workflows — never execute irreversible actions (fulfillment, publishing, payment) without approval.
221
+
222
+ Define the concrete permitted-actions list per agent in that agent's configuration.
223
+
224
+ ---
225
+
226
+ ## Prohibited Actions
227
+
228
+ - Executing commands with root/elevated privileges (agents run as a dedicated non-root user).
229
+ - Accessing any directory outside the agent's designated scope.
230
+ - Making financial transactions without explicit human approval.
231
+ - Accessing credential stores or password managers.
232
+ - Sending external communications (email, social posts) without a human review queue.
233
+ - Modifying security-relevant configuration without human approval.
234
+ - Using personal Git credentials or SSH keys — agents must use scoped, dedicated credentials.
235
+
236
+ ---
237
+
238
+ ## Escalation Rules
239
+
240
+ If an agent encounters a situation outside its defined parameters, it should:
241
+
242
+ 1. Stop the current action.
243
+ 2. Log the situation with full context.
244
+ 3. Queue for human review.
245
+ 4. Not attempt to resolve ambiguity autonomously.
246
+
247
+ ---
248
+
249
+ ## Branch Discipline
250
+
251
+ **Agents must never commit directly to main.** All work happens on topic branches. This prevents collisions when multiple agents or human operators work in parallel.
252
+
253
+ **Required workflow for all agents:**
254
+
255
+ 1. **Create a topic branch** before making any changes:
256
+
257
+ ```bash
258
+ git checkout -b {your-slug}/type/short-description origin/main
259
+ ```
260
+
261
+ Example: `lafayette/feat/api-endpoint`, `merlin/docs/architecture-update`
262
+
263
+ 2. **Commit** with proper attribution (author identity + required trailers per your git conventions).
264
+
265
+ 3. **Sync with main before opening a PR** — always fetch and rebase on the latest `origin/main` before pushing or creating a PR, even if you think no one else has merged:
266
+
267
+ ```bash
268
+ git fetch origin
269
+ git rebase origin/main
270
+ # If conflicts arise: resolve each file → git add <file> → git rebase --continue
271
+ # If rebase is unrecoverable: git rebase --abort, report to operator
272
+ ```
273
+
274
+ **Rule:** Never open a PR against a base that is ahead of your branch. Never push a branch with unresolved conflicts. Resolve locally — the PR must be clean and CI-green before review.
275
+
276
+ 4. **Push the branch** to origin (after rebase).
277
+
278
+ 5. **Merge or queue** based on your power level:
279
+ - **Magus+ power level:** self-merge via `git merge --ff-only`, push main, delete branch.
280
+ - **Below Magus:** push the branch, report the branch name, and queue for human merge.
281
+
282
+ 6. **Delete the branch** (local and remote) after merge.
283
+
284
+ **Branch naming format:** `{agent-slug}/type/short-description`
285
+
286
+ - The agent-slug prefix makes ownership obvious and prevents naming collisions.
287
+ - Use standard commit types: `feat`, `fix`, `docs`, `refactor`, `chore`, etc.
288
+
289
+ **What happens if ff-only fails:** Another actor merged to main first. This should not happen if you followed step 3. If it does, rebase and retry:
290
+
291
+ ```bash
292
+ git fetch origin
293
+ git rebase origin/main
294
+ git checkout main
295
+ git merge --ff-only {your-slug}/type/short-description
296
+ ```
297
+
298
+ ### Multi-Agent Concurrency Rules
299
+
300
+ When more than one agent may work in the same repository simultaneously:
301
+
302
+ 1. **One agent per feature branch.** A feature branch is its owner's exclusive territory. No other agent reads from or writes to it without explicit handoff from the operator.
303
+ 2. **Feature folders follow branches.** A `features/{id}-{slug}/` directory is owned by the agent whose branch name contains `{id}-{slug}`. Other agents must not modify another agent's active feature folder.
304
+ 3. **Stale branch detection.** Before creating a new branch, fetch and check for an existing branch for the same work item; if one exists, report it rather than creating a duplicate.
305
+ 4. **Append-only progress logs.** Never overwrite or truncate `features/{id}-{slug}/progress.txt`. Use `>>`, not `>`.
306
+ 5. **Story ownership.** Only the agent assigned to a feature modifies that feature's `stories.json`. If the assigned agent does not match your slug, halt and report.
307
+ 6. **No cross-repo mutations without coordination.** If a story requires changes in two repos, complete and push one before starting the second. Never hold uncommitted changes across two repos simultaneously.
308
+ 7. **Merge window.** When two agents have PRs open for the same repo, the first to merge wins; the second must rebase before merging. The operator coordinates merge order if there are conflicts.
309
+
310
+ ---
311
+
312
+ ## Planning Artifact Routing Policy
313
+
314
+ When producing planning artifacts (PRD, architecture, stories.json, UX specs), agents **must** write outputs to the correct location for their lifecycle stage:
315
+
316
+ | Stage | Artifact destination | Example path |
317
+ | ----------------------- | --------------------------------------------------- | ----------------------------------------- |
318
+ | **Concept / Prototype** | A governed ventures/prototype directory | `ventures/widget-app/PRD.md` |
319
+ | **Feature** | `features/{id}-{slug}/` in the **target code repo** | `features/42-calibration/architecture.md` |
320
+
321
+ **Never** write planning artifacts to:
322
+
323
+ - The agent's own workspace root.
324
+ - The root of a code repo (e.g. alongside `src/`).
325
+ - Temporary or unversioned locations.
326
+
327
+ Planning artifacts are the reproducible source of truth — code can be regenerated from them. They must live in a git-tracked, governed location.
328
+
329
+ ---
330
+
331
+ ## Repo Routing Rules
332
+
333
+ Agents must place artifacts in the correct repository. Misrouting (e.g. code in a docs repo) wastes operator time and pollutes workspaces.
334
+
335
+ | Artifact Type | Target Repository | Examples |
336
+ | -------------------------------- | --------------------------------------------------------- | ----------------------------------------------- |
337
+ | Application code, POCs, features | The appropriate code repo | API endpoints, UI components, tests, migrations |
338
+ | Documentation, governance, ADRs | The docs/governance repo | Policies, playbooks, journal entries, decisions |
339
+ | Infrastructure-as-code | The infra directory or a dedicated infra repo | Terraform modules, scripts |
340
+ | Feature planning artifacts | The repo where the code will live, under `features/{id}-{slug}/` | PRD.md, architecture.md, stories.json |
341
+
342
+ **Rules:**
343
+
344
+ 1. **Code never goes in the docs repo** unless it is infrastructure-as-code or the feature is explicitly scoped to the docs repo.
345
+ 2. **If no existing code repo fits**, the agent must ask the operator to identify or create the target repo. Repo creation is always Spectator-level (human-only).
346
+ 3. **Delegation must include the target repo.** When an orchestrator delegates work, the delegation message must specify which repo the work targets. If ambiguous, ask the operator before delegating.
347
+ 4. **POC code** without a permanent home should go in an operator-designated repo or a new repo — never in the docs repo by default.
348
+
349
+ ---
350
+
351
+ ## PR Notification & Hygiene
352
+
353
+ Agents creating pull requests must ensure the operator is aware and that PRs do not accumulate unreviewed.
354
+
355
+ ### PR Creation Requirements
356
+
357
+ 1. **Work item linking is encouraged** for traceability; for small ops/doc PRs it may be omitted.
358
+ 2. **PR title** follows Conventional Commits format: `type(scope): description`.
359
+ 3. **PR description** must include: summary of changes, rationale, verification steps, and any linked work item ID.
360
+
361
+ ### PR Notification
362
+
363
+ When an agent creates or updates a PR, notify the operator (routed through the orchestrator) with: repo name, PR link, work item ID (if any), and a one-line summary.
364
+
365
+ ### PR Hygiene Cadence
366
+
367
+ - **At the start of every session:** list all open PRs across repos; flag PRs older than 3 days as stale.
368
+ - **7-day threshold:** PRs open longer than 7 days without activity are flagged for closure. The operator decides whether to merge, update, or abandon.
369
+ - **After merge:** the merging actor (agent or human) deletes the source branch (local and remote).
370
+
371
+ ---
372
+
373
+ ## Hardening Baseline (Policy)
374
+
375
+ This section defines the minimum hardening policy baseline for production operations. It is normative for runbooks and future automation.
376
+
377
+ ### Execution Restriction Baseline
378
+
379
+ Agents must not execute command classes that can escalate privileges, alter host security posture, or exfiltrate credentials.
380
+
381
+ **Deny classes:**
382
+
383
+ - Privilege escalation commands (e.g. `sudo`, `su`, root shell pivots).
384
+ - Direct host package-manager mutation without explicit approval.
385
+ - Kernel/network control-plane changes (firewall, sysctl, host service management).
386
+ - Credential/file scraping patterns targeting SSH keys, browser stores, password vaults, or shell history.
387
+ - Destructive filesystem operations outside approved workspace roots.
388
+
389
+ **Allow by default:**
390
+
391
+ - Read operations and non-destructive edits inside approved workspace roots.
392
+ - Project-local tooling needed for business workflows under approved directories.
393
+
394
+ ### Filesystem Scope Baseline
395
+
396
+ - Each agent has a default writable workspace root.
397
+ - Additional writable roots require explicit per-deployment approval and must be documented in agent config.
398
+ - Paths outside approved roots are read-deny and write-deny by policy.
399
+ - Cross-business writes are denied unless a shared integration directory is explicitly approved.
400
+
401
+ ### Generic Runtime Hardening Principles
402
+
403
+ Regardless of the specific runtime, apply these timeless controls:
404
+
405
+ - **Run the agent as a non-root user.** Never grant the runtime root privileges.
406
+ - **Limit network exposure.** Bind gateways to loopback or a private network; do not expose them publicly. Authenticate any remote access with a token sourced from a secret reference, never a literal.
407
+ - **Scope filesystem access.** Restrict the runtime to its workspace and config directories; lock down config-file permissions so only the owning user can read them.
408
+ - **Enforce strict channel policies in production.** Replace permissive test values (open DM policy, wildcard allowlists) with pairing/allowlist policies before going live.
409
+ - **Deny self-modification.** Prevent agents from editing their own runtime configuration.
410
+ - **Keep secrets out of the command line.** Use secret references (environment variables) and interactive prompts that do not echo.
411
+
412
+ ---
413
+
414
+ _Expand with specific allow/deny lists as agents are created for each deployment._