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.
- package/.agent/commands/test-browser.md +339 -0
- package/.agent/rules/00-constitution.md +46 -0
- package/.agent/rules/project-rules.md +49 -0
- package/.agent/skills/agent-browser/SKILL.md +223 -0
- package/.agent/skills/agent-native-architecture/SKILL.md +435 -0
- package/.agent/skills/agent-native-architecture/references/action-parity-discipline.md +409 -0
- package/.agent/skills/agent-native-architecture/references/agent-execution-patterns.md +467 -0
- package/.agent/skills/agent-native-architecture/references/agent-native-testing.md +582 -0
- package/.agent/skills/agent-native-architecture/references/architecture-patterns.md +478 -0
- package/.agent/skills/agent-native-architecture/references/dynamic-context-injection.md +338 -0
- package/.agent/skills/agent-native-architecture/references/files-universal-interface.md +301 -0
- package/.agent/skills/agent-native-architecture/references/from-primitives-to-domain-tools.md +359 -0
- package/.agent/skills/agent-native-architecture/references/mcp-tool-design.md +506 -0
- package/.agent/skills/agent-native-architecture/references/mobile-patterns.md +871 -0
- package/.agent/skills/agent-native-architecture/references/product-implications.md +443 -0
- package/.agent/skills/agent-native-architecture/references/refactoring-to-prompt-native.md +317 -0
- package/.agent/skills/agent-native-architecture/references/self-modification.md +269 -0
- package/.agent/skills/agent-native-architecture/references/shared-workspace-architecture.md +680 -0
- package/.agent/skills/agent-native-architecture/references/system-prompt-design.md +250 -0
- package/.agent/skills/agent-native-reviewer/SKILL.md +246 -0
- package/.agent/skills/andrew-kane-gem-writer/SKILL.md +184 -0
- package/.agent/skills/andrew-kane-gem-writer/references/database-adapters.md +231 -0
- package/.agent/skills/andrew-kane-gem-writer/references/module-organization.md +121 -0
- package/.agent/skills/andrew-kane-gem-writer/references/rails-integration.md +183 -0
- package/.agent/skills/andrew-kane-gem-writer/references/resources.md +119 -0
- package/.agent/skills/andrew-kane-gem-writer/references/testing-patterns.md +261 -0
- package/.agent/skills/ankane-readme-writer/SKILL.md +50 -0
- package/.agent/skills/architecture-strategist/SKILL.md +52 -0
- package/.agent/skills/best-practices-researcher/SKILL.md +100 -0
- package/.agent/skills/bug-reproduction-validator/SKILL.md +67 -0
- package/.agent/skills/code-simplicity-reviewer/SKILL.md +85 -0
- package/.agent/skills/coding-tutor/.claude-plugin/plugin.json +9 -0
- package/.agent/skills/coding-tutor/README.md +37 -0
- package/.agent/skills/coding-tutor/commands/quiz-me.md +1 -0
- package/.agent/skills/coding-tutor/commands/sync-tutorials.md +25 -0
- package/.agent/skills/coding-tutor/commands/teach-me.md +1 -0
- package/.agent/skills/coding-tutor/skills/coding-tutor/SKILL.md +214 -0
- package/.agent/skills/coding-tutor/skills/coding-tutor/scripts/create_tutorial.py +202 -0
- package/.agent/skills/coding-tutor/skills/coding-tutor/scripts/index_tutorials.py +203 -0
- package/.agent/skills/coding-tutor/skills/coding-tutor/scripts/quiz_priority.py +190 -0
- package/.agent/skills/coding-tutor/skills/coding-tutor/scripts/setup_tutorials.py +132 -0
- package/.agent/skills/compound-docs/SKILL.md +510 -0
- package/.agent/skills/compound-docs/assets/critical-pattern-template.md +34 -0
- package/.agent/skills/compound-docs/assets/resolution-template.md +93 -0
- package/.agent/skills/compound-docs/references/yaml-schema.md +65 -0
- package/.agent/skills/compound-docs/schema.yaml +176 -0
- package/.agent/skills/create-agent-skills/SKILL.md +299 -0
- package/.agent/skills/create-agent-skills/references/api-security.md +226 -0
- package/.agent/skills/create-agent-skills/references/be-clear-and-direct.md +531 -0
- package/.agent/skills/create-agent-skills/references/best-practices.md +404 -0
- package/.agent/skills/create-agent-skills/references/common-patterns.md +595 -0
- package/.agent/skills/create-agent-skills/references/core-principles.md +437 -0
- package/.agent/skills/create-agent-skills/references/executable-code.md +175 -0
- package/.agent/skills/create-agent-skills/references/iteration-and-testing.md +474 -0
- package/.agent/skills/create-agent-skills/references/official-spec.md +185 -0
- package/.agent/skills/create-agent-skills/references/recommended-structure.md +168 -0
- package/.agent/skills/create-agent-skills/references/skill-structure.md +372 -0
- package/.agent/skills/create-agent-skills/references/using-scripts.md +113 -0
- package/.agent/skills/create-agent-skills/references/using-templates.md +112 -0
- package/.agent/skills/create-agent-skills/references/workflows-and-validation.md +510 -0
- package/.agent/skills/create-agent-skills/templates/router-skill.md +73 -0
- package/.agent/skills/create-agent-skills/templates/simple-skill.md +33 -0
- package/.agent/skills/create-agent-skills/workflows/add-reference.md +96 -0
- package/.agent/skills/create-agent-skills/workflows/add-script.md +93 -0
- package/.agent/skills/create-agent-skills/workflows/add-template.md +74 -0
- package/.agent/skills/create-agent-skills/workflows/add-workflow.md +120 -0
- package/.agent/skills/create-agent-skills/workflows/audit-skill.md +138 -0
- package/.agent/skills/create-agent-skills/workflows/create-domain-expertise-skill.md +605 -0
- package/.agent/skills/create-agent-skills/workflows/create-new-skill.md +191 -0
- package/.agent/skills/create-agent-skills/workflows/get-guidance.md +121 -0
- package/.agent/skills/create-agent-skills/workflows/upgrade-to-router.md +161 -0
- package/.agent/skills/create-agent-skills/workflows/verify-skill.md +204 -0
- package/.agent/skills/data-integrity-guardian/SKILL.md +70 -0
- package/.agent/skills/data-migration-expert/SKILL.md +97 -0
- package/.agent/skills/deployment-verification-agent/SKILL.md +159 -0
- package/.agent/skills/design-implementation-reviewer/SKILL.md +85 -0
- package/.agent/skills/design-iterator/SKILL.md +197 -0
- package/.agent/skills/dhh-rails-reviewer/SKILL.md +45 -0
- package/.agent/skills/dhh-rails-style/SKILL.md +184 -0
- package/.agent/skills/dhh-rails-style/references/architecture.md +653 -0
- package/.agent/skills/dhh-rails-style/references/controllers.md +303 -0
- package/.agent/skills/dhh-rails-style/references/frontend.md +510 -0
- package/.agent/skills/dhh-rails-style/references/gems.md +266 -0
- package/.agent/skills/dhh-rails-style/references/models.md +359 -0
- package/.agent/skills/dhh-rails-style/references/testing.md +338 -0
- package/.agent/skills/dspy-ruby/SKILL.md +594 -0
- package/.agent/skills/dspy-ruby/assets/config-template.rb +359 -0
- package/.agent/skills/dspy-ruby/assets/module-template.rb +326 -0
- package/.agent/skills/dspy-ruby/assets/signature-template.rb +143 -0
- package/.agent/skills/dspy-ruby/references/core-concepts.md +265 -0
- package/.agent/skills/dspy-ruby/references/optimization.md +623 -0
- package/.agent/skills/dspy-ruby/references/providers.md +305 -0
- package/.agent/skills/every-style-editor/SKILL.md +134 -0
- package/.agent/skills/every-style-editor/references/EVERY_WRITE_STYLE.md +529 -0
- package/.agent/skills/figma-design-sync/SKILL.md +166 -0
- package/.agent/skills/file-todos/SKILL.md +251 -0
- package/.agent/skills/file-todos/assets/todo-template.md +155 -0
- package/.agent/skills/framework-docs-researcher/SKILL.md +83 -0
- package/.agent/skills/frontend-design/SKILL.md +42 -0
- package/.agent/skills/gemini-imagegen/SKILL.md +237 -0
- package/.agent/skills/gemini-imagegen/requirements.txt +2 -0
- package/.agent/skills/gemini-imagegen/scripts/compose_images.py +168 -0
- package/.agent/skills/gemini-imagegen/scripts/edit_image.py +157 -0
- package/.agent/skills/gemini-imagegen/scripts/gemini_images.py +265 -0
- package/.agent/skills/gemini-imagegen/scripts/generate_image.py +147 -0
- package/.agent/skills/gemini-imagegen/scripts/multi_turn_chat.py +215 -0
- package/.agent/skills/git-history-analyzer/SKILL.md +42 -0
- package/.agent/skills/git-worktree/SKILL.md +302 -0
- package/.agent/skills/git-worktree/scripts/worktree-manager.sh +345 -0
- package/.agent/skills/julik-frontend-races-reviewer/SKILL.md +222 -0
- package/.agent/skills/kieran-python-reviewer/SKILL.md +104 -0
- package/.agent/skills/kieran-rails-reviewer/SKILL.md +86 -0
- package/.agent/skills/kieran-typescript-reviewer/SKILL.md +95 -0
- package/.agent/skills/lint/SKILL.md +16 -0
- package/.agent/skills/pattern-recognition-specialist/SKILL.md +57 -0
- package/.agent/skills/performance-oracle/SKILL.md +110 -0
- package/.agent/skills/pr-comment-resolver/SKILL.md +69 -0
- package/.agent/skills/rclone/SKILL.md +150 -0
- package/.agent/skills/rclone/scripts/check_setup.sh +60 -0
- package/.agent/skills/repo-research-analyst/SKILL.md +113 -0
- package/.agent/skills/security-sentinel/SKILL.md +93 -0
- package/.agent/skills/skill-creator/SKILL.md +209 -0
- package/.agent/skills/skill-creator/scripts/init_skill.py +304 -0
- package/.agent/skills/skill-creator/scripts/package_skill.py +112 -0
- package/.agent/skills/skill-creator/scripts/quick_validate.py +72 -0
- package/.agent/skills/spec-flow-analyzer/SKILL.md +113 -0
- package/.agent/skills/test-agent/SKILL.md +4 -0
- package/.agent/workflows/agent-native-audit.md +277 -0
- package/.agent/workflows/ask-user-question.md +21 -0
- package/.agent/workflows/changelog.md +137 -0
- package/.agent/workflows/compound.md +202 -0
- package/.agent/workflows/create-agent-skill.md +8 -0
- package/.agent/workflows/deepen-plan-research.md +334 -0
- package/.agent/workflows/deepen-plan-synthesis.md +182 -0
- package/.agent/workflows/deepen-plan.md +79 -0
- package/.agent/workflows/feature-video.md +342 -0
- package/.agent/workflows/generate-command.md +162 -0
- package/.agent/workflows/heal-skill.md +142 -0
- package/.agent/workflows/lfg.md +20 -0
- package/.agent/workflows/plan-analysis.md +67 -0
- package/.agent/workflows/plan-next-steps.md +63 -0
- package/.agent/workflows/plan-review.md +33 -0
- package/.agent/workflows/plan-synthesis.md +106 -0
- package/.agent/workflows/plan.md +49 -0
- package/.agent/workflows/report-bug.md +150 -0
- package/.agent/workflows/reproduce-bug.md +99 -0
- package/.agent/workflows/resolve-parallel.md +34 -0
- package/.agent/workflows/resolve-pr-parallel.md +49 -0
- package/.agent/workflows/resolve-todo-parallel.md +35 -0
- package/.agent/workflows/review-analysis.md +145 -0
- package/.agent/workflows/review-synthesis.md +262 -0
- package/.agent/workflows/review.md +64 -0
- package/.agent/workflows/ship.md +90 -0
- package/.agent/workflows/test-command.md +3 -0
- package/.agent/workflows/triage.md +310 -0
- package/.agent/workflows/work.md +157 -0
- package/.agent/workflows/xcode-test.md +332 -0
- package/LICENSE +22 -0
- package/README.md +49 -0
- package/bin/ag-cortex.js +54 -0
- package/lib/core.js +165 -0
- package/package.json +31 -0
|
@@ -0,0 +1,409 @@
|
|
|
1
|
+
<overview>
|
|
2
|
+
A structured discipline for ensuring agents can do everything users can do. Every UI action should have an equivalent agent tool. This isn't a one-time check—it's an ongoing practice integrated into your development workflow.
|
|
3
|
+
|
|
4
|
+
**Core principle:** When adding a UI feature, add the corresponding tool in the same PR.
|
|
5
|
+
</overview>
|
|
6
|
+
|
|
7
|
+
<why_parity>
|
|
8
|
+
## Why Action Parity Matters
|
|
9
|
+
|
|
10
|
+
**The failure case:**
|
|
11
|
+
```
|
|
12
|
+
User: "Write something about Catherine the Great in my reading feed"
|
|
13
|
+
Agent: "What system are you referring to? I'm not sure what reading feed means."
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
The user could publish to their feed through the UI. But the agent had no `publish_to_feed` tool. The fix was simple—add the tool. But the insight is profound:
|
|
17
|
+
|
|
18
|
+
**Every action a user can take through the UI must have an equivalent tool the agent can call.**
|
|
19
|
+
|
|
20
|
+
Without this parity:
|
|
21
|
+
- Users ask agents to do things they can't do
|
|
22
|
+
- Agents ask clarifying questions about features they should understand
|
|
23
|
+
- The agent feels limited compared to direct app usage
|
|
24
|
+
- Users lose trust in the agent's capabilities
|
|
25
|
+
</why_parity>
|
|
26
|
+
|
|
27
|
+
<capability_mapping>
|
|
28
|
+
## The Capability Map
|
|
29
|
+
|
|
30
|
+
Maintain a structured map of UI actions to agent tools:
|
|
31
|
+
|
|
32
|
+
| UI Action | UI Location | Agent Tool | System Prompt Reference |
|
|
33
|
+
|-----------|-------------|------------|-------------------------|
|
|
34
|
+
| View library | Library tab | `read_library` | "View books and highlights" |
|
|
35
|
+
| Add book | Library → Add | `add_book` | "Add books to library" |
|
|
36
|
+
| Publish insight | Analysis view | `publish_to_feed` | "Create insights for Feed tab" |
|
|
37
|
+
| Start research | Book detail | `start_research` | "Research books via web search" |
|
|
38
|
+
| Edit profile | Settings | `write_file(profile.md)` | "Update reading profile" |
|
|
39
|
+
| Take screenshot | Camera | N/A (user action) | — |
|
|
40
|
+
| Search web | Chat | `web_search` | "Search the internet" |
|
|
41
|
+
|
|
42
|
+
**Update this table whenever adding features.**
|
|
43
|
+
|
|
44
|
+
### Template for Your App
|
|
45
|
+
|
|
46
|
+
```markdown
|
|
47
|
+
# Capability Map - [Your App Name]
|
|
48
|
+
|
|
49
|
+
| UI Action | UI Location | Agent Tool | System Prompt | Status |
|
|
50
|
+
|-----------|-------------|------------|---------------|--------|
|
|
51
|
+
| | | | | ⚠️ Missing |
|
|
52
|
+
| | | | | ✅ Done |
|
|
53
|
+
| | | | | 🚫 N/A |
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Status meanings:
|
|
57
|
+
- ✅ Done: Tool exists and is documented in system prompt
|
|
58
|
+
- ⚠️ Missing: UI action exists but no agent equivalent
|
|
59
|
+
- 🚫 N/A: User-only action (e.g., biometric auth, camera capture)
|
|
60
|
+
</capability_mapping>
|
|
61
|
+
|
|
62
|
+
<parity_workflow>
|
|
63
|
+
## The Action Parity Workflow
|
|
64
|
+
|
|
65
|
+
### When Adding a New Feature
|
|
66
|
+
|
|
67
|
+
Before merging any PR that adds UI functionality:
|
|
68
|
+
|
|
69
|
+
```
|
|
70
|
+
1. What action is this?
|
|
71
|
+
→ "User can publish an insight to their reading feed"
|
|
72
|
+
|
|
73
|
+
2. Does an agent tool exist for this?
|
|
74
|
+
→ Check tool definitions
|
|
75
|
+
→ If NO: Create the tool
|
|
76
|
+
|
|
77
|
+
3. Is it documented in the system prompt?
|
|
78
|
+
→ Check system prompt capabilities section
|
|
79
|
+
→ If NO: Add documentation
|
|
80
|
+
|
|
81
|
+
4. Is the context available?
|
|
82
|
+
→ Does agent know what "feed" means?
|
|
83
|
+
→ Does agent see available books?
|
|
84
|
+
→ If NO: Add to context injection
|
|
85
|
+
|
|
86
|
+
5. Update the capability map
|
|
87
|
+
→ Add row to tracking document
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### PR Checklist
|
|
91
|
+
|
|
92
|
+
Add to your PR template:
|
|
93
|
+
|
|
94
|
+
```markdown
|
|
95
|
+
## Agent-Native Checklist
|
|
96
|
+
|
|
97
|
+
- [ ] Every new UI action has a corresponding agent tool
|
|
98
|
+
- [ ] System prompt updated to mention new capability
|
|
99
|
+
- [ ] Agent has access to same data UI uses
|
|
100
|
+
- [ ] Capability map updated
|
|
101
|
+
- [ ] Tested with natural language request
|
|
102
|
+
```
|
|
103
|
+
</parity_workflow>
|
|
104
|
+
|
|
105
|
+
<parity_audit>
|
|
106
|
+
## The Parity Audit
|
|
107
|
+
|
|
108
|
+
Periodically audit your app for action parity gaps:
|
|
109
|
+
|
|
110
|
+
### Step 1: List All UI Actions
|
|
111
|
+
|
|
112
|
+
Walk through every screen and list what users can do:
|
|
113
|
+
|
|
114
|
+
```
|
|
115
|
+
Library Screen:
|
|
116
|
+
- View list of books
|
|
117
|
+
- Search books
|
|
118
|
+
- Filter by category
|
|
119
|
+
- Add new book
|
|
120
|
+
- Delete book
|
|
121
|
+
- Open book detail
|
|
122
|
+
|
|
123
|
+
Book Detail Screen:
|
|
124
|
+
- View book info
|
|
125
|
+
- Start research
|
|
126
|
+
- View highlights
|
|
127
|
+
- Add highlight
|
|
128
|
+
- Share book
|
|
129
|
+
- Remove from library
|
|
130
|
+
|
|
131
|
+
Feed Screen:
|
|
132
|
+
- View insights
|
|
133
|
+
- Create new insight
|
|
134
|
+
- Edit insight
|
|
135
|
+
- Delete insight
|
|
136
|
+
- Share insight
|
|
137
|
+
|
|
138
|
+
Settings:
|
|
139
|
+
- Edit profile
|
|
140
|
+
- Change theme
|
|
141
|
+
- Export data
|
|
142
|
+
- Delete account
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### Step 2: Check Tool Coverage
|
|
146
|
+
|
|
147
|
+
For each action, verify:
|
|
148
|
+
|
|
149
|
+
```
|
|
150
|
+
✅ View list of books → read_library
|
|
151
|
+
✅ Search books → read_library (with query param)
|
|
152
|
+
⚠️ Filter by category → MISSING (add filter param to read_library)
|
|
153
|
+
⚠️ Add new book → MISSING (need add_book tool)
|
|
154
|
+
✅ Delete book → delete_book
|
|
155
|
+
✅ Open book detail → read_library (single book)
|
|
156
|
+
|
|
157
|
+
✅ Start research → start_research
|
|
158
|
+
✅ View highlights → read_library (includes highlights)
|
|
159
|
+
⚠️ Add highlight → MISSING (need add_highlight tool)
|
|
160
|
+
⚠️ Share book → MISSING (or N/A if sharing is UI-only)
|
|
161
|
+
|
|
162
|
+
✅ View insights → read_library (includes feed)
|
|
163
|
+
✅ Create new insight → publish_to_feed
|
|
164
|
+
⚠️ Edit insight → MISSING (need update_feed_item tool)
|
|
165
|
+
⚠️ Delete insight → MISSING (need delete_feed_item tool)
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
### Step 3: Prioritize Gaps
|
|
169
|
+
|
|
170
|
+
Not all gaps are equal:
|
|
171
|
+
|
|
172
|
+
**High priority (users will ask for this):**
|
|
173
|
+
- Add new book
|
|
174
|
+
- Create/edit/delete content
|
|
175
|
+
- Core workflow actions
|
|
176
|
+
|
|
177
|
+
**Medium priority (occasional requests):**
|
|
178
|
+
- Filter/search variations
|
|
179
|
+
- Export functionality
|
|
180
|
+
- Sharing features
|
|
181
|
+
|
|
182
|
+
**Low priority (rarely requested via agent):**
|
|
183
|
+
- Theme changes
|
|
184
|
+
- Account deletion
|
|
185
|
+
- Settings that are UI-preference
|
|
186
|
+
</parity_audit>
|
|
187
|
+
|
|
188
|
+
<tool_design_for_parity>
|
|
189
|
+
## Designing Tools for Parity
|
|
190
|
+
|
|
191
|
+
### Match Tool Granularity to UI Granularity
|
|
192
|
+
|
|
193
|
+
If the UI has separate buttons for "Edit" and "Delete", consider separate tools:
|
|
194
|
+
|
|
195
|
+
```typescript
|
|
196
|
+
// Matches UI granularity
|
|
197
|
+
tool("update_feed_item", { id, content, headline }, ...);
|
|
198
|
+
tool("delete_feed_item", { id }, ...);
|
|
199
|
+
|
|
200
|
+
// vs. combined (harder for agent to discover)
|
|
201
|
+
tool("modify_feed_item", { id, action: "update" | "delete", ... }, ...);
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
### Use User Vocabulary in Tool Names
|
|
205
|
+
|
|
206
|
+
```typescript
|
|
207
|
+
// Good: Matches what users say
|
|
208
|
+
tool("publish_to_feed", ...); // "publish to my feed"
|
|
209
|
+
tool("add_book", ...); // "add this book"
|
|
210
|
+
tool("start_research", ...); // "research this"
|
|
211
|
+
|
|
212
|
+
// Bad: Technical jargon
|
|
213
|
+
tool("create_analysis_record", ...);
|
|
214
|
+
tool("insert_library_item", ...);
|
|
215
|
+
tool("initiate_web_scrape_workflow", ...);
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
### Return What the UI Shows
|
|
219
|
+
|
|
220
|
+
If the UI shows a confirmation with details, the tool should too:
|
|
221
|
+
|
|
222
|
+
```typescript
|
|
223
|
+
// UI shows: "Added 'Moby Dick' to your library"
|
|
224
|
+
// Tool should return the same:
|
|
225
|
+
tool("add_book", async ({ title, author }) => {
|
|
226
|
+
const book = await library.add({ title, author });
|
|
227
|
+
return {
|
|
228
|
+
text: `Added "${book.title}" by ${book.author} to your library (id: ${book.id})`
|
|
229
|
+
};
|
|
230
|
+
});
|
|
231
|
+
```
|
|
232
|
+
</tool_design_for_parity>
|
|
233
|
+
|
|
234
|
+
<context_parity>
|
|
235
|
+
## Context Parity
|
|
236
|
+
|
|
237
|
+
Whatever the user sees, the agent should be able to access.
|
|
238
|
+
|
|
239
|
+
### The Problem
|
|
240
|
+
|
|
241
|
+
```swift
|
|
242
|
+
// UI shows recent analyses in a list
|
|
243
|
+
ForEach(analysisRecords) { record in
|
|
244
|
+
AnalysisRow(record: record)
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
// But system prompt only mentions books, not analyses
|
|
248
|
+
let systemPrompt = """
|
|
249
|
+
## Available Books
|
|
250
|
+
\(books.map { $0.title })
|
|
251
|
+
// Missing: recent analyses!
|
|
252
|
+
"""
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
The user sees their reading journal. The agent doesn't. This creates a disconnect.
|
|
256
|
+
|
|
257
|
+
### The Fix
|
|
258
|
+
|
|
259
|
+
```swift
|
|
260
|
+
// System prompt includes what UI shows
|
|
261
|
+
let systemPrompt = """
|
|
262
|
+
## Available Books
|
|
263
|
+
\(books.map { "- \($0.title)" }.joined(separator: "\n"))
|
|
264
|
+
|
|
265
|
+
## Recent Reading Journal
|
|
266
|
+
\(analysisRecords.prefix(10).map { "- \($0.summary)" }.joined(separator: "\n"))
|
|
267
|
+
"""
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
### Context Parity Checklist
|
|
271
|
+
|
|
272
|
+
For each screen in your app:
|
|
273
|
+
- [ ] What data does this screen display?
|
|
274
|
+
- [ ] Is that data available to the agent?
|
|
275
|
+
- [ ] Can the agent access the same level of detail?
|
|
276
|
+
</context_parity>
|
|
277
|
+
|
|
278
|
+
<continuous_parity>
|
|
279
|
+
## Maintaining Parity Over Time
|
|
280
|
+
|
|
281
|
+
### Git Hooks / CI Checks
|
|
282
|
+
|
|
283
|
+
```bash
|
|
284
|
+
#!/bin/bash
|
|
285
|
+
# pre-commit hook: check for new UI actions without tools
|
|
286
|
+
|
|
287
|
+
# Find new SwiftUI Button/onTapGesture additions
|
|
288
|
+
NEW_ACTIONS=$(git diff --cached --name-only | xargs grep -l "Button\|onTapGesture")
|
|
289
|
+
|
|
290
|
+
if [ -n "$NEW_ACTIONS" ]; then
|
|
291
|
+
echo "⚠️ New UI actions detected. Did you add corresponding agent tools?"
|
|
292
|
+
echo "Files: $NEW_ACTIONS"
|
|
293
|
+
echo ""
|
|
294
|
+
echo "Checklist:"
|
|
295
|
+
echo " [ ] Agent tool exists for new action"
|
|
296
|
+
echo " [ ] System prompt documents new capability"
|
|
297
|
+
echo " [ ] Capability map updated"
|
|
298
|
+
fi
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
### Automated Parity Testing
|
|
302
|
+
|
|
303
|
+
```typescript
|
|
304
|
+
// parity.test.ts
|
|
305
|
+
describe('Action Parity', () => {
|
|
306
|
+
const capabilityMap = loadCapabilityMap();
|
|
307
|
+
|
|
308
|
+
for (const [action, toolName] of Object.entries(capabilityMap)) {
|
|
309
|
+
if (toolName === 'N/A') continue;
|
|
310
|
+
|
|
311
|
+
test(`${action} has agent tool: ${toolName}`, () => {
|
|
312
|
+
expect(agentTools.map(t => t.name)).toContain(toolName);
|
|
313
|
+
});
|
|
314
|
+
|
|
315
|
+
test(`${toolName} is documented in system prompt`, () => {
|
|
316
|
+
expect(systemPrompt).toContain(toolName);
|
|
317
|
+
});
|
|
318
|
+
}
|
|
319
|
+
});
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
### Regular Audits
|
|
323
|
+
|
|
324
|
+
Schedule periodic reviews:
|
|
325
|
+
|
|
326
|
+
```markdown
|
|
327
|
+
## Monthly Parity Audit
|
|
328
|
+
|
|
329
|
+
1. Review all PRs merged this month
|
|
330
|
+
2. Check each for new UI actions
|
|
331
|
+
3. Verify tool coverage
|
|
332
|
+
4. Update capability map
|
|
333
|
+
5. Test with natural language requests
|
|
334
|
+
```
|
|
335
|
+
</continuous_parity>
|
|
336
|
+
|
|
337
|
+
<examples>
|
|
338
|
+
## Real Example: The Feed Gap
|
|
339
|
+
|
|
340
|
+
**Before:** Every Reader had a feed where insights appeared, but no agent tool to publish there.
|
|
341
|
+
|
|
342
|
+
```
|
|
343
|
+
User: "Write something about Catherine the Great in my reading feed"
|
|
344
|
+
Agent: "I'm not sure what system you're referring to. Could you clarify?"
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
**Diagnosis:**
|
|
348
|
+
- ✅ UI action: User can publish insights from the analysis view
|
|
349
|
+
- ❌ Agent tool: No `publish_to_feed` tool
|
|
350
|
+
- ❌ System prompt: No mention of "feed" or how to publish
|
|
351
|
+
- ❌ Context: Agent didn't know what "feed" meant
|
|
352
|
+
|
|
353
|
+
**Fix:**
|
|
354
|
+
|
|
355
|
+
```swift
|
|
356
|
+
// 1. Add the tool
|
|
357
|
+
tool("publish_to_feed",
|
|
358
|
+
"Publish an insight to the user's reading feed",
|
|
359
|
+
{
|
|
360
|
+
bookId: z.string().describe("Book ID"),
|
|
361
|
+
content: z.string().describe("The insight content"),
|
|
362
|
+
headline: z.string().describe("A punchy headline")
|
|
363
|
+
},
|
|
364
|
+
async ({ bookId, content, headline }) => {
|
|
365
|
+
await feedService.publish({ bookId, content, headline });
|
|
366
|
+
return { text: `Published "${headline}" to your reading feed` };
|
|
367
|
+
}
|
|
368
|
+
);
|
|
369
|
+
|
|
370
|
+
// 2. Update system prompt
|
|
371
|
+
"""
|
|
372
|
+
## Your Capabilities
|
|
373
|
+
|
|
374
|
+
- **Publish to Feed**: Create insights that appear in the Feed tab using `publish_to_feed`.
|
|
375
|
+
Include a book_id, content, and a punchy headline.
|
|
376
|
+
"""
|
|
377
|
+
|
|
378
|
+
// 3. Add to context injection
|
|
379
|
+
"""
|
|
380
|
+
When the user mentions "the feed" or "reading feed", they mean the Feed tab
|
|
381
|
+
where insights appear. Use `publish_to_feed` to create content there.
|
|
382
|
+
"""
|
|
383
|
+
```
|
|
384
|
+
|
|
385
|
+
**After:**
|
|
386
|
+
```
|
|
387
|
+
User: "Write something about Catherine the Great in my reading feed"
|
|
388
|
+
Agent: [Uses publish_to_feed to create insight]
|
|
389
|
+
"Done! I've published 'The Enlightened Empress' to your reading feed."
|
|
390
|
+
```
|
|
391
|
+
</examples>
|
|
392
|
+
|
|
393
|
+
<checklist>
|
|
394
|
+
## Action Parity Checklist
|
|
395
|
+
|
|
396
|
+
For every PR with UI changes:
|
|
397
|
+
- [ ] Listed all new UI actions
|
|
398
|
+
- [ ] Verified agent tool exists for each action
|
|
399
|
+
- [ ] Updated system prompt with new capabilities
|
|
400
|
+
- [ ] Added to capability map
|
|
401
|
+
- [ ] Tested with natural language request
|
|
402
|
+
|
|
403
|
+
For periodic audits:
|
|
404
|
+
- [ ] Walked through every screen
|
|
405
|
+
- [ ] Listed all possible user actions
|
|
406
|
+
- [ ] Checked tool coverage for each
|
|
407
|
+
- [ ] Prioritized gaps by likelihood of user request
|
|
408
|
+
- [ ] Created issues for high-priority gaps
|
|
409
|
+
</checklist>
|