ag-cortex 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 (162) hide show
  1. package/.agent/commands/test-browser.md +339 -0
  2. package/.agent/rules/00-constitution.md +46 -0
  3. package/.agent/rules/project-rules.md +49 -0
  4. package/.agent/skills/agent-browser/SKILL.md +223 -0
  5. package/.agent/skills/agent-native-architecture/SKILL.md +435 -0
  6. package/.agent/skills/agent-native-architecture/references/action-parity-discipline.md +409 -0
  7. package/.agent/skills/agent-native-architecture/references/agent-execution-patterns.md +467 -0
  8. package/.agent/skills/agent-native-architecture/references/agent-native-testing.md +582 -0
  9. package/.agent/skills/agent-native-architecture/references/architecture-patterns.md +478 -0
  10. package/.agent/skills/agent-native-architecture/references/dynamic-context-injection.md +338 -0
  11. package/.agent/skills/agent-native-architecture/references/files-universal-interface.md +301 -0
  12. package/.agent/skills/agent-native-architecture/references/from-primitives-to-domain-tools.md +359 -0
  13. package/.agent/skills/agent-native-architecture/references/mcp-tool-design.md +506 -0
  14. package/.agent/skills/agent-native-architecture/references/mobile-patterns.md +871 -0
  15. package/.agent/skills/agent-native-architecture/references/product-implications.md +443 -0
  16. package/.agent/skills/agent-native-architecture/references/refactoring-to-prompt-native.md +317 -0
  17. package/.agent/skills/agent-native-architecture/references/self-modification.md +269 -0
  18. package/.agent/skills/agent-native-architecture/references/shared-workspace-architecture.md +680 -0
  19. package/.agent/skills/agent-native-architecture/references/system-prompt-design.md +250 -0
  20. package/.agent/skills/agent-native-reviewer/SKILL.md +246 -0
  21. package/.agent/skills/andrew-kane-gem-writer/SKILL.md +184 -0
  22. package/.agent/skills/andrew-kane-gem-writer/references/database-adapters.md +231 -0
  23. package/.agent/skills/andrew-kane-gem-writer/references/module-organization.md +121 -0
  24. package/.agent/skills/andrew-kane-gem-writer/references/rails-integration.md +183 -0
  25. package/.agent/skills/andrew-kane-gem-writer/references/resources.md +119 -0
  26. package/.agent/skills/andrew-kane-gem-writer/references/testing-patterns.md +261 -0
  27. package/.agent/skills/ankane-readme-writer/SKILL.md +50 -0
  28. package/.agent/skills/architecture-strategist/SKILL.md +52 -0
  29. package/.agent/skills/best-practices-researcher/SKILL.md +100 -0
  30. package/.agent/skills/bug-reproduction-validator/SKILL.md +67 -0
  31. package/.agent/skills/code-simplicity-reviewer/SKILL.md +85 -0
  32. package/.agent/skills/coding-tutor/.claude-plugin/plugin.json +9 -0
  33. package/.agent/skills/coding-tutor/README.md +37 -0
  34. package/.agent/skills/coding-tutor/commands/quiz-me.md +1 -0
  35. package/.agent/skills/coding-tutor/commands/sync-tutorials.md +25 -0
  36. package/.agent/skills/coding-tutor/commands/teach-me.md +1 -0
  37. package/.agent/skills/coding-tutor/skills/coding-tutor/SKILL.md +214 -0
  38. package/.agent/skills/coding-tutor/skills/coding-tutor/scripts/create_tutorial.py +202 -0
  39. package/.agent/skills/coding-tutor/skills/coding-tutor/scripts/index_tutorials.py +203 -0
  40. package/.agent/skills/coding-tutor/skills/coding-tutor/scripts/quiz_priority.py +190 -0
  41. package/.agent/skills/coding-tutor/skills/coding-tutor/scripts/setup_tutorials.py +132 -0
  42. package/.agent/skills/compound-docs/SKILL.md +510 -0
  43. package/.agent/skills/compound-docs/assets/critical-pattern-template.md +34 -0
  44. package/.agent/skills/compound-docs/assets/resolution-template.md +93 -0
  45. package/.agent/skills/compound-docs/references/yaml-schema.md +65 -0
  46. package/.agent/skills/compound-docs/schema.yaml +176 -0
  47. package/.agent/skills/create-agent-skills/SKILL.md +299 -0
  48. package/.agent/skills/create-agent-skills/references/api-security.md +226 -0
  49. package/.agent/skills/create-agent-skills/references/be-clear-and-direct.md +531 -0
  50. package/.agent/skills/create-agent-skills/references/best-practices.md +404 -0
  51. package/.agent/skills/create-agent-skills/references/common-patterns.md +595 -0
  52. package/.agent/skills/create-agent-skills/references/core-principles.md +437 -0
  53. package/.agent/skills/create-agent-skills/references/executable-code.md +175 -0
  54. package/.agent/skills/create-agent-skills/references/iteration-and-testing.md +474 -0
  55. package/.agent/skills/create-agent-skills/references/official-spec.md +185 -0
  56. package/.agent/skills/create-agent-skills/references/recommended-structure.md +168 -0
  57. package/.agent/skills/create-agent-skills/references/skill-structure.md +372 -0
  58. package/.agent/skills/create-agent-skills/references/using-scripts.md +113 -0
  59. package/.agent/skills/create-agent-skills/references/using-templates.md +112 -0
  60. package/.agent/skills/create-agent-skills/references/workflows-and-validation.md +510 -0
  61. package/.agent/skills/create-agent-skills/templates/router-skill.md +73 -0
  62. package/.agent/skills/create-agent-skills/templates/simple-skill.md +33 -0
  63. package/.agent/skills/create-agent-skills/workflows/add-reference.md +96 -0
  64. package/.agent/skills/create-agent-skills/workflows/add-script.md +93 -0
  65. package/.agent/skills/create-agent-skills/workflows/add-template.md +74 -0
  66. package/.agent/skills/create-agent-skills/workflows/add-workflow.md +120 -0
  67. package/.agent/skills/create-agent-skills/workflows/audit-skill.md +138 -0
  68. package/.agent/skills/create-agent-skills/workflows/create-domain-expertise-skill.md +605 -0
  69. package/.agent/skills/create-agent-skills/workflows/create-new-skill.md +191 -0
  70. package/.agent/skills/create-agent-skills/workflows/get-guidance.md +121 -0
  71. package/.agent/skills/create-agent-skills/workflows/upgrade-to-router.md +161 -0
  72. package/.agent/skills/create-agent-skills/workflows/verify-skill.md +204 -0
  73. package/.agent/skills/data-integrity-guardian/SKILL.md +70 -0
  74. package/.agent/skills/data-migration-expert/SKILL.md +97 -0
  75. package/.agent/skills/deployment-verification-agent/SKILL.md +159 -0
  76. package/.agent/skills/design-implementation-reviewer/SKILL.md +85 -0
  77. package/.agent/skills/design-iterator/SKILL.md +197 -0
  78. package/.agent/skills/dhh-rails-reviewer/SKILL.md +45 -0
  79. package/.agent/skills/dhh-rails-style/SKILL.md +184 -0
  80. package/.agent/skills/dhh-rails-style/references/architecture.md +653 -0
  81. package/.agent/skills/dhh-rails-style/references/controllers.md +303 -0
  82. package/.agent/skills/dhh-rails-style/references/frontend.md +510 -0
  83. package/.agent/skills/dhh-rails-style/references/gems.md +266 -0
  84. package/.agent/skills/dhh-rails-style/references/models.md +359 -0
  85. package/.agent/skills/dhh-rails-style/references/testing.md +338 -0
  86. package/.agent/skills/dspy-ruby/SKILL.md +594 -0
  87. package/.agent/skills/dspy-ruby/assets/config-template.rb +359 -0
  88. package/.agent/skills/dspy-ruby/assets/module-template.rb +326 -0
  89. package/.agent/skills/dspy-ruby/assets/signature-template.rb +143 -0
  90. package/.agent/skills/dspy-ruby/references/core-concepts.md +265 -0
  91. package/.agent/skills/dspy-ruby/references/optimization.md +623 -0
  92. package/.agent/skills/dspy-ruby/references/providers.md +305 -0
  93. package/.agent/skills/every-style-editor/SKILL.md +134 -0
  94. package/.agent/skills/every-style-editor/references/EVERY_WRITE_STYLE.md +529 -0
  95. package/.agent/skills/figma-design-sync/SKILL.md +166 -0
  96. package/.agent/skills/file-todos/SKILL.md +251 -0
  97. package/.agent/skills/file-todos/assets/todo-template.md +155 -0
  98. package/.agent/skills/framework-docs-researcher/SKILL.md +83 -0
  99. package/.agent/skills/frontend-design/SKILL.md +42 -0
  100. package/.agent/skills/gemini-imagegen/SKILL.md +237 -0
  101. package/.agent/skills/gemini-imagegen/requirements.txt +2 -0
  102. package/.agent/skills/gemini-imagegen/scripts/compose_images.py +168 -0
  103. package/.agent/skills/gemini-imagegen/scripts/edit_image.py +157 -0
  104. package/.agent/skills/gemini-imagegen/scripts/gemini_images.py +265 -0
  105. package/.agent/skills/gemini-imagegen/scripts/generate_image.py +147 -0
  106. package/.agent/skills/gemini-imagegen/scripts/multi_turn_chat.py +215 -0
  107. package/.agent/skills/git-history-analyzer/SKILL.md +42 -0
  108. package/.agent/skills/git-worktree/SKILL.md +302 -0
  109. package/.agent/skills/git-worktree/scripts/worktree-manager.sh +345 -0
  110. package/.agent/skills/julik-frontend-races-reviewer/SKILL.md +222 -0
  111. package/.agent/skills/kieran-python-reviewer/SKILL.md +104 -0
  112. package/.agent/skills/kieran-rails-reviewer/SKILL.md +86 -0
  113. package/.agent/skills/kieran-typescript-reviewer/SKILL.md +95 -0
  114. package/.agent/skills/lint/SKILL.md +16 -0
  115. package/.agent/skills/pattern-recognition-specialist/SKILL.md +57 -0
  116. package/.agent/skills/performance-oracle/SKILL.md +110 -0
  117. package/.agent/skills/pr-comment-resolver/SKILL.md +69 -0
  118. package/.agent/skills/rclone/SKILL.md +150 -0
  119. package/.agent/skills/rclone/scripts/check_setup.sh +60 -0
  120. package/.agent/skills/repo-research-analyst/SKILL.md +113 -0
  121. package/.agent/skills/security-sentinel/SKILL.md +93 -0
  122. package/.agent/skills/skill-creator/SKILL.md +209 -0
  123. package/.agent/skills/skill-creator/scripts/init_skill.py +304 -0
  124. package/.agent/skills/skill-creator/scripts/package_skill.py +112 -0
  125. package/.agent/skills/skill-creator/scripts/quick_validate.py +72 -0
  126. package/.agent/skills/spec-flow-analyzer/SKILL.md +113 -0
  127. package/.agent/skills/test-agent/SKILL.md +4 -0
  128. package/.agent/workflows/agent-native-audit.md +277 -0
  129. package/.agent/workflows/ask-user-question.md +21 -0
  130. package/.agent/workflows/changelog.md +137 -0
  131. package/.agent/workflows/compound.md +202 -0
  132. package/.agent/workflows/create-agent-skill.md +8 -0
  133. package/.agent/workflows/deepen-plan-research.md +334 -0
  134. package/.agent/workflows/deepen-plan-synthesis.md +182 -0
  135. package/.agent/workflows/deepen-plan.md +79 -0
  136. package/.agent/workflows/feature-video.md +342 -0
  137. package/.agent/workflows/generate-command.md +162 -0
  138. package/.agent/workflows/heal-skill.md +142 -0
  139. package/.agent/workflows/lfg.md +20 -0
  140. package/.agent/workflows/plan-analysis.md +67 -0
  141. package/.agent/workflows/plan-next-steps.md +63 -0
  142. package/.agent/workflows/plan-review.md +33 -0
  143. package/.agent/workflows/plan-synthesis.md +106 -0
  144. package/.agent/workflows/plan.md +49 -0
  145. package/.agent/workflows/report-bug.md +150 -0
  146. package/.agent/workflows/reproduce-bug.md +99 -0
  147. package/.agent/workflows/resolve-parallel.md +34 -0
  148. package/.agent/workflows/resolve-pr-parallel.md +49 -0
  149. package/.agent/workflows/resolve-todo-parallel.md +35 -0
  150. package/.agent/workflows/review-analysis.md +145 -0
  151. package/.agent/workflows/review-synthesis.md +262 -0
  152. package/.agent/workflows/review.md +64 -0
  153. package/.agent/workflows/ship.md +90 -0
  154. package/.agent/workflows/test-command.md +3 -0
  155. package/.agent/workflows/triage.md +310 -0
  156. package/.agent/workflows/work.md +157 -0
  157. package/.agent/workflows/xcode-test.md +332 -0
  158. package/LICENSE +22 -0
  159. package/README.md +49 -0
  160. package/bin/ag-cortex.js +54 -0
  161. package/lib/core.js +165 -0
  162. package/package.json +31 -0
@@ -0,0 +1,435 @@
1
+ ---
2
+ name: agent-native-architecture
3
+ description: Build applications where agents are first-class citizens. Use this skill when designing autonomous agents, creating MCP tools, implementing self-modifying systems, or building apps where features are outcomes achieved by agents operating in a loop.
4
+ ---
5
+
6
+ <why_now>
7
+ ## Why Now
8
+
9
+ Software agents work reliably now. Antigravity demonstrated that an LLM with access to bash and file tools, operating in a loop until an objective is achieved, can accomplish complex multi-step tasks autonomously.
10
+
11
+ The surprising discovery: **a really good coding agent is actually a really good general-purpose agent.** The same architecture that lets Antigravity refactor a codebase can let an agent organize your files, manage your reading list, or automate your workflows.
12
+
13
+ The Antigravity SDK makes this accessible. You can build applications where features aren't code you write—they're outcomes you describe, achieved by an agent with tools, operating in a loop until the outcome is reached.
14
+
15
+ This opens up a new field: software that works the way Antigravity works, applied to categories far beyond coding.
16
+ </why_now>
17
+
18
+ <core_principles>
19
+ ## Core Principles
20
+
21
+ ### 1. Parity
22
+
23
+ **Whatever the user can do through the UI, the agent should be able to achieve through tools.**
24
+
25
+ This is the foundational principle. Without it, nothing else matters.
26
+
27
+ Imagine you build a notes app with a beautiful interface for creating, organizing, and tagging notes. A user asks the agent: "Create a note summarizing my meeting and tag it as urgent."
28
+
29
+ If you built UI for creating notes but no agent capability to do the same, the agent is stuck. It might apologize or ask clarifying questions, but it can't help—even though the action is trivial for a human using the interface.
30
+
31
+ **The fix:** Ensure the agent has tools (or combinations of tools) that can accomplish anything the UI can do.
32
+
33
+ This isn't about creating a 1:1 mapping of UI buttons to tools. It's about ensuring the agent can **achieve the same outcomes**. Sometimes that's a single tool (`create_note`). Sometimes it's composing primitives (`write_file` to a notes directory with proper formatting).
34
+
35
+ **The discipline:** When adding any UI capability, ask: can the agent achieve this outcome? If not, add the necessary tools or primitives.
36
+
37
+ A capability map helps:
38
+
39
+ | User Action | How Agent Achieves It |
40
+ |-------------|----------------------|
41
+ | Create a note | `write_file` to notes directory, or `create_note` tool |
42
+ | Tag a note as urgent | `update_file` metadata, or `tag_note` tool |
43
+ | Search notes | `search_files` or `search_notes` tool |
44
+ | Delete a note | `delete_file` or `delete_note` tool |
45
+
46
+ **The test:** Pick any action a user can take in your UI. Describe it to the agent. Can it accomplish the outcome?
47
+
48
+ ---
49
+
50
+ ### 2. Granularity
51
+
52
+ **Prefer atomic primitives. Features are outcomes achieved by an agent operating in a loop.**
53
+
54
+ A tool is a primitive capability: read a file, write a file, run a bash command, store a record, send a notification.
55
+
56
+ A **feature** is not a function you write. It's an outcome you describe in a prompt, achieved by an agent that has tools and operates in a loop until the outcome is reached.
57
+
58
+ **Less granular (limits the agent):**
59
+ ```
60
+ Tool: classify_and_organize_files(files)
61
+ → You wrote the decision logic
62
+ → Agent executes your code
63
+ → To change behavior, you refactor
64
+ ```
65
+
66
+ **More granular (empowers the agent):**
67
+ ```
68
+ Tools: read_file, write_file, move_file, list_directory, bash
69
+ Prompt: "Organize the user's downloads folder. Analyze each file,
70
+ determine appropriate locations based on content and recency,
71
+ and move them there."
72
+ Agent: Operates in a loop—reads files, makes judgments, moves things,
73
+ checks results—until the folder is organized.
74
+ → Agent makes the decisions
75
+ → To change behavior, you edit the prompt
76
+ ```
77
+
78
+ **The key shift:** The agent is pursuing an outcome with judgment, not executing a choreographed sequence. It might encounter unexpected file types, adjust its approach, or ask clarifying questions. The loop continues until the outcome is achieved.
79
+
80
+ The more atomic your tools, the more flexibly the agent can use them. If you bundle decision logic into tools, you've moved judgment back into code.
81
+
82
+ **The test:** To change how a feature behaves, do you edit prose or refactor code?
83
+
84
+ ---
85
+
86
+ ### 3. Composability
87
+
88
+ **With atomic tools and parity, you can create new features just by writing new prompts.**
89
+
90
+ This is the payoff of the first two principles. When your tools are atomic and the agent can do anything users can do, new features are just new prompts.
91
+
92
+ Want a "weekly review" feature that summarizes activity and suggests priorities? That's a prompt:
93
+
94
+ ```
95
+ "Review files modified this week. Summarize key changes. Based on
96
+ incomplete items and approaching deadlines, suggest three priorities
97
+ for next week."
98
+ ```
99
+
100
+ The agent uses `list_files`, `read_file`, and its judgment to accomplish this. You didn't write weekly-review code. You described an outcome, and the agent operates in a loop until it's achieved.
101
+
102
+ **This works for developers and users.** You can ship new features by adding prompts. Users can customize behavior by modifying prompts or creating their own. "When I say 'file this,' always move it to my Action folder and tag it urgent" becomes a user-level prompt that extends the application.
103
+
104
+ **The constraint:** This only works if tools are atomic enough to be composed in ways you didn't anticipate, and if the agent has parity with users. If tools encode too much logic, or the agent can't access key capabilities, composition breaks down.
105
+
106
+ **The test:** Can you add a new feature by writing a new prompt section, without adding new code?
107
+
108
+ ---
109
+
110
+ ### 4. Emergent Capability
111
+
112
+ **The agent can accomplish things you didn't explicitly design for.**
113
+
114
+ When tools are atomic, parity is maintained, and prompts are composable, users will ask the agent for things you never anticipated. And often, the agent can figure it out.
115
+
116
+ *"Cross-reference my meeting notes with my task list and tell me what I've committed to but haven't scheduled."*
117
+
118
+ You didn't build a "commitment tracker" feature. But if the agent can read notes, read tasks, and reason about them—operating in a loop until it has an answer—it can accomplish this.
119
+
120
+ **This reveals latent demand.** Instead of guessing what features users want, you observe what they're asking the agent to do. When patterns emerge, you can optimize them with domain-specific tools or dedicated prompts. But you didn't have to anticipate them—you discovered them.
121
+
122
+ **The flywheel:**
123
+ 1. Build with atomic tools and parity
124
+ 2. Users ask for things you didn't anticipate
125
+ 3. Agent composes tools to accomplish them (or fails, revealing a gap)
126
+ 4. You observe patterns in what's being requested
127
+ 5. Add domain tools or prompts to make common patterns efficient
128
+ 6. Repeat
129
+
130
+ This changes how you build products. You're not trying to imagine every feature upfront. You're creating a capable foundation and learning from what emerges.
131
+
132
+ **The test:** Give the agent an open-ended request relevant to your domain. Can it figure out a reasonable approach, operating in a loop until it succeeds? If it just says "I don't have a feature for that," your architecture is too constrained.
133
+
134
+ ---
135
+
136
+ ### 5. Improvement Over Time
137
+
138
+ **Agent-native applications get better through accumulated context and prompt refinement.**
139
+
140
+ Unlike traditional software, agent-native applications can improve without shipping code:
141
+
142
+ **Accumulated context:** The agent can maintain state across sessions—what exists, what the user has done, what worked, what didn't. A `context.md` file the agent reads and updates is layer one. More sophisticated approaches involve structured memory and learned preferences.
143
+
144
+ **Prompt refinement at multiple levels:**
145
+ - **Developer level:** You ship updated prompts that change agent behavior for all users
146
+ - **User level:** Users customize prompts for their workflow
147
+ - **Agent level:** The agent modifies its own prompts based on feedback (advanced)
148
+
149
+ **Self-modification (advanced):** Agents that can edit their own prompts or even their own code. For production use cases, consider adding safety rails—approval gates, automatic checkpoints for rollback, health checks. This is where things are heading.
150
+
151
+ The improvement mechanisms are still being discovered. Context and prompt refinement are proven. Self-modification is emerging. What's clear: the architecture supports getting better in ways traditional software doesn't.
152
+
153
+ **The test:** Does the application work better after a month of use than on day one, even without code changes?
154
+ </core_principles>
155
+
156
+ <intake>
157
+ ## What aspect of agent-native architecture do you need help with?
158
+
159
+ 1. **Design architecture** - Plan a new agent-native system from scratch
160
+ 2. **Files & workspace** - Use files as the universal interface, shared workspace patterns
161
+ 3. **Tool design** - Build primitive tools, dynamic capability discovery, CRUD completeness
162
+ 4. **Domain tools** - Know when to add domain tools vs stay with primitives
163
+ 5. **Execution patterns** - Completion signals, partial completion, context limits
164
+ 6. **System prompts** - Define agent behavior in prompts, judgment criteria
165
+ 7. **Context injection** - Inject runtime app state into agent prompts
166
+ 8. **Action parity** - Ensure agents can do everything users can do
167
+ 9. **Self-modification** - Enable agents to safely evolve themselves
168
+ 10. **Product design** - Progressive disclosure, latent demand, approval patterns
169
+ 11. **Mobile patterns** - iOS storage, background execution, checkpoint/resume
170
+ 12. **Testing** - Test agent-native apps for capability and parity
171
+ 13. **Refactoring** - Make existing code more agent-native
172
+
173
+ **Wait for response before proceeding.**
174
+ </intake>
175
+
176
+ <routing>
177
+ | Response | Action |
178
+ |----------|--------|
179
+ | 1, "design", "architecture", "plan" | Read [architecture-patterns.md](./references/architecture-patterns.md), then apply Architecture Checklist below |
180
+ | 2, "files", "workspace", "filesystem" | Read [files-universal-interface.md](./references/files-universal-interface.md) and [shared-workspace-architecture.md](./references/shared-workspace-architecture.md) |
181
+ | 3, "tool", "mcp", "primitive", "crud" | Read [mcp-tool-design.md](./references/mcp-tool-design.md) |
182
+ | 4, "domain tool", "when to add" | Read [from-primitives-to-domain-tools.md](./references/from-primitives-to-domain-tools.md) |
183
+ | 5, "execution", "completion", "loop" | Read [agent-execution-patterns.md](./references/agent-execution-patterns.md) |
184
+ | 6, "prompt", "system prompt", "behavior" | Read [system-prompt-design.md](./references/system-prompt-design.md) |
185
+ | 7, "context", "inject", "runtime", "dynamic" | Read [dynamic-context-injection.md](./references/dynamic-context-injection.md) |
186
+ | 8, "parity", "ui action", "capability map" | Read [action-parity-discipline.md](./references/action-parity-discipline.md) |
187
+ | 9, "self-modify", "evolve", "git" | Read [self-modification.md](./references/self-modification.md) |
188
+ | 10, "product", "progressive", "approval", "latent demand" | Read [product-implications.md](./references/product-implications.md) |
189
+ | 11, "mobile", "ios", "android", "background", "checkpoint" | Read [mobile-patterns.md](./references/mobile-patterns.md) |
190
+ | 12, "test", "testing", "verify", "validate" | Read [agent-native-testing.md](./references/agent-native-testing.md) |
191
+ | 13, "review", "refactor", "existing" | Read [refactoring-to-prompt-native.md](./references/refactoring-to-prompt-native.md) |
192
+
193
+ **After reading the reference, apply those patterns to the user's specific context.**
194
+ </routing>
195
+
196
+ <architecture_checklist>
197
+ ## Architecture Review Checklist
198
+
199
+ When designing an agent-native system, verify these **before implementation**:
200
+
201
+ ### Core Principles
202
+ - [ ] **Parity:** Every UI action has a corresponding agent capability
203
+ - [ ] **Granularity:** Tools are primitives; features are prompt-defined outcomes
204
+ - [ ] **Composability:** New features can be added via prompts alone
205
+ - [ ] **Emergent Capability:** Agent can handle open-ended requests in your domain
206
+
207
+ ### Tool Design
208
+ - [ ] **Dynamic vs Static:** For external APIs where agent should have full access, use Dynamic Capability Discovery
209
+ - [ ] **CRUD Completeness:** Every entity has create, read, update, AND delete
210
+ - [ ] **Primitives not Workflows:** Tools enable capability, don't encode business logic
211
+ - [ ] **API as Validator:** Use `z.string()` inputs when the API validates, not `z.enum()`
212
+
213
+ ### Files & Workspace
214
+ - [ ] **Shared Workspace:** Agent and user work in same data space
215
+ - [ ] **context.md Pattern:** Agent reads/updates context file for accumulated knowledge
216
+ - [ ] **File Organization:** Entity-scoped directories with consistent naming
217
+
218
+ ### Agent Execution
219
+ - [ ] **Completion Signals:** Agent has explicit `complete_task` tool (not heuristic detection)
220
+ - [ ] **Partial Completion:** Multi-step tasks track progress for resume
221
+ - [ ] **Context Limits:** Designed for bounded context from the start
222
+
223
+ ### Context Injection
224
+ - [ ] **Available Resources:** System prompt includes what exists (files, data, types)
225
+ - [ ] **Available Capabilities:** System prompt documents tools with user vocabulary
226
+ - [ ] **Dynamic Context:** Context refreshes for long sessions (or provide `refresh_context` tool)
227
+
228
+ ### UI Integration
229
+ - [ ] **Agent → UI:** Agent changes reflect in UI (shared service, file watching, or event bus)
230
+ - [ ] **No Silent Actions:** Agent writes trigger UI updates immediately
231
+ - [ ] **Capability Discovery:** Users can learn what agent can do
232
+
233
+ ### Mobile (if applicable)
234
+ - [ ] **Checkpoint/Resume:** Handle iOS app suspension gracefully
235
+ - [ ] **iCloud Storage:** iCloud-first with local fallback for multi-device sync
236
+ - [ ] **Cost Awareness:** Model tier selection (Haiku/Sonnet/Opus)
237
+
238
+ **When designing architecture, explicitly address each checkbox in your plan.**
239
+ </architecture_checklist>
240
+
241
+ <quick_start>
242
+ ## Quick Start: Build an Agent-Native Feature
243
+
244
+ **Step 1: Define atomic tools**
245
+ ```typescript
246
+ const tools = [
247
+ tool("read_file", "Read any file", { path: z.string() }, ...),
248
+ tool("write_file", "Write any file", { path: z.string(), content: z.string() }, ...),
249
+ tool("list_files", "List directory", { path: z.string() }, ...),
250
+ tool("complete_task", "Signal task completion", { summary: z.string() }, ...),
251
+ ];
252
+ ```
253
+
254
+ **Step 2: Write behavior in the system prompt**
255
+ ```markdown
256
+ ## Your Responsibilities
257
+ When asked to organize content, you should:
258
+ 1. Read existing files to understand the structure
259
+ 2. Analyze what organization makes sense
260
+ 3. Create/move files using your tools
261
+ 4. Use your judgment about layout and formatting
262
+ 5. Call complete_task when you're done
263
+
264
+ You decide the structure. Make it good.
265
+ ```
266
+
267
+ **Step 3: Let the agent work in a loop**
268
+ ```typescript
269
+ const result = await agent.run({
270
+ prompt: userMessage,
271
+ tools: tools,
272
+ systemPrompt: systemPrompt,
273
+ // Agent loops until it calls complete_task
274
+ });
275
+ ```
276
+ </quick_start>
277
+
278
+ <reference_index>
279
+ ## Reference Files
280
+
281
+ All references in `references/`:
282
+
283
+ **Core Patterns:**
284
+ - [architecture-patterns.md](./references/architecture-patterns.md) - Event-driven, unified orchestrator, agent-to-UI
285
+ - [files-universal-interface.md](./references/files-universal-interface.md) - Why files, organization patterns, context.md
286
+ - [mcp-tool-design.md](./references/mcp-tool-design.md) - Tool design, dynamic capability discovery, CRUD
287
+ - [from-primitives-to-domain-tools.md](./references/from-primitives-to-domain-tools.md) - When to add domain tools, graduating to code
288
+ - [agent-execution-patterns.md](./references/agent-execution-patterns.md) - Completion signals, partial completion, context limits
289
+ - [system-prompt-design.md](./references/system-prompt-design.md) - Features as prompts, judgment criteria
290
+
291
+ **Agent-Native Disciplines:**
292
+ - [dynamic-context-injection.md](./references/dynamic-context-injection.md) - Runtime context, what to inject
293
+ - [action-parity-discipline.md](./references/action-parity-discipline.md) - Capability mapping, parity workflow
294
+ - [shared-workspace-architecture.md](./references/shared-workspace-architecture.md) - Shared data space, UI integration
295
+ - [product-implications.md](./references/product-implications.md) - Progressive disclosure, latent demand, approval
296
+ - [agent-native-testing.md](./references/agent-native-testing.md) - Testing outcomes, parity tests
297
+
298
+ **Platform-Specific:**
299
+ - [mobile-patterns.md](./references/mobile-patterns.md) - iOS storage, checkpoint/resume, cost awareness
300
+ - [self-modification.md](./references/self-modification.md) - Git-based evolution, guardrails
301
+ - [refactoring-to-prompt-native.md](./references/refactoring-to-prompt-native.md) - Migrating existing code
302
+ </reference_index>
303
+
304
+ <anti_patterns>
305
+ ## Anti-Patterns
306
+
307
+ ### Common Approaches That Aren't Fully Agent-Native
308
+
309
+ These aren't necessarily wrong—they may be appropriate for your use case. But they're worth recognizing as different from the architecture this document describes.
310
+
311
+ **Agent as router** — The agent figures out what the user wants, then calls the right function. The agent's intelligence is used to route, not to act. This can work, but you're using a fraction of what agents can do.
312
+
313
+ **Build the app, then add agent** — You build features the traditional way (as code), then expose them to an agent. The agent can only do what your features already do. You won't get emergent capability.
314
+
315
+ **Request/response thinking** — Agent gets input, does one thing, returns output. This misses the loop: agent gets an outcome to achieve, operates until it's done, handles unexpected situations along the way.
316
+
317
+ **Defensive tool design** — You over-constrain tool inputs because you're used to defensive programming. Strict enums, validation at every layer. This is safe, but it prevents the agent from doing things you didn't anticipate.
318
+
319
+ **Happy path in code, agent just executes** — Traditional software handles edge cases in code—you write the logic for what happens when X goes wrong. Agent-native lets the agent handle edge cases with judgment. If your code handles all the edge cases, the agent is just a caller.
320
+
321
+ ---
322
+
323
+ ### Specific Anti-Patterns
324
+
325
+ **THE CARDINAL SIN: Agent executes your code instead of figuring things out**
326
+
327
+ ```typescript
328
+ // WRONG - You wrote the workflow, agent just executes it
329
+ tool("process_feedback", async ({ message }) => {
330
+ const category = categorize(message); // Your code decides
331
+ const priority = calculatePriority(message); // Your code decides
332
+ await store(message, category, priority); // Your code orchestrates
333
+ if (priority > 3) await notify(); // Your code decides
334
+ });
335
+
336
+ // RIGHT - Agent figures out how to process feedback
337
+ tools: store_item, send_message // Primitives
338
+ prompt: "Rate importance 1-5 based on actionability, store feedback, notify if >= 4"
339
+ ```
340
+
341
+ **Workflow-shaped tools** — `analyze_and_organize` bundles judgment into the tool. Break it into primitives and let the agent compose them.
342
+
343
+ **Context starvation** — Agent doesn't know what resources exist in the app.
344
+ ```
345
+ User: "Write something about Catherine the Great in my feed"
346
+ Agent: "What feed? I don't understand what system you're referring to."
347
+ ```
348
+ Fix: Inject available resources, capabilities, and vocabulary into system prompt.
349
+
350
+ **Orphan UI actions** — User can do something through the UI that the agent can't achieve. Fix: maintain parity.
351
+
352
+ **Silent actions** — Agent changes state but UI doesn't update. Fix: Use shared data stores with reactive binding, or file system observation.
353
+
354
+ **Heuristic completion detection** — Detecting agent completion through heuristics (consecutive iterations without tool calls, checking for expected output files). This is fragile. Fix: Require agents to explicitly signal completion through a `complete_task` tool.
355
+
356
+ **Static tool mapping for dynamic APIs** — Building 50 tools for 50 API endpoints when a `discover` + `access` pattern would give more flexibility.
357
+ ```typescript
358
+ // WRONG - Every API type needs a hardcoded tool
359
+ tool("read_steps", ...)
360
+ tool("read_heart_rate", ...)
361
+ tool("read_sleep", ...)
362
+ // When glucose tracking is added... code change required
363
+
364
+ // RIGHT - Dynamic capability discovery
365
+ tool("list_available_types", ...) // Discover what's available
366
+ tool("read_health_data", { dataType: z.string() }, ...) // Access any type
367
+ ```
368
+
369
+ **Incomplete CRUD** — Agent can create but not update or delete.
370
+ ```typescript
371
+ // User: "Delete that journal entry"
372
+ // Agent: "I don't have a tool for that"
373
+ tool("create_journal_entry", ...) // Missing: update, delete
374
+ ```
375
+ Fix: Every entity needs full CRUD.
376
+
377
+ **Sandbox isolation** — Agent works in separate data space from user.
378
+ ```
379
+ Documents/
380
+ ├── user_files/ ← User's space
381
+ └── agent_output/ ← Agent's space (isolated)
382
+ ```
383
+ Fix: Use shared workspace where both operate on same files.
384
+
385
+ **Gates without reason** — Domain tool is the only way to do something, and you didn't intend to restrict access. The default is open. Keep primitives available unless there's a specific reason to gate.
386
+
387
+ **Artificial capability limits** — Restricting what the agent can do out of vague safety concerns rather than specific risks. Be thoughtful about restricting capabilities. The agent should generally be able to do what users can do.
388
+ </anti_patterns>
389
+
390
+ <success_criteria>
391
+ ## Success Criteria
392
+
393
+ You've built an agent-native application when:
394
+
395
+ ### Architecture
396
+ - [ ] The agent can achieve anything users can achieve through the UI (parity)
397
+ - [ ] Tools are atomic primitives; domain tools are shortcuts, not gates (granularity)
398
+ - [ ] New features can be added by writing new prompts (composability)
399
+ - [ ] The agent can accomplish tasks you didn't explicitly design for (emergent capability)
400
+ - [ ] Changing behavior means editing prompts, not refactoring code
401
+
402
+ ### Implementation
403
+ - [ ] System prompt includes dynamic context about app state
404
+ - [ ] Every UI action has a corresponding agent tool (action parity)
405
+ - [ ] Agent tools are documented in system prompt with user vocabulary
406
+ - [ ] Agent and user work in the same data space (shared workspace)
407
+ - [ ] Agent actions are immediately reflected in the UI
408
+ - [ ] Every entity has full CRUD (Create, Read, Update, Delete)
409
+ - [ ] Agents explicitly signal completion (no heuristic detection)
410
+ - [ ] context.md or equivalent for accumulated knowledge
411
+
412
+ ### Product
413
+ - [ ] Simple requests work immediately with no learning curve
414
+ - [ ] Power users can push the system in unexpected directions
415
+ - [ ] You're learning what users want by observing what they ask the agent to do
416
+ - [ ] Approval requirements match stakes and reversibility
417
+
418
+ ### Mobile (if applicable)
419
+ - [ ] Checkpoint/resume handles app interruption
420
+ - [ ] iCloud-first storage with local fallback
421
+ - [ ] Background execution uses available time wisely
422
+ - [ ] Model tier matched to task complexity
423
+
424
+ ---
425
+
426
+ ### The Ultimate Test
427
+
428
+ **Describe an outcome to the agent that's within your application's domain but that you didn't build a specific feature for.**
429
+
430
+ Can it figure out how to accomplish it, operating in a loop until it succeeds?
431
+
432
+ If yes, you've built something agent-native.
433
+
434
+ If it says "I don't have a feature for that"—your architecture is still too constrained.
435
+ </success_criteria>