total-recall-brain 3.13.0 → 3.13.2

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 (152) hide show
  1. package/README.md +91 -108
  2. package/bin/antigravity.mjs +81 -52
  3. package/bin/total-recall.mjs +32 -57
  4. package/extension/background.js +1 -1
  5. package/extension/options/options.js +9 -3
  6. package/extension/sidepanel/sidepanel.js +0 -2
  7. package/frontend/index.html +4 -3
  8. package/frontend/package.json +1 -0
  9. package/frontend/src/App.tsx +109 -152
  10. package/frontend/src/api.ts +605 -23
  11. package/frontend/src/components/BrainSelector.tsx +211 -199
  12. package/frontend/src/components/DocumentEditorModal.tsx +57 -0
  13. package/frontend/src/components/DocumentTable.tsx +47 -0
  14. package/frontend/src/components/Graph3D.tsx +120 -71
  15. package/frontend/src/components/UsageChart.tsx +3 -3
  16. package/frontend/src/components/brand/BrandMark.tsx +95 -0
  17. package/frontend/src/index.css +286 -86
  18. package/frontend/src/pages/ApiKeysPage.tsx +1878 -215
  19. package/frontend/src/pages/ChatPage.tsx +103 -45
  20. package/frontend/src/pages/DesignDocsPage.tsx +5 -5
  21. package/frontend/src/pages/FilesPage.tsx +10 -6
  22. package/frontend/src/pages/GraphPage.tsx +5 -3
  23. package/frontend/src/pages/HelpPage.tsx +2 -2
  24. package/frontend/src/pages/InboxPage.tsx +82 -0
  25. package/frontend/src/pages/InstructionsPage.tsx +1 -1
  26. package/frontend/src/pages/IntegrationsPage.tsx +21 -10
  27. package/frontend/src/pages/LoginPage.tsx +95 -77
  28. package/frontend/src/pages/MemoryPage.tsx +31 -8
  29. package/frontend/src/pages/OnboardingPage.tsx +690 -0
  30. package/frontend/src/pages/OpenWikiPage.tsx +412 -323
  31. package/frontend/src/pages/SettingsPage.tsx +825 -922
  32. package/frontend/src/pages/SkillsPage.tsx +272 -147
  33. package/frontend/src/pages/UsagePage.tsx +23 -31
  34. package/frontend/src/pages/VaultPage.tsx +223 -0
  35. package/frontend/src/types.ts +13 -0
  36. package/package.json +4 -4
  37. package/scaffold/.agent/skills/total-recall/SKILL.md +43 -4
  38. package/scaffold/.agent/skills/total-recall/modules/README.md +10 -0
  39. package/scaffold/.agent/skills/total-recall/modules/agents/README.md +5 -0
  40. package/scaffold/.agent/skills/total-recall/{skills/tr-cli-agents → modules/agents}/agents.yml +8 -0
  41. package/scaffold/.agent/skills/total-recall/modules/skill-deploy/README.md +9 -0
  42. package/scaffold/.agent/skills/total-recall/openwiki/README.md +10 -0
  43. package/scaffold/.agent/skills/total-recall/openwiki/architecture.md +5 -0
  44. package/scaffold/.agent/skills/total-recall/openwiki/ide.md +10 -0
  45. package/scaffold/.agent/skills/total-recall/openwiki/memory.md +11 -0
  46. package/scaffold/.agent/skills/total-recall/openwiki/secrets.md +7 -0
  47. package/scaffold/.agent/skills/total-recall/openwiki/skills.md +7 -0
  48. package/src/cli/brain.mjs +63 -5
  49. package/src/cli/connect.mjs +11 -19
  50. package/src/cli/daemon.mjs +5 -4
  51. package/src/cli/deploy-ui.mjs +8 -3
  52. package/src/cli/deploy.mjs +84 -27
  53. package/src/cli/ingest/index.mjs +1 -1
  54. package/src/cli/init.mjs +63 -34
  55. package/src/cli/remember.mjs +3 -3
  56. package/src/cli/secret.mjs +812 -0
  57. package/src/cli/setup.mjs +34 -7
  58. package/src/cli/share.mjs +2 -2
  59. package/src/cli/skill.mjs +396 -35
  60. package/src/cli/sync.mjs +4 -4
  61. package/src/cli/task.mjs +287 -0
  62. package/src/core/clarity-rewriter.mjs +5 -5
  63. package/src/core/config.mjs +44 -2
  64. package/src/core/conflict-detector.mjs +5 -5
  65. package/src/core/crons.mjs +54 -0
  66. package/src/core/daemon-loop.mjs +87 -235
  67. package/src/core/dream.mjs +170 -10
  68. package/src/core/env-import.mjs +456 -0
  69. package/src/core/fact-seeker.mjs +14 -14
  70. package/src/core/import-rules.mjs +20 -7
  71. package/src/core/inference-engine.mjs +3 -3
  72. package/src/core/migrate.mjs +14 -8
  73. package/src/core/okf-adapter.mjs +2 -2
  74. package/src/core/operation-validator.mjs +39 -331
  75. package/src/core/optimizer.mjs +7 -0
  76. package/src/core/post-mortem.mjs +2 -2
  77. package/src/core/project-brain.mjs +349 -0
  78. package/src/core/provider-catalog.mjs +296 -0
  79. package/src/core/quick-capture.mjs +1 -1
  80. package/src/core/remote-vault-sync.mjs +194 -0
  81. package/src/core/research-queue.mjs +7 -11
  82. package/src/core/runtime.mjs +33 -9
  83. package/src/core/scheduler.mjs +59 -5
  84. package/src/core/schema.mjs +14 -0
  85. package/src/core/search.mjs +1 -1
  86. package/src/core/secrets-env-export.mjs +323 -0
  87. package/src/core/secrets-rotate.mjs +245 -0
  88. package/src/core/secrets-store.mjs +645 -0
  89. package/src/core/semantic-index.mjs +3 -3
  90. package/src/core/skills-registry.mjs +1062 -0
  91. package/src/core/source-adapters.mjs +4 -1
  92. package/src/core/ssss-host-extension.mjs +94 -0
  93. package/src/core/ssss-kernel-bridge.mjs +530 -0
  94. package/src/core/surface.mjs +14 -0
  95. package/src/core/task-envelope.mjs +298 -0
  96. package/src/core/task-executors.mjs +600 -0
  97. package/src/core/validated-write.mjs +124 -56
  98. package/src/core/vault.mjs +21 -34
  99. package/src/core/webauthn-store.mjs +272 -0
  100. package/src/server/api.mjs +26 -16
  101. package/src/server/auth.mjs +51 -0
  102. package/src/server/index.mjs +3 -3
  103. package/src/server/keys.mjs +30 -4
  104. package/src/server/rest.mjs +198 -25
  105. package/src/server/route-manifest.json +156 -0
  106. package/src/server/routes/_shared.mjs +40 -1
  107. package/src/server/routes/docs.mjs +260 -0
  108. package/src/server/routes/memory.mjs +145 -32
  109. package/src/server/routes/research.mjs +30 -0
  110. package/src/server/routes/secrets.mjs +470 -0
  111. package/src/server/routes/share.mjs +2 -2
  112. package/src/server/routes/skills.mjs +452 -54
  113. package/src/server/routes/sync.mjs +48 -0
  114. package/src/server/routes/webauthn.mjs +184 -0
  115. package/src/server/update-route-manifest.mjs +39 -0
  116. package/templates/onboarding-interview.md +32 -22
  117. package/templates/openwiki/README.md +10 -0
  118. package/templates/openwiki/architecture.md +5 -0
  119. package/templates/openwiki/ide.md +10 -0
  120. package/templates/openwiki/memory.md +11 -0
  121. package/templates/openwiki/secrets.md +7 -0
  122. package/templates/openwiki/skills.md +7 -0
  123. package/scaffold/.agent/skills/total-recall/skills/tr-cli-agents/SKILL.md +0 -121
  124. package/scaffold/.agent/skills/total-recall/skills/tr-cli-agents/references/antigravity.txt +0 -20
  125. package/scaffold/.agent/skills/total-recall/skills/tr-cli-agents/references/claude.txt +0 -58
  126. package/scaffold/.agent/skills/total-recall/skills/tr-cli-agents/references/codex.txt +0 -81
  127. package/scaffold/.agent/skills/total-recall/skills/tr-cli-agents/references/gemini.txt +0 -44
  128. package/scaffold/.agent/skills/total-recall/skills/tr-cli-agents/scripts/.gitkeep +0 -0
  129. package/scaffold/.agent/skills/total-recall/skills/tr-cli-agents/subagents/.gitkeep +0 -0
  130. package/scaffold/.agent/skills/total-recall/skills/tr-research/SKILL.md +0 -338
  131. package/scaffold/.agent/skills/total-recall/skills/tr-skill/SKILL.md +0 -282
  132. package/scaffold/.agent/skills/total-recall/skills/tr-skill/assets/skill-template/SKILL.md +0 -20
  133. package/scaffold/.agent/skills/total-recall/skills/tr-skill/evals/evals.json +0 -20
  134. package/scaffold/.agent/skills/total-recall/skills/tr-skill/hooks/on-skill-add.sh +0 -14
  135. package/scaffold/.agent/skills/total-recall/skills/tr-skill/hooks/on-skill-delete.sh +0 -14
  136. package/scaffold/.agent/skills/total-recall/skills/tr-skill/learnings/.gitkeep +0 -0
  137. package/scaffold/.agent/skills/total-recall/skills/tr-skill/references/.gitkeep +0 -0
  138. package/scaffold/.agent/skills/total-recall/skills/tr-skill/scripts/.gitkeep +0 -0
  139. package/scaffold/.agent/skills/total-recall/skills/tr-skill/scripts/create-skill.sh +0 -65
  140. package/scaffold/.agent/skills/total-recall/skills/tr-skill/scripts/enforce-skill-optimization.mjs +0 -135
  141. package/scaffold/.agent/skills/total-recall/skills/tr-skill/scripts/skill-watcher.mjs +0 -64
  142. package/scaffold/.agent/skills/total-recall/skills/tr-skill/subagents/audit-all-skills.md +0 -62
  143. package/scaffold/.agent/skills/total-recall/skills/tr-ssss/SKILL.md +0 -298
  144. package/scaffold/.agent/skills/total-recall/skills/tr-ssss/evals/evals.json +0 -17
  145. package/scaffold/.agent/skills/total-recall/skills/tr-ssss/references/CHANGELOG.md +0 -124
  146. package/scaffold/.agent/skills/total-recall/skills/tr-ssss/references/ssss-spec.md +0 -1325
  147. package/scaffold/.agent/skills/total-recall/skills/tr-ssss/scripts/validate-schema.mjs +0 -232
  148. package/scaffold/.agent/skills/total-recall/skills/tr-ssss/subagents/audit-ssss-node.md +0 -9
  149. /package/scaffold/.agent/skills/total-recall/{skills/tr-cli-agents/evals → modules/skill-deploy/scripts}/.gitkeep +0 -0
  150. /package/scaffold/.agent/skills/total-recall/{skills/tr-skill → modules/skill-deploy}/scripts/find-skills.mjs +0 -0
  151. /package/scaffold/.agent/skills/total-recall/{skills/tr-skill → modules/skill-deploy}/scripts/install-skill.mjs +0 -0
  152. /package/scaffold/.agent/skills/total-recall/{skills/tr-skill → modules/skill-deploy}/scripts/scan-skill.mjs +0 -0
@@ -1,282 +0,0 @@
1
- ---
2
- name: tr-skill
3
- provenance: total-recall
4
- description: "Use this skill when creating, auditing, or modifying any skill in the .agent/skills/ ecosystem. MANDATORY: You MUST read the full SKILL.md file before executing."
5
- ---
6
-
7
- # Skill Architecture — Canonical Format Guide
8
-
9
- > **Version:** 2.0.0 | **Updated:** 2026-05-11
10
-
11
- This is the definitive guide for how skills are structured, created, and maintained. Every agent that creates or modifies a skill MUST follow this spec exactly.
12
-
13
- ---
14
-
15
- ## 1. What is a Skill?
16
-
17
- A skill is a **self-contained knowledge package** that lives in `.agent/skills/<skill-name>/`. It gives an agent everything it needs to perform a specific domain task correctly: instructions, executable scripts, reference material, test criteria, and delegation prompts.
18
-
19
- Skills are NOT documentation. They are **executable expertise.**
20
-
21
- ---
22
-
23
- ## 2. Required Directory Structure
24
-
25
- Every skill MUST contain these items. No exceptions.
26
-
27
- ```text
28
- my-skill/
29
- ├── SKILL.md # REQUIRED — The master instruction file
30
- ├── scripts/ # REQUIRED — Automation scripts
31
- ├── references/ # REQUIRED — Domain knowledge, specs, docs
32
- ├── evals/ # REQUIRED — Success criteria and tests
33
- └── subagents/ # REQUIRED — Delegation prompts for subtasks
34
- ```
35
-
36
- ### Why all five are required
37
-
38
- Agents will skip optional folders without a second thought. By requiring all five, we force the agent to **stop and think** about what belongs in each one. Even a hastily written eval or a minimal reference doc is infinitely more valuable than nothing — it can always be improved later.
39
-
40
- ---
41
-
42
- ## 3. SKILL.md — The Entrypoint
43
-
44
- ### Frontmatter (REQUIRED)
45
-
46
- ```yaml
47
- ---
48
- name: my-skill-name
49
- description: "Use this skill when [TRIGGER CONDITION]. MANDATORY: You MUST read the full SKILL.md file before executing."
50
- ---
51
- ```
52
-
53
- | Field | Rules |
54
- |:---|:---|
55
- | `name` | **Lowercase kebab-case.** Must exactly match the folder name. |
56
- | `description` | **Trigger-optimized.** Must clearly state WHAT it does and WHEN to use it. Under 1024 chars. The IDE uses this string to decide when to show the skill — vague descriptions mean the skill never gets activated. |
57
-
58
- ### ⛔ Frontmatter Anti-Patterns
59
-
60
- ```yaml
61
- # ❌ WRONG — SSSS memory node fields. Skills are NOT memory nodes.
62
- type: skill
63
- slug: my-skill
64
- category: architecture
65
- title: "My Skill"
66
- schema_version: 2
67
- importance: 4
68
- ```
69
-
70
- ```yaml
71
- # ✅ CORRECT — only name + description
72
- name: my-skill
73
- description: "Use this skill when doing X. MANDATORY: You MUST read the full SKILL.md file before executing."
74
- ```
75
-
76
- ### Body Content
77
-
78
- The body of SKILL.md is the **master prompt** for the skill. Write it as procedural instructions that an agent can follow step-by-step. Include:
79
-
80
- - **Context** — What problem does this skill solve?
81
- - **Steps** — Numbered, concrete actions
82
- - **Rules** — Hard constraints and invariants
83
- - **Pitfalls** — What goes wrong and how to avoid it
84
- - **Code examples** — Correct and incorrect patterns
85
- - **References** — Pointers to files in `references/` for deeper context
86
-
87
- ---
88
-
89
- ## 4. scripts/ — Execution Layer
90
-
91
- Contains executable code the agent runs via the sandbox to perform complex or deterministic operations.
92
-
93
- **What belongs here:**
94
- - Scaffolding scripts (e.g., `create-skill.sh`)
95
- - Validation/linting scripts (e.g., `enforce-skill-optimization.mjs`)
96
- - Watchers and cron-triggered automation (e.g., `watch.mjs`)
97
- - Data transformation or migration scripts
98
- - Any operation that should be deterministic rather than LLM-hallucinated
99
-
100
- **Rules:**
101
- - Scripts MUST be idempotent where possible
102
- - Scripts MUST be self-contained (no implicit dependencies outside the skill)
103
- - Scripts MUST handle errors gracefully with clear stderr output
104
- - Use `console.error()` for logging, never `console.log()` in production scripts
105
-
106
- **When creating a skill, ask yourself:** *"What operations in this domain should be automated with code instead of trusted to the LLM's judgment?"*
107
-
108
- ---
109
-
110
- ## 5. references/ — Domain Knowledge
111
-
112
- Contains static reference documents the agent reads for context when the skill is activated.
113
-
114
- **What belongs here:**
115
- - API documentation or spec excerpts
116
- - Schema definitions
117
- - Configuration format guides
118
- - Architecture decision records
119
- - Links to external sources with cached key sections
120
- - Example files or templates
121
-
122
- **Rules:**
123
- - Use Markdown (`.md`) files for text documentation
124
- - Keep files focused — one topic per file
125
- - Name files descriptively: `streamable-http-spec.md`, not `ref1.md`
126
- - Include the source URL at the top of any extracted documentation
127
-
128
- **When creating a skill, ask yourself:** *"What does an agent need to READ to understand this domain? What docs did I have to look up?"*
129
-
130
- ---
131
-
132
- ## 6. evals/ — Success Criteria
133
-
134
- Contains assertions, test scripts, or evaluation criteria that verify the skill was executed correctly.
135
-
136
- **What belongs here:**
137
- - `evals.json` — Structured assertions (minimum 3)
138
- - Test scripts that can be run in the sandbox
139
- - Checklists of things to verify
140
- - Expected output examples
141
-
142
- **evals.json format:**
143
- ```json
144
- [
145
- {
146
- "name": "frontmatter-has-name",
147
- "assertion": "SKILL.md YAML frontmatter contains a 'name' field",
148
- "severity": "error"
149
- },
150
- {
151
- "name": "description-is-trigger-optimized",
152
- "assertion": "description field starts with 'Use this skill when'",
153
- "severity": "warning"
154
- },
155
- {
156
- "name": "no-empty-directories",
157
- "assertion": "All required directories contain at least one non-.gitkeep file",
158
- "severity": "error"
159
- }
160
- ]
161
- ```
162
-
163
- **When creating a skill, ask yourself:** *"How would I know if this skill was used correctly? What could go wrong? What should I check?"*
164
-
165
- ---
166
-
167
- ## 7. subagents/ — Delegation Prompts
168
-
169
- Contains standalone prompt files for subtasks that can be delegated to parallel agents or focused workers.
170
-
171
- **What belongs here:**
172
- - Audit prompts (e.g., `audit-all-skills.md`)
173
- - Review prompts (e.g., `review-output.md`)
174
- - Specialized generation prompts (e.g., `generate-tests.md`)
175
- - Decomposed subtask prompts for complex workflows
176
-
177
- **Rules:**
178
- - Each file is a complete, self-contained prompt
179
- - Include role, context, constraints, and expected output format
180
- - Name files as verbs: `audit-X.md`, `generate-Y.md`, `validate-Z.md`
181
-
182
- **When creating a skill, ask yourself:** *"What parts of this task could be delegated to a focused subagent? What parallel work would speed this up?"*
183
-
184
- ---
185
-
186
- ## 8. Creating a New Skill
187
-
188
- ### Quick method (script):
189
- ```bash
190
- bash .agent/skills/tr-skill/scripts/create-skill.sh my-new-skill
191
- ```
192
-
193
- ### Manual method:
194
- 1. Create the folder: `.agent/skills/my-new-skill/`
195
- 2. Create `SKILL.md` with proper `name` + `description` frontmatter
196
- 3. Create `scripts/`, `references/`, `evals/`, `subagents/` directories
197
- 4. Populate each directory — think deeply about what belongs in each one
198
- 5. Write `evals/evals.json` with at least 3 assertions
199
-
200
- ### The Deliberation Checklist
201
-
202
- Before committing a new skill, answer ALL of these:
203
-
204
- | Folder | Question |
205
- |:---|:---|
206
- | `SKILL.md` | Is the description trigger-optimized? Will the IDE activate this skill at the right time? |
207
- | `scripts/` | What operations should be deterministic code, not LLM guesses? |
208
- | `references/` | What domain knowledge does the agent need? What docs did I have to look up? |
209
- | `evals/` | How do I know if this skill was used correctly? What could go wrong? |
210
- | `subagents/` | What subtasks could be parallelized or delegated to a focused worker? |
211
-
212
- ---
213
-
214
- ## 9. Quality Enforcement
215
-
216
- The enforcement script (`scripts/enforce-skill-optimization.mjs`) validates all skills on commit:
217
-
218
- 1. Every skill must have a `SKILL.md` with `name` and `description` frontmatter
219
- 2. All five directories must exist and contain at least one real file (`.gitkeep` alone doesn't count)
220
- 3. `evals/evals.json` must contain at least 3 assertions
221
- 4. No placeholder/TODO-only SKILL.md files in committed skills
222
-
223
- ---
224
-
225
- ## 10. Safe Integration of External Skills
226
-
227
- When downloading, importing, or adding external skills from registries like `skills.sh` (via `npx skills add <name>`), agents and developers MUST perform security audits before executing any scripts:
228
-
229
- 1. **Verify Executable Scripts**: Open and scan all scripts under `scripts/`. Look for shell template strings with dynamic interpolation or unchecked execution arguments.
230
- 2. **Restrict Path Operations**: Ensure path references are validated and match regular expressions (e.g. `SAFE_NAME` pattern) to prevent path traversal vulnerabilities.
231
- 3. **Assert Sandbox Isolation**: Prefer executing unfamiliar external skill scripts inside isolated sandbox environments or containers to guarantee zero adverse host system impact.
232
-
233
- ---
234
-
235
- ## 11. Common Mistakes
236
-
237
- | Mistake | Why It's Wrong | Fix |
238
- |:---|:---|:---|
239
- | Using `type`/`slug`/`category` in frontmatter | Those are SSSS memory node fields, not skill fields. IDE can't discover the skill. | Use only `name` and `description` |
240
- | Empty `references/` with just `.gitkeep` | Agent loses critical domain context | Add at least one reference doc — even a short one |
241
- | Empty `evals/` | No way to verify the skill worked | Write 3+ assertions in `evals.json` |
242
- | Vague description | `"A skill for doing stuff"` → IDE never triggers it | `"Use this skill when X. Do NOT use for Y."` |
243
- | Mixing format spec with implementation details | Contaminates portable knowledge with project-specific internals | Keep format docs generic, put project details in PRD |
244
-
245
- ---
246
-
247
- ## Changelog
248
-
249
- ### v2.0.0 (2026-05-11)
250
- - **BREAKING**: Removed Total Recall-specific implementation details (surface.mjs routing, memory injection blocks, Gemma 4 references, P2 scheduling). This skill is now the universal format spec.
251
- - Added deliberation checklist forcing agents to think about each folder
252
- - Added "When creating a skill, ask yourself" prompts for each directory
253
- - Added frontmatter anti-patterns section
254
- - Added evals.json format example
255
- - Added common mistakes table
256
-
257
- ### v1.0.0 (2026-05-10)
258
- - Initial version. Mixed universal skill format with Total Recall memory compiler internals, causing agent confusion.
259
-
260
-
261
- <!-- BEGIN INJECTED MEMORY: do not edit by hand; rebuilt by total-recall surface -->
262
- <!-- @route: tfidf, generated_at: 2026-05-21T06:00:44.284Z -->
263
-
264
- - **inviolable-ide-instruction-7a4d8913** (confidence 1, importance critical):
265
- Inviolable IDE Instruction: # Temporary Cursor Rules for testing
266
-
267
- - **always-reply-to-all-messages** (confidence 1, importance critical):
268
- Always reply directly to all user messages without exception
269
-
270
- - **chocolate-brownies** (confidence 0.95, importance 4):
271
- Chocolate brownies must be fudgey and rich
272
-
273
- - **security-audit-protocol** (confidence 1, importance 4):
274
- Security audit protocol and hardening requirements
275
-
276
- - **operating-instructions** (confidence 1, importance 5):
277
- Total Recall Core Operating Protocol
278
-
279
- - **no-cursor-or-windsurf-mentions** (confidence 1, importance critical):
280
- Do not mention Cursor or Windsurf
281
-
282
- <!-- END INJECTED MEMORY -->
@@ -1,20 +0,0 @@
1
- ---
2
- name: SKILL_NAME_PLACEHOLDER
3
- description: "Use this template when creating new skills to ensure trigger-optimized descriptions. MANDATORY: You MUST read this file before executing."
4
- ---
5
-
6
- # SKILL_NAME_PLACEHOLDER
7
-
8
- > TODO: Write procedural instructions for this skill.
9
-
10
- ## Step 1: [First Action]
11
-
12
- TODO: Describe the first step.
13
-
14
- ## Step 2: [Second Action]
15
-
16
- TODO: Describe the second step.
17
-
18
- ## References
19
-
20
- - If you need X, see `references/X.md`
@@ -1,20 +0,0 @@
1
- [
2
- {
3
- "id": "skill-eval-1",
4
- "description": "SKILL.md exists",
5
- "command": "test -f .agent/skills/tr-skill/SKILL.md",
6
- "expected_exit_code": 0
7
- },
8
- {
9
- "id": "skill-eval-2",
10
- "description": "Evals validation",
11
- "command": "test -f .agent/skills/tr-skill/scripts/run-evals.mjs",
12
- "expected_exit_code": 0
13
- },
14
- {
15
- "id": "skill-eval-3",
16
- "description": "Optimization enforcement",
17
- "command": "test -f .agent/skills/tr-skill/scripts/enforce-skill-optimization.mjs",
18
- "expected_exit_code": 0
19
- }
20
- ]
@@ -1,14 +0,0 @@
1
- #!/bin/bash
2
- # on-skill-add.sh — Auto-regenerate the skill routing table when a new skill is added.
3
- #
4
- # Trigger: Run after creating a new skill via create-skill.sh or manually.
5
- # Action: Runs update-skill-index.mjs to sync the routing table and INSTRUCTIONS.md.
6
-
7
- set -euo pipefail
8
-
9
- SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
10
- ROOT="$(cd "$SCRIPT_DIR/../../../.." && pwd)"
11
-
12
- echo "🔄 OnSkillAdd hook triggered — regenerating skill index..."
13
- node "$ROOT/.agent/skills/tr-skill/scripts/update-skill-index.mjs"
14
- echo "✅ Routing table and INSTRUCTIONS.md updated."
@@ -1,14 +0,0 @@
1
- #!/bin/bash
2
- # on-skill-delete.sh — Auto-clean the skill routing table when a skill is removed.
3
- #
4
- # Trigger: Run after deleting a skill directory.
5
- # Action: Runs update-skill-index.mjs to sync the routing table and INSTRUCTIONS.md.
6
-
7
- set -euo pipefail
8
-
9
- SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
10
- ROOT="$(cd "$SCRIPT_DIR/../../../.." && pwd)"
11
-
12
- echo "🧹 OnSkillDelete hook triggered — cleaning skill index..."
13
- node "$ROOT/.agent/skills/tr-skill/scripts/update-skill-index.mjs"
14
- echo "✅ Routing table and INSTRUCTIONS.md cleaned."
@@ -1,65 +0,0 @@
1
- #!/bin/bash
2
- # create-skill.sh — Scaffold a new Dev Skill from the template
3
- #
4
- # Usage: bash .agent/skills/tr-skill/scripts/create-skill.sh <skill-name>
5
- # Example: bash .agent/skills/tr-skill/scripts/create-skill.sh my-new-skill
6
-
7
- set -euo pipefail
8
-
9
- SKILL_NAME="${1:-}"
10
-
11
- if [ -z "$SKILL_NAME" ]; then
12
- echo "❌ Usage: bash create-skill.sh <skill-name>"
13
- echo " Example: bash create-skill.sh my-new-skill"
14
- exit 1
15
- fi
16
-
17
- SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
18
- ROOT="$(cd "$SCRIPT_DIR/../../../.." && pwd)"
19
- SKILLS_DIR="$ROOT/.agent/skills"
20
- TARGET="$SKILLS_DIR/$SKILL_NAME"
21
-
22
- if [ -d "$TARGET" ]; then
23
- echo "❌ Skill '$SKILL_NAME' already exists at $TARGET"
24
- exit 1
25
- fi
26
-
27
- echo "📦 Creating skill: $SKILL_NAME"
28
-
29
- # Create directory structure
30
- mkdir -p "$TARGET"/{scripts,references}
31
-
32
- # Create SKILL.md with frontmatter template
33
- cat > "$TARGET/SKILL.md" << EOF
34
- ---
35
- name: $SKILL_NAME
36
- description: "TODO: Write a trigger-optimized description. Format: WHAT it does + WHEN to use it + WHEN NOT to use it. Under 1024 chars."
37
- ---
38
-
39
- # $SKILL_NAME
40
-
41
- > TODO: Write procedural instructions for this skill.
42
-
43
- ## Step 1: [First Action]
44
-
45
- TODO: Describe the first step.
46
-
47
- ## Step 2: [Second Action]
48
-
49
- TODO: Describe the second step.
50
-
51
- ## References
52
-
53
- - If you need X, see \`references/X.md\`
54
- EOF
55
-
56
- echo "✅ Created $TARGET/SKILL.md"
57
- echo "✅ Created $TARGET/scripts/"
58
- echo "✅ Created $TARGET/references/"
59
- echo ""
60
- echo "📝 Next steps:"
61
- echo " 1. Edit $TARGET/SKILL.md with real instructions"
62
- echo " 2. Write a trigger-optimized description in the frontmatter"
63
- echo " 3. Run: node .agent/skills/tr-skill/scripts/update-skill-index.mjs"
64
- echo ""
65
- echo "🏁 Done."
@@ -1,135 +0,0 @@
1
- /**
2
- * enforce-skill-optimization.mjs
3
- *
4
- * Pre-commit validation for the skill ecosystem.
5
- * Ensures every skill in .agent/skills/ meets the canonical format:
6
- * - SKILL.md with proper name + description frontmatter
7
- * - All required directories exist with real content
8
- * - evals/evals.json has ≥3 assertions
9
- *
10
- * Exit code 1 = validation failed (blocks commit)
11
- * Exit code 0 = all skills valid
12
- */
13
-
14
- import fs from 'node:fs';
15
- import path from 'node:path';
16
-
17
- const SKILLS_DIR = path.join(process.cwd(), '.agent/skills');
18
- const REQUIRED_DIRS = ['scripts', 'references', 'evals', 'subagents'];
19
-
20
- function parseYamlFrontmatter(content) {
21
- const match = content.match(/^---\n([\s\S]*?)\n---/);
22
- if (!match) return null;
23
-
24
- const fields = {};
25
- for (const line of match[1].split('\n')) {
26
- const kv = line.match(/^(\w+):\s*(.+)/);
27
- if (kv) {
28
- fields[kv[1]] = kv[2].replace(/^["']|["']$/g, '');
29
- }
30
- }
31
- return fields;
32
- }
33
-
34
- function hasRealContent(dirPath) {
35
- if (!fs.existsSync(dirPath)) return false;
36
- const entries = fs.readdirSync(dirPath);
37
- return entries.some(e => e !== '.gitkeep');
38
- }
39
-
40
- function checkSkills() {
41
- if (!fs.existsSync(SKILLS_DIR)) {
42
- console.error('⚠️ No .agent/skills/ directory found. Skipping.');
43
- process.exit(0);
44
- }
45
-
46
- const dirs = fs.readdirSync(SKILLS_DIR).filter(d =>
47
- fs.statSync(path.join(SKILLS_DIR, d)).isDirectory()
48
- );
49
-
50
- const errors = [];
51
- const warnings = [];
52
-
53
- for (const skillName of dirs) {
54
- const skillPath = path.join(SKILLS_DIR, skillName);
55
- const skillMd = path.join(skillPath, 'SKILL.md');
56
-
57
- // ── SKILL.md must exist ──────────────────────────────────────────────
58
- if (!fs.existsSync(skillMd)) {
59
- errors.push(`${skillName}: Missing SKILL.md`);
60
- continue;
61
- }
62
-
63
- const content = fs.readFileSync(skillMd, 'utf8');
64
- const frontmatter = parseYamlFrontmatter(content);
65
-
66
- // ── Frontmatter must have name + description ─────────────────────────
67
- if (!frontmatter) {
68
- errors.push(`${skillName}: SKILL.md has no YAML frontmatter`);
69
- } else {
70
- if (!frontmatter.name) {
71
- errors.push(`${skillName}: frontmatter missing 'name' field (has '${Object.keys(frontmatter).join(', ')}' instead)`);
72
- } else if (frontmatter.name !== skillName) {
73
- warnings.push(`${skillName}: frontmatter name '${frontmatter.name}' doesn't match folder name '${skillName}'`);
74
- }
75
-
76
- if (!frontmatter.description) {
77
- errors.push(`${skillName}: frontmatter missing 'description' field`);
78
- }
79
-
80
- // Warn about SSSS memory node fields leaking into skill frontmatter
81
- const badFields = ['type', 'slug', 'category', 'schema_version', 'importance', 'priority', 'modality'];
82
- const found = badFields.filter(f => frontmatter[f]);
83
- if (found.length > 0) {
84
- errors.push(`${skillName}: frontmatter contains SSSS memory node fields (${found.join(', ')}). Skills use only 'name' and 'description'.`);
85
- }
86
- }
87
-
88
- // ── Required directories ─────────────────────────────────────────────
89
- for (const reqDir of REQUIRED_DIRS) {
90
- const dirPath = path.join(skillPath, reqDir);
91
- if (!fs.existsSync(dirPath)) {
92
- errors.push(`${skillName}: missing required directory: ${reqDir}/`);
93
- } else if (!hasRealContent(dirPath)) {
94
- warnings.push(`${skillName}: ${reqDir}/ has no real content (only .gitkeep). Consider adding domain-specific files.`);
95
- }
96
- }
97
-
98
- // ── evals.json quality check ─────────────────────────────────────────
99
- const evalsPath = path.join(skillPath, 'evals', 'evals.json');
100
- if (fs.existsSync(evalsPath)) {
101
- try {
102
- const evals = JSON.parse(fs.readFileSync(evalsPath, 'utf8'));
103
- if (!Array.isArray(evals)) {
104
- errors.push(`${skillName}: evals.json must be a JSON array`);
105
- } else if (evals.length < 3) {
106
- warnings.push(`${skillName}: evals.json has only ${evals.length} assertion(s) — minimum 3 recommended`);
107
- }
108
- } catch {
109
- errors.push(`${skillName}: evals.json is invalid JSON`);
110
- }
111
- }
112
- }
113
-
114
- // ── Report ───────────────────────────────────────────────────────────────
115
- if (warnings.length > 0) {
116
- console.error('\n⚠️ Warnings:');
117
- for (const w of warnings) console.error(` ${w}`);
118
- }
119
-
120
- if (errors.length > 0) {
121
- console.error('\n❌ Errors:');
122
- for (const e of errors) console.error(` ${e}`);
123
- console.error(`\n🚨 SKILL ENFORCEMENT FAILED — ${errors.length} error(s) found.`);
124
- console.error(' Fix the errors above before committing.\n');
125
- process.exit(1);
126
- }
127
-
128
- console.error(`\n✅ All ${dirs.length} skills passed enforcement checks.`);
129
- if (warnings.length > 0) {
130
- console.error(` (${warnings.length} warning(s) — not blocking)\n`);
131
- }
132
- process.exit(0);
133
- }
134
-
135
- checkSkills();
@@ -1,64 +0,0 @@
1
- import chokidar from 'chokidar';
2
- import { execSync } from 'child_process';
3
- import path from 'path';
4
- import { fileURLToPath } from 'url';
5
-
6
- const __filename = fileURLToPath(import.meta.url);
7
- const __dirname = path.dirname(__filename);
8
- const ROOT = path.resolve(__dirname, '../../../../');
9
- const SKILLS_DIR = path.join(ROOT, '.agent/skills');
10
-
11
- const hooks = {
12
- add: path.join(SKILLS_DIR, 'skill/hooks/on-skill-add.sh'),
13
- delete: path.join(SKILLS_DIR, 'skill/hooks/on-skill-delete.sh'),
14
- };
15
-
16
- console.log(`\n👁️ Skill Watcher Daemon Started`);
17
- console.log(` Watching: ${SKILLS_DIR}/**/SKILL.md`);
18
-
19
- // Debounce state
20
- let timeoutId = null;
21
- let pendingActions = new Set();
22
-
23
- function executeHooks() {
24
- const actions = Array.from(pendingActions);
25
- pendingActions.clear();
26
-
27
- try {
28
- if (actions.includes('add') || actions.includes('change')) {
29
- console.log(`\n[Watcher] Triggering on-skill-add.sh...`);
30
- execSync(`bash ${hooks.add}`, { stdio: 'inherit' });
31
- } else if (actions.includes('unlink')) {
32
- console.log(`\n[Watcher] Triggering on-skill-delete.sh...`);
33
- execSync(`bash ${hooks.delete}`, { stdio: 'inherit' });
34
- }
35
- } catch (error) {
36
- console.error(`\n[Watcher] Hook execution failed: ${error.message}`);
37
- }
38
- }
39
-
40
- function queueAction(action) {
41
- pendingActions.add(action);
42
- if (timeoutId) clearTimeout(timeoutId);
43
- // Debounce for 1.5 seconds to batch file saves
44
- timeoutId = setTimeout(executeHooks, 1500);
45
- }
46
-
47
- chokidar.watch(path.join(SKILLS_DIR, '**/SKILL.md'), {
48
- ignored: /(^|[\/\\])\../, // ignore dotfiles
49
- persistent: true,
50
- ignoreInitial: true // Do not trigger on initial scan
51
- })
52
- .on('add', filePath => {
53
- console.log(`[Watcher] File added: ${path.relative(ROOT, filePath)}`);
54
- queueAction('add');
55
- })
56
- .on('change', filePath => {
57
- console.log(`[Watcher] File changed: ${path.relative(ROOT, filePath)}`);
58
- queueAction('change');
59
- })
60
- .on('unlink', filePath => {
61
- console.log(`[Watcher] File removed: ${path.relative(ROOT, filePath)}`);
62
- queueAction('unlink');
63
- })
64
- .on('error', error => console.error(`[Watcher] error: ${error}`));
@@ -1,62 +0,0 @@
1
- # Subagent: Audit All Dev Skills for Compliance
2
-
3
- > Parallel worker prompt for auditing the entire `.agent/skills/` directory.
4
-
5
- ## Your Task
6
-
7
- You are a specialized auditor. Your ONLY task is to verify that every Dev Skill in `.agent/skills/` complies with the AgentSkills.io standard.
8
-
9
- ## Steps
10
-
11
- 1. List all directories in `.agent/skills/`
12
- 2. For each skill directory, check:
13
- - [ ] `SKILL.md` exists
14
- - [ ] YAML frontmatter contains `name` field
15
- - [ ] YAML frontmatter contains `description` field
16
- - [ ] Description includes WHAT (core capability statement)
17
- - [ ] Description includes WHEN (trigger phrase)
18
- - [ ] Description includes WHEN NOT (negative trigger, contains "Do NOT" or "NEVER")
19
- - [ ] Description is under 1,024 characters
20
- - [ ] `SKILL.md` body is under 500 lines
21
-
22
- 3. Return a JSON report in this exact format:
23
-
24
- ```json
25
- {
26
- "total": 35,
27
- "compliant": 30,
28
- "non_compliant": 5,
29
- "results": [
30
- {
31
- "name": "skill-name",
32
- "dir": "skill-dir",
33
- "compliant": true,
34
- "issues": []
35
- },
36
- {
37
- "name": "broken-skill",
38
- "dir": "broken-dir",
39
- "compliant": false,
40
- "issues": ["Missing negative trigger in description", "SKILL.md exceeds 500 lines (612 lines)"]
41
- }
42
- ]
43
- }
44
- ```
45
-
46
- ## Tools Available
47
-
48
- - `view_file`: Read file contents
49
- - `grep_search`: Search for patterns
50
- - `run_command`: Execute shell commands
51
- - `list_dir`: List directory contents
52
-
53
- ## Tools NOT Available
54
-
55
- - `write_to_file`: You cannot modify files
56
- - `replace_file_content`: You cannot edit files
57
-
58
- ## Important
59
-
60
- - Do NOT fix anything. Only audit and report.
61
- - Do NOT skip any skill directory.
62
- - Report ALL issues found, even minor ones.