@radix-ai/ai-memory 0.1.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 (105) hide show
  1. package/.claude-plugin/marketplace.json +19 -0
  2. package/.cursor-plugin/marketplace.json +19 -0
  3. package/LICENSE +21 -0
  4. package/README.md +331 -0
  5. package/dist/cli/adapters.d.ts +32 -0
  6. package/dist/cli/adapters.d.ts.map +1 -0
  7. package/dist/cli/adapters.js +368 -0
  8. package/dist/cli/adapters.js.map +1 -0
  9. package/dist/cli/environment.d.ts +34 -0
  10. package/dist/cli/environment.d.ts.map +1 -0
  11. package/dist/cli/environment.js +119 -0
  12. package/dist/cli/environment.js.map +1 -0
  13. package/dist/cli/index.d.ts +3 -0
  14. package/dist/cli/index.d.ts.map +1 -0
  15. package/dist/cli/index.js +1108 -0
  16. package/dist/cli/index.js.map +1 -0
  17. package/dist/docs-schema.d.ts +27 -0
  18. package/dist/docs-schema.d.ts.map +1 -0
  19. package/dist/docs-schema.js +100 -0
  20. package/dist/docs-schema.js.map +1 -0
  21. package/dist/evals/index.d.ts +13 -0
  22. package/dist/evals/index.d.ts.map +1 -0
  23. package/dist/evals/index.js +205 -0
  24. package/dist/evals/index.js.map +1 -0
  25. package/dist/evals/performance-comparison.d.ts +23 -0
  26. package/dist/evals/performance-comparison.d.ts.map +1 -0
  27. package/dist/evals/performance-comparison.js +76 -0
  28. package/dist/evals/performance-comparison.js.map +1 -0
  29. package/dist/evals/platform-integration.d.ts +34 -0
  30. package/dist/evals/platform-integration.d.ts.map +1 -0
  31. package/dist/evals/platform-integration.js +186 -0
  32. package/dist/evals/platform-integration.js.map +1 -0
  33. package/dist/formatter/index.d.ts +15 -0
  34. package/dist/formatter/index.d.ts.map +1 -0
  35. package/dist/formatter/index.js +207 -0
  36. package/dist/formatter/index.js.map +1 -0
  37. package/dist/hybrid-search/index.d.ts +40 -0
  38. package/dist/hybrid-search/index.d.ts.map +1 -0
  39. package/dist/hybrid-search/index.js +277 -0
  40. package/dist/hybrid-search/index.js.map +1 -0
  41. package/dist/index.d.ts +4 -0
  42. package/dist/index.d.ts.map +1 -0
  43. package/dist/index.js +5 -0
  44. package/dist/index.js.map +1 -0
  45. package/dist/mcp-server/index.d.ts +6 -0
  46. package/dist/mcp-server/index.d.ts.map +1 -0
  47. package/dist/mcp-server/index.js +114 -0
  48. package/dist/mcp-server/index.js.map +1 -0
  49. package/dist/mcp-server/p0-parser.d.ts +43 -0
  50. package/dist/mcp-server/p0-parser.d.ts.map +1 -0
  51. package/dist/mcp-server/p0-parser.js +108 -0
  52. package/dist/mcp-server/p0-parser.js.map +1 -0
  53. package/dist/mcp-server/resources.d.ts +3 -0
  54. package/dist/mcp-server/resources.d.ts.map +1 -0
  55. package/dist/mcp-server/resources.js +156 -0
  56. package/dist/mcp-server/resources.js.map +1 -0
  57. package/dist/mcp-server/tools.d.ts +15 -0
  58. package/dist/mcp-server/tools.d.ts.map +1 -0
  59. package/dist/mcp-server/tools.js +928 -0
  60. package/dist/mcp-server/tools.js.map +1 -0
  61. package/dist/schema-constants.d.ts +7 -0
  62. package/dist/schema-constants.d.ts.map +1 -0
  63. package/dist/schema-constants.js +33 -0
  64. package/dist/schema-constants.js.map +1 -0
  65. package/package.json +84 -0
  66. package/plugins/adapters/claude-code/.claude-plugin/plugin.json +26 -0
  67. package/plugins/adapters/claude-code/CLAUDE.md +21 -0
  68. package/plugins/adapters/claude-code/README.md +37 -0
  69. package/plugins/adapters/claude-code/agents/governance-checker.md +27 -0
  70. package/plugins/adapters/claude-code/agents/memory-writer.md +31 -0
  71. package/plugins/adapters/claude-code/hooks/SessionStart.js +55 -0
  72. package/plugins/adapters/claude-code/hooks/hooks.json +52 -0
  73. package/plugins/adapters/generic/BOOTSTRAP_INSTRUCTION.md +30 -0
  74. package/plugins/adapters/generic/README.md +50 -0
  75. package/plugins/ai-memory/.claude-plugin/plugin.json +30 -0
  76. package/plugins/ai-memory/.cursor-plugin/plugin.json +18 -0
  77. package/plugins/ai-memory/.mcp.json +19 -0
  78. package/plugins/ai-memory/agents/governance-critic/AGENT.md +57 -0
  79. package/plugins/ai-memory/agents/memory-auditor/AGENT.md +54 -0
  80. package/plugins/ai-memory/rules/context7-tool-reference.md +16 -0
  81. package/plugins/ai-memory/rules/load-memory.md +22 -0
  82. package/plugins/ai-memory/rules/parallel-safe-planning.md +19 -0
  83. package/plugins/ai-memory/skills/mem-auto-review/SKILL.md +51 -0
  84. package/plugins/ai-memory/skills/mem-compound/SKILL.md +105 -0
  85. package/plugins/ai-memory/skills/mem-init/SKILL.md +48 -0
  86. package/plugins/ai-memory/skills/mem-session-close/SKILL.md +38 -0
  87. package/plugins/ai-memory/skills/mem-validate/SKILL.md +54 -0
  88. package/templates/.ai/IDENTITY.md +23 -0
  89. package/templates/.ai/agents/_base-auditor.md +28 -0
  90. package/templates/.ai/agents/_template.md +23 -0
  91. package/templates/.ai/memory/debugging.md +14 -0
  92. package/templates/.ai/memory/decisions.md +8 -0
  93. package/templates/.ai/memory/improvements.md +7 -0
  94. package/templates/.ai/memory/memory-index.md +9 -0
  95. package/templates/.ai/memory/patterns.md +8 -0
  96. package/templates/.ai/reference/PROJECT.md +5 -0
  97. package/templates/.ai/reference/capability-specs.json +31 -0
  98. package/templates/.ai/reference/environment-specs.json +41 -0
  99. package/templates/.ai/sessions/archive/thread-archive.md +15 -0
  100. package/templates/.ai/sessions/open-items.md +13 -0
  101. package/templates/.ai/toolbox/README.md +5 -0
  102. package/templates/.ai/toolbox/browser.md +30 -0
  103. package/templates/.ai/toolbox/integrations.md +44 -0
  104. package/templates/.ai/toolbox/shell.md +38 -0
  105. package/templates/AGENTS.md +4 -0
@@ -0,0 +1,57 @@
1
+ ---
2
+ name: governance-critic
3
+ description: Red-teams the governance harness. Finds [P0] rules the current harness.json would fail to catch. Run after adding new P0 entries or when a constraint violation slipped through.
4
+ type: agent
5
+ status: active
6
+ ---
7
+
8
+ # Governance Critic
9
+
10
+ Inherits base methodology from `.ai/agents/_base-auditor.md`.
11
+
12
+ ## Role
13
+
14
+ Find weaknesses in the current rule set. The harness is only as good as the rules it contains and the test cases that cover them. This agent finds the gaps.
15
+
16
+ ## When to invoke
17
+
18
+ - After adding a new [P0] entry with `constraint_pattern`
19
+ - After a constraint violation slipped through the governance gate undetected
20
+ - When `ai-memory eval` shows low rule coverage
21
+ - Before a major release
22
+
23
+ ## Methodology
24
+
25
+ ### 1. Load current rules
26
+ Read `.ai/temp/harness.json`. Read the corresponding [P0] entries from `decisions.md` and `debugging.md`.
27
+
28
+ ### 2. Test each rule
29
+ For each rule in harness.json:
30
+ - Construct a code snippet that clearly violates the rule
31
+ - Construct a code snippet that clearly does not violate the rule (but is similar enough to be a false-positive risk)
32
+ - Note whether existing `rule-tests/tests.json` already covers this
33
+
34
+ ### 3. Find false negative risks
35
+ - Are there alternative ways to express the same violation that the pattern wouldn't catch? (e.g., dynamic imports, aliased functions, indirect calls)
36
+ - If yes → suggest a refined pattern or additional rule
37
+
38
+ ### 4. Find false positive risks
39
+ - Is the pattern too broad? Would it flag valid code?
40
+ - If yes → suggest narrowing the pattern with a `where` clause or stricter path filter
41
+
42
+ ### 5. Find uncovered P0 entries
43
+ - Are there [P0] entries with no `constraint_pattern`?
44
+ - For each: assess whether the rule can realistically be expressed as an AST or regex pattern
45
+ - If yes → propose a `constraint_pattern` block to add to the entry
46
+
47
+ ## Report Format
48
+
49
+ For each finding:
50
+ ```
51
+ Rule: <rule_id>
52
+ Issue: <false negative / false positive / uncovered>
53
+ Example: <code snippet demonstrating the issue>
54
+ Proposed fix: <refined pattern or new constraint_pattern>
55
+ ```
56
+
57
+ End with: total rules reviewed, issues found, suggested additions.
@@ -0,0 +1,54 @@
1
+ ---
2
+ name: memory-auditor
3
+ description: Audits .ai/ memory for gaps, stale entries, P0 entries missing constraint_pattern, and broken links. Run periodically or before a major release.
4
+ type: agent
5
+ status: active
6
+ ---
7
+
8
+ # Memory Auditor
9
+
10
+ Inherits base methodology from `.ai/agents/_base-auditor.md`.
11
+
12
+ ## Role
13
+
14
+ Review the state of `.ai/memory/` and surface issues that reduce the quality of AI assistance over time.
15
+
16
+ ## When to invoke
17
+
18
+ - Before a major release or milestone
19
+ - When the AI repeatedly makes the same mistakes
20
+ - When `ai-memory eval` shows declining metrics
21
+ - Monthly for active projects
22
+
23
+ ## Methodology
24
+
25
+ ### 1. Load context
26
+ Read `memory-index.md`, then read `decisions.md`, `patterns.md`, and `debugging.md` in full.
27
+
28
+ ### 2. Check for gaps
29
+ For each [P0] entry:
30
+ - Does it have a `constraint_pattern`? If not → flag as "unenforced P0"
31
+ - Is the rule clear enough to be expressed as code? If yes → suggest a `constraint_pattern`
32
+
33
+ ### 3. Check for stale entries
34
+ - Entries marked `[DEPRECATED]` older than 60 days → flag for archiving
35
+ - P2 entries not referenced in thread-archive or open-items in 90+ days → flag for review
36
+ - Decisions with `**Superseded by:**` where the referenced entry doesn't exist → flag as broken link
37
+
38
+ ### 4. Check for coverage gaps
39
+ - Topics that appear frequently in thread-archive but have no corresponding decisions or patterns entry → flag as undocumented knowledge
40
+ - Bugs in debugging.md that have a [P0] tag but no corresponding decision → suggest creating a decision entry
41
+
42
+ ### 5. Check index
43
+ - Does `memory-index.md` reflect current entries? If it's out of date → flag for regeneration
44
+
45
+ ## Report Format
46
+
47
+ Group findings by severity:
48
+
49
+ - **CRITICAL:** Broken links, corrupted frontmatter
50
+ - **HIGH:** Unenforced [P0] entries (no constraint_pattern)
51
+ - **MEDIUM:** Stale deprecated entries, coverage gaps
52
+ - **LOW:** P2 entries pending review, index freshness
53
+
54
+ End with: "Recommended next action: [most impactful single thing to fix]"
@@ -0,0 +1,16 @@
1
+ ---
2
+ name: context7-tool-reference
3
+ description: Use Context7 when fetching or updating AI tool documentation in docs/reference
4
+ globs: docs/reference/**/*
5
+ alwaysApply: false
6
+ ---
7
+
8
+ ## Context7 for tool reference
9
+
10
+ When adding, updating, or verifying entries in `docs/reference/tools/`:
11
+
12
+ 1. **Always use Context7** — Call `resolve-library-id` then `query-docs` (MCP) or `ctx7 library` + `ctx7 docs` (CLI). Do not rely on cached or outdated web search.
13
+ 2. **Add library ID** — Record the resolved Context7 library ID in the tool file's Context7 section.
14
+ 3. **Fetch 2026/2025 docs** — Use Context7 to ensure latest documentation; fall back to 2025 if nothing newer.
15
+
16
+ See `docs/reference/CONTEXT7_RULE.md` for full details and library ID reference.
@@ -0,0 +1,22 @@
1
+ ---
2
+ name: load-memory
3
+ description: Load project memory at session start. Required for ai-memory to work in any IDE.
4
+ alwaysApply: true
5
+ ---
6
+
7
+ This project has persistent AI memory in `.ai/`.
8
+
9
+ - **IDENTITY.md** — project constraints and behavioral rules
10
+ - **PROJECT_STATUS.md** — current focus, open questions, what to try next (writable)
11
+ - **memory/** — decisions, patterns, debugging history
12
+
13
+ Use `search_memory` (MCP) to find relevant context before starting a task.
14
+ Use `commit_memory` to write new entries — never edit memory files directly.
15
+ If MCP is not connected, read `.ai/memory/memory-index.md` for a summary and write to `.ai/memory/` files directly.
16
+
17
+ `.ai/` is the canonical memory for this project. Save all project learnings here, not in your tool's built-in memory (e.g. ~/.claude/, Cursor memory, etc.). Tool-native memory is for user preferences only.
18
+
19
+ IDENTITY.md is immutable by default — do not write to it unless `writable: true` is set in its frontmatter.
20
+ Immutable paths: toolbox/, acp/, rules/.
21
+
22
+ At session end: run `/mem-compound` to persist learnings. In ephemeral environments (worktrees, cloud agents), also call `sync_memory`.
@@ -0,0 +1,19 @@
1
+ ---
2
+ name: parallel-safe-planning
3
+ description: When creating plans for sub-agents or parallel execution, design tasks that do not create code conflicts.
4
+ alwaysApply: true
5
+ ---
6
+
7
+ When creating a plan or task list that will be executed by multiple agents or sub-agents (worktrees, background agents, parallel sessions):
8
+
9
+ 1. **Each task must touch a distinct set of files.** Two tasks should never modify the same file. If they must, one should depend on the other (sequential, not parallel).
10
+
11
+ 2. **Scope tasks by module, not by layer.** "Add login feature" is parallelizable. "Update all controllers" is not — it touches files other tasks may also touch.
12
+
13
+ 3. **Mark dependencies explicitly.** If task B requires task A's output, say so: `depends_on: task-a`. Agents will claim independent tasks first.
14
+
15
+ 4. **Shared files go last.** Tasks that modify shared files (config, routes, index exports) should be a final sequential step, not parallelized.
16
+
17
+ 5. **Test tasks are independent.** Writing tests for module X does not conflict with writing tests for module Y. These can always run in parallel.
18
+
19
+ When using `claim_task`, agents will pick unclaimed tasks. If the plan follows these rules, two agents claiming different tasks will never produce merge conflicts.
@@ -0,0 +1,51 @@
1
+ ---
2
+ name: mem-auto-review
3
+ description: Automated PR review using ai-memory governance rules. Designed for Cursor automations, Bugbot, and CI pipelines. No user interaction required.
4
+ ---
5
+
6
+ # mem-auto-review — Automated PR Review
7
+
8
+ ## When to use
9
+
10
+ - Triggered by PR creation (Bugbot, Cursor automation, GitHub webhook)
11
+ - CI pipeline step
12
+ - Any automated code review context
13
+
14
+ This skill requires NO user interaction. It runs autonomously and produces a structured report.
15
+
16
+ ## Instructions
17
+
18
+ ### 1. Get the diff
19
+ Run `git diff origin/main...HEAD` to get all changes in the PR.
20
+
21
+ ### 2. Search memory for context
22
+ Call `search_memory` with keywords from the changed files. Check for:
23
+ - Relevant decisions that may affect the changes
24
+ - Known patterns the PR should follow
25
+ - Previous bugs in the same area
26
+
27
+ ### 3. Validate governance
28
+ Call `generate_harness` to refresh rules, then `validate_context` with the diff.
29
+
30
+ ### 4. Produce review
31
+ Generate a structured review:
32
+
33
+ ```
34
+ ## ai-memory Review
35
+
36
+ ### Governance
37
+ - [P0 violations / all clear]
38
+
39
+ ### Memory Context
40
+ - [Relevant decisions from memory]
41
+ - [Patterns that apply]
42
+
43
+ ### Suggestions
44
+ - [Improvements based on project patterns]
45
+ ```
46
+
47
+ ### 5. Record result
48
+ Call `publish_result` with summary and outcome (`success` if no P0 violations, `failure` if blocked).
49
+
50
+ ### 6. Sync
51
+ Call `sync_memory` to persist any new learnings.
@@ -0,0 +1,105 @@
1
+ ---
2
+ name: mem-compound
3
+ description: Captures session learnings into persistent memory. Use after a non-obvious bug fix, a pattern discovery, a corrected approach, or at the end of any meaningful session.
4
+ ---
5
+
6
+ # mem-compound — Full Compound Loop
7
+
8
+ ## When to run
9
+
10
+ - A bug had a non-obvious root cause
11
+ - A reusable pattern emerged
12
+ - An approach was corrected mid-session
13
+ - The session produced architectural decisions
14
+ - End of any session worth preserving
15
+
16
+ Skip: purely mechanical tasks with no new learning.
17
+
18
+ ## Steps
19
+
20
+ ### 0. Pre-compact dump
21
+ If a pre-compact dump exists in `.ai/temp/`, process it first before scanning the live session.
22
+
23
+ ### 1. Scan
24
+ Review the session: conversation, code changes, errors encountered. Identify:
25
+ - Bugs fixed with non-obvious causes → `debugging.md`
26
+ - Reusable patterns discovered → `patterns.md`
27
+ - Architectural or process decisions made → `decisions.md`
28
+ - Incremental improvements worth noting → `improvements.md`
29
+
30
+ ### 2. Conflict check, then capture
31
+ Before writing each entry: search existing entries for contradictions.
32
+
33
+ To search: call `search_memory` with the topic of the new entry.
34
+
35
+ If a contradiction is found with an existing entry:
36
+ - Mark the old entry `[DEPRECATED]` and add `**Superseded by:** [new entry title]`
37
+ - Write the new entry normally
38
+ - Never delete old entries — the history of why things changed is valuable
39
+
40
+ Write each entry with:
41
+ - Priority tag: `[P0]` (critical, never violate), `[P1]` (important), `[P2]` (advisory)
42
+ - Context, decision/pattern/fix, rationale, tradeoffs
43
+ - Optional: `**Links to:**`, `**Supersedes:**`
44
+
45
+ For `[P0]` entries, add a `constraint_pattern` in frontmatter if the rule can be expressed as a code check (see `.ai/temp/harness.json` format).
46
+
47
+ ### 3. Update PROJECT_STATUS.md
48
+ PROJECT_STATUS.md is writable by default. Update it with what you learned:
49
+ - Move completed focus items to "What's Working"
50
+ - Add new open questions discovered during the session
51
+ - Update "What to Try Next" based on results
52
+ - This is the RALPH loop: each iteration evolves the plan
53
+
54
+ ### 4. Archive and open items
55
+ - Call `publish_result` with a summary, outcome, and learnings
56
+ - Update `sessions/open-items.md`: close resolved items, add new ones
57
+
58
+ ### 5. Regenerate index
59
+ Call `commit_memory` with type `index` to regenerate `memory-index.md`. The index is always auto-generated — never edit it manually.
60
+
61
+ ### 6. Governance gate (Full tier only)
62
+ If `.ai/temp/harness.json` exists:
63
+ 1. Call `generate_harness` to refresh rules from current [P0] entries
64
+ 2. Call `validate_context` with the current git diff
65
+ 3. Call `validate_schema` on each new memory entry
66
+
67
+ If any check fails: resolve the violation before proceeding. The gate does not warn — it blocks.
68
+
69
+ ### 7. Sync (ephemeral environments)
70
+ If running in a worktree, cloud agent, or sandbox: call `sync_memory` to git commit all `.ai/` changes. Without this, your work will be lost when the environment is cleaned up.
71
+
72
+ ### 8. Report & memory hygiene
73
+
74
+ Summarize the session in a structured report:
75
+
76
+ **Session summary:**
77
+ - Entries written: list each (type, priority, title)
78
+ - Items: N opened, N closed
79
+ - Gate: passed / N violations resolved
80
+
81
+ **Memory hygiene check:**
82
+ Call `prune_memory` with `dry_run: true`. Then report:
83
+
84
+ - **Clean** (no deprecated entries): "Memory is clean — no stale entries found."
85
+ - **Stale entries found**: List them clearly:
86
+ ```
87
+ Found N deprecated entries:
88
+ 1. [topic-file.md] "Entry title" — deprecated on YYYY-MM-DD
89
+ 2. ...
90
+
91
+ To clean up, say: "prune these deprecated entries"
92
+ Or ignore — they're already excluded from search results.
93
+ ```
94
+
95
+ Keep the report concise. The user should be able to act on it immediately or move on.
96
+
97
+ ---
98
+
99
+ ## Automation mode
100
+
101
+ When running as a Cursor automation, Bugbot task, or CI step (no user interaction):
102
+ - Skip any steps that require user confirmation
103
+ - Use `search_memory` + `git diff` as input instead of conversation scanning
104
+ - Always call `sync_memory` at the end (automations are ephemeral)
105
+ - Output a structured report (markdown) rather than conversational summary
@@ -0,0 +1,48 @@
1
+ ---
2
+ name: mem-init
3
+ description: Scaffolds the .ai/ directory in the current project. Use once per project to set up persistent memory. Runs npx ai-memory init with chosen options.
4
+ ---
5
+
6
+ # mem-init — Project Setup
7
+
8
+ ## When to use
9
+
10
+ First time setting up ai-memory in a project. Run once.
11
+
12
+ ## Steps
13
+
14
+ ### 1. Confirm working directory
15
+ Verify the current directory is the project root (where `.git/` lives).
16
+
17
+ ### 2. Choose tier
18
+
19
+ Ask which tier to initialize:
20
+
21
+ - **Default** — full memory structure + MCP server. Recommended for most projects.
22
+ ```
23
+ npx @radix-ai/ai-memory init
24
+ ```
25
+
26
+ - **Full** — Default plus governance enforcement (harness), evals, and ACP agent card.
27
+ ```
28
+ npx @radix-ai/ai-memory init --full
29
+ ```
30
+
31
+ ### 3. Run init
32
+ Execute the chosen command. The CLI scaffolds `.ai/` from canonical templates, adds `AGENTS.md` stub at project root, and configures tool stubs for the current IDE.
33
+
34
+ ### 4. Customize IDENTITY.md
35
+ After scaffolding, open `.ai/IDENTITY.md` and fill in:
36
+ - What this project is (one paragraph)
37
+ - Hard constraints (what the AI must never do in this codebase)
38
+ - Tech stack overview
39
+
40
+ ### 5. Customize PROJECT_STATUS.md
41
+ Open `.ai/PROJECT_STATUS.md` and fill in:
42
+ - Current Focus (what's actively being built)
43
+ - Open Questions (what's not decided yet)
44
+
45
+ Leave `What's Working` and `What to Try Next` blank for now — these fill in naturally over time.
46
+
47
+ ### 6. Confirm
48
+ Run `npx @radix-ai/ai-memory validate` to confirm all files have valid frontmatter.
@@ -0,0 +1,38 @@
1
+ ---
2
+ name: mem-session-close
3
+ description: Lite session close. Archives the session and updates open items without a full compound run. Use when ending a session that produced no new decisions or patterns worth capturing.
4
+ ---
5
+
6
+ # mem-session-close — Lite Path
7
+
8
+ ## When to use
9
+
10
+ - Session was exploratory or mechanical (no new decisions, patterns, or bugs)
11
+ - Short session not worth a full compound run
12
+ - Want to close cleanly without the full loop
13
+
14
+ For sessions with real learning, use `/mem-compound` instead.
15
+
16
+ ## Steps
17
+
18
+ ### 1. Pre-compact dump
19
+ If a pre-compact dump exists in `.ai/temp/`, process it first.
20
+
21
+ ### 2. Archive
22
+ Add a one-line summary to `sessions/archive/thread-archive.md`:
23
+ ```
24
+ [date] Brief description of what was done. No major decisions.
25
+ ```
26
+
27
+ ### 3. Open items
28
+ Review `sessions/open-items.md`:
29
+ - Close any items resolved during this session
30
+ - Add any newly discovered items
31
+
32
+ ### 4. Sync (ephemeral environments)
33
+ If running in a worktree, cloud agent, or sandbox: call `sync_memory` to git commit all `.ai/` changes.
34
+
35
+ ### 5. Report
36
+ One line: "Session closed. [N] items updated."
37
+
38
+ No index regeneration. No governance gate. No topic file writes.
@@ -0,0 +1,54 @@
1
+ ---
2
+ name: mem-validate
3
+ description: Manually validates proposed code changes or memory entries against project rules. Use before a risky change or when the governance gate needs to be run outside of compound.
4
+ ---
5
+
6
+ # mem-validate — Manual Validation
7
+
8
+ ## When to use
9
+
10
+ - Before a risky architectural change
11
+ - When a compound run was skipped but governance is needed
12
+ - To check a proposed memory entry before writing it
13
+ - To verify the current harness is up to date
14
+
15
+ ## Steps
16
+
17
+ ### 1. Determine what to validate
18
+
19
+ Choose one or both:
20
+ - **Code change**: validate a git diff against [P0] rules
21
+ - **Memory entry**: validate a proposed entry against the canonical schema
22
+
23
+ ### 2. Validate code change (if applicable)
24
+
25
+ Collect the git diff:
26
+ ```
27
+ git diff HEAD
28
+ ```
29
+
30
+ Call `validate_context` with the diff. The tool returns either:
31
+ - A list of violated [P0] rules (with which decision triggered each)
32
+ - "No violations found"
33
+
34
+ If violations are found: resolve them before proceeding. Each violation message names the specific [P0] entry that was triggered.
35
+
36
+ ### 3. Validate memory entry (if applicable)
37
+
38
+ Call `validate_schema` with the proposed entry. The tool checks:
39
+ - Required frontmatter fields present (`id`, `type`, `status`)
40
+ - Field values are valid enum values
41
+ - `constraint_pattern` is well-formed (if present)
42
+
43
+ ### 4. Check harness freshness (Full tier)
44
+
45
+ If `.ai/temp/harness.json` exists, verify it reflects current [P0] entries:
46
+ ```
47
+ npx @radix-ai/ai-memory validate
48
+ ```
49
+
50
+ If stale: call `generate_harness` to refresh.
51
+
52
+ ### 5. Report
53
+
54
+ List: what passed, what failed, what was refreshed.
@@ -0,0 +1,23 @@
1
+ # IDENTITY.md
2
+
3
+ You are a senior developer focused on long-term strategy and production readiness.
4
+
5
+ ## Mindset
6
+
7
+ - Think about gaps and edge cases before writing code
8
+ - Propose solutions that are production-grade, not prototypes
9
+ - When diagnosing an issue, consider the full call chain — not just the immediate symptom
10
+
11
+ ## Constraints (NEVER without explicit approval)
12
+
13
+ - Never commit secrets, API keys, or .env files
14
+ - Never delete user data without explicit request
15
+ - Never deploy to production without explicit request
16
+ - Never write full protocols to tool directories — canonical content goes in `.ai/`, stubs in tool dirs
17
+
18
+ ## Before Starting Any Task
19
+
20
+ 1. Read `.ai/memory/memory-index.md`
21
+ 2. Search `.ai/memory/` for bugs, patterns, decisions relevant to the task
22
+ 3. Search `.ai/skills/` for applicable domain patterns
23
+ 4. Fetch `.ai/reference/PROJECT.md` only when task requires architecture, data models, or integrations
@@ -0,0 +1,28 @@
1
+ # Base Auditor Protocol
2
+
3
+ **Shared by all auditor agents.** Defines Core Principles, Initial Steps, Report Format, Closing Steps.
4
+
5
+ ## Core Principles
6
+
7
+ - Verify before asserting
8
+ - Cite evidence (file:line, logs)
9
+ - Prioritize by impact (CRITICAL > HIGH > MEDIUM > LOW)
10
+
11
+ ## Initial Steps
12
+
13
+ 1. Read scope and methodology from the specific auditor file
14
+ 2. Gather context (relevant files, configs, rules)
15
+ 3. Execute checks per methodology
16
+
17
+ ## Report Format
18
+
19
+ - **CRITICAL:** {definition}
20
+ - **HIGH:** {definition}
21
+ - **MEDIUM:** {definition}
22
+ - **LOW:** {definition}
23
+
24
+ ## Closing Steps
25
+
26
+ - Summarize findings
27
+ - Recommend remediation order
28
+ - Flag any blockers
@@ -0,0 +1,23 @@
1
+ # {Agent Name}
2
+
3
+ You are a {role description}. Your goal is {mission statement}.
4
+
5
+ > **Auditor agents:** Follow the shared auditor protocol in `_base-auditor.md`.
6
+
7
+ ## Role-Specific Reading
8
+
9
+ - {What this agent should read before starting.}
10
+
11
+ ## Methodology
12
+
13
+ ### 1. {First Area}
14
+
15
+ {What to check, how to check it.}
16
+
17
+ ### 2. {Second Area}
18
+
19
+ {...}
20
+
21
+ ## Output
22
+
23
+ Save findings to the appropriate location. Categorize by severity.
@@ -0,0 +1,14 @@
1
+ # Debugging — Non-obvious Bugs
2
+
3
+ **Format:** Tag each entry with `[P0]`, `[P1]`, or `[P2]`. Include root cause and fix.
4
+
5
+ ---
6
+
7
+ <!-- Add entries below. Example:
8
+
9
+ ## [P0] Vitest 4 Incompatibility
10
+
11
+ **Symptom:** "No test suite found in file" after upgrading Vitest.
12
+ **Root cause:** Vitest 4.x has a known bug.
13
+ **Fix:** Pin to Vitest 3.2.4.
14
+ -->
@@ -0,0 +1,8 @@
1
+ # Decisions — Architectural Decisions with Rationale
2
+
3
+ **Format:** Tag each entry with `[P0]`, `[P1]`, or `[P2]`. Include context, decision, rationale, tradeoffs.
4
+ Optional: `**Supersedes:**`, `**Superseded by:**`, `**Links to:**` for graph linkage.
5
+
6
+ ---
7
+
8
+ <!-- Add entries below. -->
@@ -0,0 +1,7 @@
1
+ # Improvements — Proposed Improvements (Awaiting Decision)
2
+
3
+ **Format:** Human or agent-proposed improvements. Await human decision before implementing.
4
+
5
+ ---
6
+
7
+ <!-- Add entries below. -->
@@ -0,0 +1,9 @@
1
+ # Memory Index — Priority-Ranked Index
2
+
3
+ **Auto-generated.** Parses `[P0]`, `[P1]`, `[P2]` from debugging.md, decisions.md, patterns.md.
4
+
5
+ Run the index generator (e.g. `node scripts/write-memory-index.js` or `npx ai-os index`) to regenerate.
6
+
7
+ ---
8
+
9
+ <!-- Placeholder until index generator runs. -->
@@ -0,0 +1,8 @@
1
+ # Patterns — Reusable Patterns Confirmed Across Codebase
2
+
3
+ **Format:** Tag each entry with `[P0]`, `[P1]`, or `[P2]`. Include pattern and anti-pattern.
4
+ Optional: `**Links to:**` for graph linkage.
5
+
6
+ ---
7
+
8
+ <!-- Add entries below. -->
@@ -0,0 +1,5 @@
1
+ # PROJECT.md
2
+
3
+ **Placeholder.** Replace with your project's architecture, data models, integrations, and critical warnings.
4
+
5
+ Load this file only when the task requires full project context. Prefer `memory-index.md` and topic tails for session start.
@@ -0,0 +1,31 @@
1
+ {
2
+ "version": 1,
3
+ "capabilities": {
4
+ "browser": {
5
+ "description": "Browser automation (screenshots, navigate, interact)",
6
+ "environments": {
7
+ "cursor": { "native": true },
8
+ "claude-code": {
9
+ "mcp": {
10
+ "type": "stdio",
11
+ "command": "npx",
12
+ "args": ["-y", "@anthropic-ai/cursor-ide-browser"]
13
+ }
14
+ },
15
+ "windsurf": { "mcp": { "type": "stdio", "command": "npx", "args": ["-y", "@anthropic-ai/cursor-ide-browser"] } },
16
+ "cline": { "mcp": { "type": "stdio", "command": "npx", "args": ["-y", "@anthropic-ai/cursor-ide-browser"] } }
17
+ }
18
+ },
19
+ "screen_capture": {
20
+ "description": "Desktop/app window screenshot and vision analysis",
21
+ "platforms": {
22
+ "darwin": {
23
+ "bins": ["peekaboo"],
24
+ "install": [{ "kind": "brew", "formula": "peekaboo" }]
25
+ },
26
+ "win32": { "manual": "Use built-in screenshot tools; save to .ai/temp/" },
27
+ "linux": { "manual": "Use gnome-screenshot or similar; save to .ai/temp/" }
28
+ }
29
+ }
30
+ }
31
+ }