@unerr-ai/unerr 0.2.1 → 0.2.3

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 (363) hide show
  1. package/README.md +36 -45
  2. package/dist/cli.js +37443 -36022
  3. package/package.json +2 -1
  4. package/dist/behaviors/agent-llm-bridge.js +0 -166
  5. package/dist/behaviors/architecture-guard.js +0 -256
  6. package/dist/behaviors/auto-doc.js +0 -247
  7. package/dist/behaviors/cascade-guard.js +0 -289
  8. package/dist/behaviors/change-narrative.js +0 -270
  9. package/dist/behaviors/convention-drift.js +0 -290
  10. package/dist/behaviors/framework.js +0 -235
  11. package/dist/behaviors/guard-formatter.js +0 -44
  12. package/dist/behaviors/incomplete-work.js +0 -270
  13. package/dist/behaviors/loop-breaker.js +0 -300
  14. package/dist/behaviors/session-continuity.js +0 -208
  15. package/dist/commands/branches.js +0 -97
  16. package/dist/commands/check-commit.js +0 -225
  17. package/dist/commands/compress-output.js +0 -64
  18. package/dist/commands/config-verify.js +0 -243
  19. package/dist/commands/daemon.js +0 -905
  20. package/dist/commands/dashboard.js +0 -52
  21. package/dist/commands/debug.js +0 -200
  22. package/dist/commands/enrich.js +0 -184
  23. package/dist/commands/exec.js +0 -233
  24. package/dist/commands/gain.js +0 -156
  25. package/dist/commands/hook.js +0 -88
  26. package/dist/commands/index.js +0 -88
  27. package/dist/commands/init.js +0 -74
  28. package/dist/commands/install.js +0 -505
  29. package/dist/commands/learn.js +0 -116
  30. package/dist/commands/manifest.js +0 -193
  31. package/dist/commands/rewind.js +0 -103
  32. package/dist/commands/serve.js +0 -19
  33. package/dist/commands/setup-wizard.js +0 -414
  34. package/dist/commands/skills.js +0 -64
  35. package/dist/commands/stats.js +0 -20
  36. package/dist/commands/status.js +0 -654
  37. package/dist/commands/timeline.js +0 -139
  38. package/dist/commands/uninstall.js +0 -230
  39. package/dist/components/App.js +0 -109
  40. package/dist/components/Banner.js +0 -12
  41. package/dist/components/ConfirmPrompt.js +0 -25
  42. package/dist/components/DriftSummary.js +0 -23
  43. package/dist/components/GradeBadge.js +0 -15
  44. package/dist/components/HealthCard.js +0 -18
  45. package/dist/components/InkSpinner.js +0 -22
  46. package/dist/components/InputBox.js +0 -17
  47. package/dist/components/KeyValue.js +0 -13
  48. package/dist/components/MessageList.js +0 -14
  49. package/dist/components/ProgressBar.js +0 -26
  50. package/dist/components/Section.js +0 -16
  51. package/dist/components/SessionSummaryCard.js +0 -73
  52. package/dist/components/StartupDisplay.js +0 -24
  53. package/dist/components/StatusDashboard.js +0 -57
  54. package/dist/components/StatusLine.js +0 -8
  55. package/dist/components/StepLine.js +0 -22
  56. package/dist/components/Theme.js +0 -20
  57. package/dist/components/ToolProgress.js +0 -8
  58. package/dist/components/ViolationList.js +0 -21
  59. package/dist/components/render.js +0 -13
  60. package/dist/config/agent-registry.js +0 -237
  61. package/dist/config/claude-settings-hooks.js +0 -304
  62. package/dist/config/hook-installer.js +0 -65
  63. package/dist/config/instruction-writer.js +0 -388
  64. package/dist/config/mcp-config-writer.js +0 -266
  65. package/dist/config/settings.js +0 -174
  66. package/dist/config/tool-detector.js +0 -42
  67. package/dist/config/value-surfacing.js +0 -119
  68. package/dist/core/context-assembly.js +0 -108
  69. package/dist/core/conversation.js +0 -33
  70. package/dist/core/local-chat-provider.js +0 -475
  71. package/dist/core/provider-factory.js +0 -55
  72. package/dist/core/providers.js +0 -90
  73. package/dist/core/query-engine.js +0 -174
  74. package/dist/daemon/api.js +0 -312
  75. package/dist/daemon/autostart.js +0 -119
  76. package/dist/daemon/bootstrap.js +0 -39
  77. package/dist/daemon/client.js +0 -164
  78. package/dist/daemon/detect-ci.js +0 -81
  79. package/dist/daemon/platform-linux.js +0 -146
  80. package/dist/daemon/platform-macos.js +0 -134
  81. package/dist/daemon/platform-windows.js +0 -116
  82. package/dist/daemon/process-manager.js +0 -299
  83. package/dist/daemon/protocol.js +0 -23
  84. package/dist/daemon/registry.js +0 -270
  85. package/dist/daemon/settings-schema.js +0 -72
  86. package/dist/daemon/system-health.js +0 -134
  87. package/dist/daemon/version-checker.js +0 -262
  88. package/dist/daemon/warm-start.js +0 -223
  89. package/dist/entrypoints/cli.js +0 -1043
  90. package/dist/entrypoints/daemon.js +0 -380
  91. package/dist/entrypoints/repl.js +0 -147
  92. package/dist/hooks/adapters/claude-code.js +0 -90
  93. package/dist/hooks/adapters/cline.js +0 -100
  94. package/dist/hooks/adapters/cursor.js +0 -98
  95. package/dist/hooks/hook-dedup.js +0 -79
  96. package/dist/hooks/hook-runner.js +0 -113
  97. package/dist/hooks/navigation-hooks.js +0 -175
  98. package/dist/hooks/prompt-hooks.js +0 -63
  99. package/dist/hooks/shell-hooks.js +0 -47
  100. package/dist/ignore.js +0 -111
  101. package/dist/intelligence/approach-suggester.js +0 -61
  102. package/dist/intelligence/ast-extractor.js +0 -2615
  103. package/dist/intelligence/ast-worker.js +0 -34
  104. package/dist/intelligence/background-indexer.js +0 -121
  105. package/dist/intelligence/blast-radius.js +0 -200
  106. package/dist/intelligence/community-detection.js +0 -691
  107. package/dist/intelligence/community-detector.js +0 -184
  108. package/dist/intelligence/computation-scheduler.js +0 -75
  109. package/dist/intelligence/confidence-propagation.js +0 -47
  110. package/dist/intelligence/convention-detector.js +0 -242
  111. package/dist/intelligence/convention-learner.js +0 -205
  112. package/dist/intelligence/convention-matcher.js +0 -205
  113. package/dist/intelligence/cozo-schema.js +0 -376
  114. package/dist/intelligence/decision-point-detector.js +0 -90
  115. package/dist/intelligence/deep-dive-tools.js +0 -586
  116. package/dist/intelligence/durability-scorer.js +0 -84
  117. package/dist/intelligence/exploration-cost.js +0 -204
  118. package/dist/intelligence/exploration-pattern-tracker.js +0 -61
  119. package/dist/intelligence/fact-generator.js +0 -322
  120. package/dist/intelligence/facts-schema.js +0 -90
  121. package/dist/intelligence/file-intelligence.js +0 -59
  122. package/dist/intelligence/graph-holder.js +0 -220
  123. package/dist/intelligence/graph-temporal-joiner.js +0 -238
  124. package/dist/intelligence/health-grade.js +0 -423
  125. package/dist/intelligence/health-grader.js +0 -200
  126. package/dist/intelligence/health-map-data.js +0 -259
  127. package/dist/intelligence/import-symbols.js +0 -136
  128. package/dist/intelligence/incremental-indexer.js +0 -658
  129. package/dist/intelligence/indexer/centrality.js +0 -62
  130. package/dist/intelligence/indexer/cfg-context.js +0 -95
  131. package/dist/intelligence/indexer/confidence.js +0 -34
  132. package/dist/intelligence/indexer/cross-file-resolver.js +0 -104
  133. package/dist/intelligence/indexer/edge-repair.js +0 -89
  134. package/dist/intelligence/indexer/entity-key.js +0 -17
  135. package/dist/intelligence/indexer/export-map.js +0 -132
  136. package/dist/intelligence/indexer/git-cochange.js +0 -128
  137. package/dist/intelligence/indexer/graph-patch.js +0 -147
  138. package/dist/intelligence/indexer/incremental.js +0 -78
  139. package/dist/intelligence/indexer/ingest.js +0 -160
  140. package/dist/intelligence/indexer/language-detect.js +0 -226
  141. package/dist/intelligence/indexer/metadata.js +0 -63
  142. package/dist/intelligence/indexer/mutation-tracker.js +0 -79
  143. package/dist/intelligence/indexer/orchestrator.js +0 -155
  144. package/dist/intelligence/indexer/plugin-interface.js +0 -31
  145. package/dist/intelligence/indexer/plugins/csharp.js +0 -440
  146. package/dist/intelligence/indexer/plugins/go.js +0 -335
  147. package/dist/intelligence/indexer/plugins/java.js +0 -370
  148. package/dist/intelligence/indexer/plugins/python.js +0 -358
  149. package/dist/intelligence/indexer/plugins/regex-fallback.js +0 -82
  150. package/dist/intelligence/indexer/plugins/ruby.js +0 -290
  151. package/dist/intelligence/indexer/plugins/rust.js +0 -484
  152. package/dist/intelligence/indexer/plugins/tier2-generic.js +0 -310
  153. package/dist/intelligence/indexer/plugins/typescript.js +0 -456
  154. package/dist/intelligence/indexer/resource-monitor.js +0 -93
  155. package/dist/intelligence/indexer/scip/decoder.js +0 -253
  156. package/dist/intelligence/indexer/scip/detector.js +0 -232
  157. package/dist/intelligence/indexer/scip/downloader.js +0 -427
  158. package/dist/intelligence/indexer/scip/fallback.js +0 -34
  159. package/dist/intelligence/indexer/scip/merger.js +0 -109
  160. package/dist/intelligence/indexer/scip/orchestrator.js +0 -433
  161. package/dist/intelligence/indexer/scip/runner.js +0 -98
  162. package/dist/intelligence/indexer/snapshot.js +0 -66
  163. package/dist/intelligence/indexer/test-detector.js +0 -196
  164. package/dist/intelligence/indexer/watch-integration.js +0 -61
  165. package/dist/intelligence/indexer/worker.js +0 -85
  166. package/dist/intelligence/local-convention-detector.js +0 -437
  167. package/dist/intelligence/local-embeddings.js +0 -190
  168. package/dist/intelligence/local-graph.js +0 -1946
  169. package/dist/intelligence/local-indexer.js +0 -1575
  170. package/dist/intelligence/local-llm.js +0 -163
  171. package/dist/intelligence/local-rule-generator.js +0 -154
  172. package/dist/intelligence/local-snapshot.js +0 -213
  173. package/dist/intelligence/negative-knowledge.js +0 -103
  174. package/dist/intelligence/persistent-db.js +0 -85
  175. package/dist/intelligence/query-router.js +0 -2556
  176. package/dist/intelligence/risk-classifier.js +0 -116
  177. package/dist/intelligence/rule-evaluator.js +0 -380
  178. package/dist/intelligence/rule-generator.js +0 -49
  179. package/dist/intelligence/search-index.js +0 -173
  180. package/dist/intelligence/semantic/docstring-extractor.js +0 -67
  181. package/dist/intelligence/semantic/embedding-store.js +0 -52
  182. package/dist/intelligence/semantic/enrichment-orchestrator.js +0 -48
  183. package/dist/intelligence/semantic/git-message-miner.js +0 -114
  184. package/dist/intelligence/semantic/identifier-tokenizer.js +0 -51
  185. package/dist/intelligence/semantic/node2vec-embeddings.js +0 -71
  186. package/dist/intelligence/semantic/node2vec-walks.js +0 -103
  187. package/dist/intelligence/semantic/path-domain-inference.js +0 -112
  188. package/dist/intelligence/semantic/similarity-engine.js +0 -60
  189. package/dist/intelligence/semantic/tfidf-vectors.js +0 -88
  190. package/dist/intelligence/session-brief-builder.js +0 -159
  191. package/dist/intelligence/session-context.js +0 -221
  192. package/dist/intelligence/session-health-monitor.js +0 -211
  193. package/dist/intelligence/session-narrative.js +0 -197
  194. package/dist/intelligence/session-pattern-analyzer.js +0 -218
  195. package/dist/intelligence/signal-scorer.js +0 -390
  196. package/dist/intelligence/signal-show-store.js +0 -182
  197. package/dist/intelligence/smart-truncate.js +0 -158
  198. package/dist/intelligence/subgraph-cache.js +0 -88
  199. package/dist/intelligence/temporal-facts.js +0 -494
  200. package/dist/intelligence/token-estimator.js +0 -100
  201. package/dist/intelligence/tool-injector.js +0 -87
  202. package/dist/intelligence/tree-sitter-loader.js +0 -71
  203. package/dist/intelligence/worker-pool.js +0 -116
  204. package/dist/proxy/arg-validator.js +0 -79
  205. package/dist/proxy/auto-bootstrap.js +0 -167
  206. package/dist/proxy/bridge.js +0 -147
  207. package/dist/proxy/budget-enforcer.js +0 -70
  208. package/dist/proxy/compression-quality-monitor.js +0 -160
  209. package/dist/proxy/compression-stats.js +0 -51
  210. package/dist/proxy/context-rot-detector.js +0 -137
  211. package/dist/proxy/drift-detector.js +0 -139
  212. package/dist/proxy/efficiency-tracker.js +0 -79
  213. package/dist/proxy/fact-ranking.js +0 -154
  214. package/dist/proxy/format-encoder.js +0 -266
  215. package/dist/proxy/http-transport.js +0 -90
  216. package/dist/proxy/lifecycle-actor.js +0 -55
  217. package/dist/proxy/lifecycle-machine.js +0 -187
  218. package/dist/proxy/log-tailer.js +0 -265
  219. package/dist/proxy/model-pricing.js +0 -98
  220. package/dist/proxy/network-firewall.js +0 -141
  221. package/dist/proxy/nudge-state.js +0 -93
  222. package/dist/proxy/output-compressor.js +0 -185
  223. package/dist/proxy/pid-lock.js +0 -291
  224. package/dist/proxy/proxy-context.js +0 -11
  225. package/dist/proxy/proxy.js +0 -2633
  226. package/dist/proxy/response-enrichment.js +0 -32
  227. package/dist/proxy/response-envelope.js +0 -313
  228. package/dist/proxy/session-dedup.js +0 -82
  229. package/dist/proxy/session-legend.js +0 -30
  230. package/dist/proxy/session-persistence.js +0 -210
  231. package/dist/proxy/session-resume.js +0 -94
  232. package/dist/proxy/session-stats.js +0 -513
  233. package/dist/proxy/shell-classifier.js +0 -1346
  234. package/dist/proxy/shell-compression-log.js +0 -93
  235. package/dist/proxy/shell-compressor.js +0 -390
  236. package/dist/proxy/shell-graph-boost.js +0 -202
  237. package/dist/proxy/shell-monitor-map.js +0 -18
  238. package/dist/proxy/shell-stats.js +0 -54
  239. package/dist/proxy/shell-strategies/cloud.js +0 -215
  240. package/dist/proxy/shell-strategies/diff.js +0 -159
  241. package/dist/proxy/shell-strategies/error-diagnostic.js +0 -796
  242. package/dist/proxy/shell-strategies/filter-dsl.js +0 -358
  243. package/dist/proxy/shell-strategies/git-status.js +0 -177
  244. package/dist/proxy/shell-strategies/key-value.js +0 -193
  245. package/dist/proxy/shell-strategies/log-text.js +0 -154
  246. package/dist/proxy/shell-strategies/omni.js +0 -188
  247. package/dist/proxy/shell-strategies/progress.js +0 -55
  248. package/dist/proxy/shell-strategies/redact.js +0 -76
  249. package/dist/proxy/shell-strategies/structured.js +0 -241
  250. package/dist/proxy/shell-strategies/tabular.js +0 -243
  251. package/dist/proxy/shell-strategies/test-results-types.js +0 -13
  252. package/dist/proxy/shell-strategies/test-results.js +0 -784
  253. package/dist/proxy/shell-strategies/tree-paths.js +0 -144
  254. package/dist/proxy/shell-strategies/yaml.js +0 -182
  255. package/dist/proxy/shell-tee.js +0 -111
  256. package/dist/proxy/signal-dedup.js +0 -171
  257. package/dist/proxy/startup-renderer.js +0 -158
  258. package/dist/proxy/task-token-display.js +0 -38
  259. package/dist/proxy/token-counter.js +0 -61
  260. package/dist/proxy/tool-clusters.js +0 -273
  261. package/dist/proxy/tool-definitions.js +0 -525
  262. package/dist/proxy/transport-mux.js +0 -229
  263. package/dist/proxy/wire-cap.js +0 -268
  264. package/dist/rules/developer.mozilla.org.json +0 -9
  265. package/dist/rules/github.com.json +0 -21
  266. package/dist/schemas/api/skills.js +0 -19
  267. package/dist/schemas/common/errors.js +0 -7
  268. package/dist/schemas/common/headers.js +0 -5
  269. package/dist/schemas/entities/edge.js +0 -25
  270. package/dist/schemas/entities/entity.js +0 -22
  271. package/dist/schemas/entities/rule.js +0 -18
  272. package/dist/schemas/index.js +0 -14
  273. package/dist/server/event-bus.js +0 -59
  274. package/dist/server/http.js +0 -156
  275. package/dist/server/middleware.js +0 -70
  276. package/dist/server/routes/drift.js +0 -97
  277. package/dist/server/routes/intelligence.js +0 -1217
  278. package/dist/server/routes/reasoning-quality.js +0 -444
  279. package/dist/server/routes/session.js +0 -86
  280. package/dist/server/routes/stream.js +0 -120
  281. package/dist/server/routes/system.js +0 -73
  282. package/dist/server/routes/temporal.js +0 -170
  283. package/dist/server/routes/timeline.js +0 -232
  284. package/dist/server/routes/token-flow.js +0 -403
  285. package/dist/skills/effectiveness-tracker.js +0 -93
  286. package/dist/skills/local-pack.js +0 -380
  287. package/dist/skills/resolver.js +0 -495
  288. package/dist/state-detector.js +0 -83
  289. package/dist/timeline/intent-detector.js +0 -263
  290. package/dist/timeline/loop-miner.js +0 -140
  291. package/dist/timeline/open-threads.js +0 -49
  292. package/dist/timeline/signal-reinforcer.js +0 -62
  293. package/dist/timeline/timeline-bootstrap.js +0 -151
  294. package/dist/timeline/timeline-store.js +0 -618
  295. package/dist/tools/coding/bash.js +0 -49
  296. package/dist/tools/coding/file-edit.js +0 -72
  297. package/dist/tools/coding/file-outline.js +0 -227
  298. package/dist/tools/coding/file-read-protocol.js +0 -425
  299. package/dist/tools/coding/file-read.js +0 -35
  300. package/dist/tools/coding/file-write.js +0 -43
  301. package/dist/tools/coding/glob-tool.js +0 -109
  302. package/dist/tools/coding/grep.js +0 -162
  303. package/dist/tools/coding/index.js +0 -27
  304. package/dist/tools/intelligence/index.js +0 -269
  305. package/dist/tools/intelligence/record-fact.js +0 -48
  306. package/dist/tools/intelligence/timeline-markers.js +0 -130
  307. package/dist/tools/registry.js +0 -47
  308. package/dist/tools/types.js +0 -8
  309. package/dist/tracking/auto-snapshot-triggers.js +0 -246
  310. package/dist/tracking/branch-context.js +0 -115
  311. package/dist/tracking/branch-snapshot.js +0 -217
  312. package/dist/tracking/causal-bridge.js +0 -317
  313. package/dist/tracking/circuit-breaker.js +0 -147
  314. package/dist/tracking/commit-watcher.js +0 -114
  315. package/dist/tracking/context-ledger.js +0 -119
  316. package/dist/tracking/correction-detector.js +0 -324
  317. package/dist/tracking/drift-tracker.js +0 -874
  318. package/dist/tracking/durability-tracker.js +0 -94
  319. package/dist/tracking/entity-rewind.js +0 -200
  320. package/dist/tracking/file-hash-state.js +0 -114
  321. package/dist/tracking/git-attribution.js +0 -132
  322. package/dist/tracking/git-trailers.js +0 -171
  323. package/dist/tracking/intelligence-counter.js +0 -46
  324. package/dist/tracking/intent-correlator.js +0 -202
  325. package/dist/tracking/intent-encoder.js +0 -52
  326. package/dist/tracking/intent-token-tracker.js +0 -159
  327. package/dist/tracking/ledger-archiver.js +0 -94
  328. package/dist/tracking/ledger-chains.js +0 -245
  329. package/dist/tracking/metrics-store.js +0 -361
  330. package/dist/tracking/native-watcher.js +0 -131
  331. package/dist/tracking/offline-rewind.js +0 -295
  332. package/dist/tracking/pending-violations.js +0 -74
  333. package/dist/tracking/persistence-effectiveness.js +0 -167
  334. package/dist/tracking/prompt-durability.js +0 -202
  335. package/dist/tracking/quality-signals.js +0 -213
  336. package/dist/tracking/redactor.js +0 -73
  337. package/dist/tracking/rewind-engine.js +0 -161
  338. package/dist/tracking/session-history.js +0 -128
  339. package/dist/tracking/session-receipt.js +0 -88
  340. package/dist/tracking/session-summary-writer.js +0 -157
  341. package/dist/tracking/shadow-ledger.js +0 -321
  342. package/dist/tracking/stash-manager.js +0 -258
  343. package/dist/tracking/timeline-fork.js +0 -213
  344. package/dist/tracking/timeline.js +0 -69
  345. package/dist/tracking/token-flow.js +0 -276
  346. package/dist/tracking/turn-segmenter.js +0 -122
  347. package/dist/tracking/weekly-accumulator.js +0 -179
  348. package/dist/tracking/working-snapshots.js +0 -188
  349. package/dist/tracking/workspace-manifest.js +0 -176
  350. package/dist/transport/http.js +0 -102
  351. package/dist/utils/counterfactual.js +0 -65
  352. package/dist/utils/deep-link.js +0 -34
  353. package/dist/utils/detect.js +0 -193
  354. package/dist/utils/exec.js +0 -73
  355. package/dist/utils/file-logger.js +0 -87
  356. package/dist/utils/format-error.js +0 -29
  357. package/dist/utils/git.js +0 -181
  358. package/dist/utils/log.js +0 -57
  359. package/dist/utils/logger.js +0 -35
  360. package/dist/utils/mcp-content-json.js +0 -8
  361. package/dist/utils/session-logger.js +0 -154
  362. package/dist/utils/startup-log.js +0 -512
  363. package/dist/utils/ui.js +0 -56
@@ -1,380 +0,0 @@
1
- /**
2
- * Local Skills Pack — bundled behavior skills injected on proxy boot.
3
- *
4
- * Q.11: "token-efficient" — constrain agent verbosity (~65% output reduction)
5
- * Q.12: "graph-first navigation" — instruct agent to use blast_radius/find_callers before file reads
6
- *
7
- * Skills are injected as system-level instructions via the proxy's tool descriptions
8
- * or as inline `ur|<tag>` prefix lines on the first tool call of a session.
9
- */
10
- export const TOKEN_EFFICIENT_SKILL = {
11
- id: "token-efficient",
12
- name: "Token-Efficient Output",
13
- description: "Constrains agent verbosity for 65% output reduction without losing critical information",
14
- instructions: [
15
- "When responding, prefer structured summaries over verbose explanations.",
16
- "Use bullet points and code snippets instead of paragraph descriptions.",
17
- "Skip introductory phrases like 'Here is...', 'I will...', 'Let me...'.",
18
- "For code changes: show only the diff, not surrounding unchanged code.",
19
- "For explanations: lead with the answer, then provide supporting details only if asked.",
20
- "Never repeat information that was already provided in the conversation.",
21
- "Prefer references to file paths over re-stating file contents.",
22
- "For file edits: use unified diff format (---/+++ headers, @@ hunks), never regenerate full files.",
23
- "When a tool response begins with `ur|ctx` (context already delivered for this entity), do not re-query or restate — proceed directly to the action.",
24
- ].join("\n"),
25
- category: "behavior",
26
- trigger: { type: "always" },
27
- tools: [],
28
- version: "1.1.0",
29
- };
30
- export const GRAPH_FIRST_NAVIGATION_SKILL = {
31
- id: "graph-first-navigation",
32
- name: "Graph-First Navigation",
33
- description: "Use graph intelligence tools before reading files to minimize exploration tokens",
34
- instructions: [
35
- "Before reading any file to understand code structure, use graph tools:",
36
- " - `get_references` — find all callers/callees of a function (replaces grep+read loops)",
37
- " - `get_references` with direction:callees — understand downstream dependencies",
38
- " - `get_file` — get all entities, imports, exports for a file",
39
- " - `get_imports` — trace the import/dependency graph",
40
- " - `search_code` — find entities by name (replaces file-by-file exploration)",
41
- " - `get_critical_nodes` — identify high-impact chokepoints before modifying",
42
- "One graph query replaces 5-15 file reads. Only read files for exact implementation details.",
43
- ].join("\n"),
44
- category: "navigation",
45
- trigger: { type: "always" },
46
- tools: [
47
- "get_references",
48
- "get_file",
49
- "get_imports",
50
- "search_code",
51
- "get_critical_nodes",
52
- ],
53
- version: "1.1.0",
54
- };
55
- export const UNDERSTAND_BEFORE_MODIFY_SKILL = {
56
- id: "understand-before-modify",
57
- name: "Understand Before Modify",
58
- description: "Read graph context before modifying any existing code to prevent confident hallucination",
59
- instructions: [
60
- "Before modifying any existing code:",
61
- "",
62
- "0. Check the response for `ur|fct` prefix lines (surfaced episodic/procedural facts about this entity)",
63
- " - If present: understand the intent behind prior changes before planning yours",
64
- " - Also watch for `ur|hst` (prior failures) and `ur|wrn` (negative facts / anti-patterns)",
65
- "",
66
- "1. Read the target function/class (not the whole file)",
67
- "2. Call `get_entity` to get graph context:",
68
- " - Who calls this? (blast radius)",
69
- " - What conventions apply?",
70
- " - What is its health/risk level?",
71
- "3. If risk is HIGH or callers > 5:",
72
- " - Explain the risk to the user before proceeding",
73
- " - Suggest a conservative approach",
74
- "",
75
- "Never modify code you haven't understood through the graph first.",
76
- "The graph knows what you don't — callers, conventions, risk.",
77
- ].join("\n"),
78
- category: "quality",
79
- trigger: { type: "always" },
80
- tools: ["get_entity", "get_references"],
81
- version: "1.1.0",
82
- };
83
- export const BLAST_RADIUS_FIRST_SKILL = {
84
- id: "blast-radius-first",
85
- name: "Blast Radius First",
86
- description: "Check blast radius before modifying any function, class, or exported entity",
87
- instructions: [
88
- "Before modifying any function, class, or exported entity:",
89
- "",
90
- "1. Call `get_references` on the target entity",
91
- "2. If callers > 5, call `get_entity` for full context",
92
- "3. Watch for a `ur|rsk` prefix line in the response (e.g. `ur|rsk fan_in=24 fan_out=3`) — if present:",
93
- " - List all affected callers to the user before proceeding",
94
- " - Consider whether a non-breaking change is possible",
95
- " - If breaking, enumerate what else needs updating",
96
- "4. Only then proceed with the modification",
97
- "",
98
- "Never modify a high-fan-in entity without understanding its blast radius first.",
99
- ].join("\n"),
100
- category: "navigation",
101
- trigger: {
102
- type: "auto",
103
- globs: ["**/*.ts", "**/*.js", "**/*.py", "**/*.go"],
104
- },
105
- tools: ["get_references", "get_entity"],
106
- version: "1.0.0",
107
- };
108
- export const CONVENTION_AWARE_GENERATION_SKILL = {
109
- id: "convention-aware-generation",
110
- name: "Convention-Aware Generation",
111
- description: "Follow project conventions when creating new files or functions",
112
- instructions: [
113
- "Before writing new code in this project:",
114
- "",
115
- "1. Call `get_conventions` with the target file path",
116
- "2. Follow the conventions returned:",
117
- " - Naming: match the project's function/variable naming style",
118
- " - Imports: follow the project's import ordering and path conventions",
119
- " - Structure: match the project's file organization patterns",
120
- "",
121
- "Generate code that fits the project's existing style. Don't impose external conventions.",
122
- ].join("\n"),
123
- category: "quality",
124
- trigger: {
125
- type: "auto",
126
- globs: ["**/*.ts", "**/*.js", "**/*.py", "**/*.go"],
127
- },
128
- tools: ["get_conventions"],
129
- version: "1.0.0",
130
- };
131
- export const DEPENDENCY_AWARE_REFACTOR_SKILL = {
132
- id: "dependency-aware-refactor",
133
- name: "Dependency-Aware Refactor",
134
- description: "Trace dependency chains before moving, renaming, or restructuring code",
135
- instructions: [
136
- "When refactoring code across files:",
137
- "",
138
- "1. Call `get_file` on each file being modified to understand its entity graph",
139
- "2. Call `get_imports` to trace dependency chains — never move code without knowing what depends on it",
140
- "3. Call `get_cross_boundary_links` to find unexpected cross-module dependencies",
141
- "4. For each entity being moved/renamed:",
142
- " - Call `get_references` to find all references that need updating",
143
- " - Update all callers before or immediately after the rename",
144
- "5. After refactoring, verify: call `get_references` on the new location to confirm references updated",
145
- "",
146
- "Do not refactor in isolation. The graph knows every reference — use it.",
147
- ].join("\n"),
148
- category: "navigation",
149
- trigger: { type: "agent-requested" },
150
- tools: [
151
- "get_file",
152
- "get_imports",
153
- "get_references",
154
- "get_cross_boundary_links",
155
- ],
156
- version: "1.0.0",
157
- };
158
- export const SAFE_MODIFICATION_WORKFLOW_SKILL = {
159
- id: "safe-modification-workflow",
160
- name: "Safe Modification Workflow",
161
- description: "4-phase workflow for non-trivial code changes: understand, plan, execute, verify",
162
- instructions: [
163
- "For any non-trivial code modification, follow this sequence:",
164
- "",
165
- "Phase 0 — History:",
166
- " - Watch for `ur|fct` prefix lines in tool responses — these surface episodic/procedural facts about the target file/entity",
167
- " - Also note `ur|hst` (prior failures) and `ur|dft` (drift since last seen) signals",
168
- " - Understand why prior modifications were made",
169
- " - Ensure your change doesn't conflict with prior intent",
170
- "",
171
- "Phase 1 — Understand:",
172
- " - `get_entity` on the target",
173
- " - `get_references` to know blast radius",
174
- " - `get_conventions` to know the local style",
175
- "",
176
- "Phase 2 — Plan:",
177
- " - If blast radius is HIGH (>5 callers), describe the change plan to the user",
178
- " - If conventions would be violated, flag before writing",
179
- "",
180
- "Phase 3 — Execute:",
181
- " - Make the change",
182
- " - Update all callers if signatures changed",
183
- "",
184
- "Phase 4 — Verify:",
185
- " - `get_conventions` — confirm no convention violations introduced",
186
- ].join("\n"),
187
- category: "workflow",
188
- trigger: { type: "agent-requested" },
189
- tools: ["get_entity", "get_references", "get_conventions"],
190
- version: "1.0.0",
191
- };
192
- export const ARCHITECTURE_EXPLORATION_SKILL = {
193
- id: "architecture-exploration",
194
- name: "Architecture Exploration",
195
- description: "Explore unfamiliar codebase areas using graph tools instead of file-by-file reading",
196
- instructions: [
197
- "When exploring an unfamiliar area of the codebase:",
198
- "",
199
- "1. Start broad: `get_project_stats` for overall structure",
200
- "2. Narrow: `get_file` on the entry point file",
201
- "3. Follow connections: `get_references` with direction:callees from the main function to trace the execution path",
202
- "4. Find chokepoints: `get_critical_nodes` to identify the most impactful code",
203
- "5. Search by intent: `search_code` to find entities by name or concept",
204
- "",
205
- "Build understanding from the graph outward, not from files inward.",
206
- ].join("\n"),
207
- category: "workflow",
208
- trigger: { type: "agent-requested" },
209
- tools: [
210
- "get_project_stats",
211
- "get_file",
212
- "get_references",
213
- "get_critical_nodes",
214
- "search_code",
215
- ],
216
- version: "1.0.0",
217
- };
218
- export const FILE_READ_PROTOCOL_SKILL = {
219
- id: "file-read-protocol",
220
- name: "File Read Protocol (Layer 6)",
221
- description: "Use structural outlines and targeted reads instead of dumping entire files into context",
222
- instructions: [
223
- "When reading files, prefer targeted reads over full dumps:",
224
- '• `file_read` with `entity: "FunctionName"` — returns just that entity ±5 lines context.',
225
- "• `file_read` with `offset` + `limit` — returns a specific line window.",
226
- "• `file_outline` — returns structure (entities, imports, exports) without content.",
227
- "",
228
- "Smart behaviors (automatic):",
229
- "• Files >200 lines auto-return an outline unless you pass entity/offset/force_full.",
230
- "• Entity matching is fuzzy — camelCase segments, prefix, and case-insensitive all work.",
231
- "• If entity not found, response includes top-5 suggestions to pick from.",
232
- "• Pass `token_budget` to control response size (default 2000 tokens).",
233
- "• Log files auto-tail to last 200 lines.",
234
- "",
235
- 'One-call pattern: `file_read(file_path, entity: "name")` works on first attempt',
236
- "even without calling file_outline first. No need for a two-step flow.",
237
- ].join("\n"),
238
- category: "workflow",
239
- trigger: { type: "always" },
240
- tools: ["file_outline", "file_read"],
241
- version: "2.0.0",
242
- };
243
- export const SESSION_CONTEXT_PRESERVATION_SKILL = {
244
- id: "session-context-preservation",
245
- name: "Session Context Preservation",
246
- description: "Use prior session context on resume to avoid re-exploring what was already understood",
247
- instructions: [
248
- "At the start of each session:",
249
- "",
250
- "1. Watch for unerr session continuity signals as `ur|<tag>` prefix lines on early tool responses:",
251
- " - `ur|hth` — session degraded, consider starting fresh",
252
- " - `ur|dft` — drift on previously modified files (re-read before editing)",
253
- " - `ur|hst` — prior failures on this entity (read failure modes carefully)",
254
- "2. If previous session data is available:",
255
- " - Review what was changed last session",
256
- " - Note any incomplete work flagged",
257
- " - Check for drift alerts on previously modified files",
258
- "3. Build on prior work — don't re-explore what was already understood",
259
- "4. Watch for `ur|fct` prefix lines (episodic facts about prior modifications to files you're working on)",
260
- "5. If episodic facts surface, understand the 'why' behind prior changes before making new ones",
261
- "",
262
- "unerr tracks cross-session state. Use it to avoid starting from zero.",
263
- ].join("\n"),
264
- category: "behavior",
265
- trigger: { type: "auto" },
266
- tools: [],
267
- version: "1.0.0",
268
- };
269
- export const TIMELINE_MARKERS_SKILL = {
270
- id: "timeline-markers",
271
- name: "Session Narrative Markers",
272
- description: "Emit cheap inline markers (intent, decision, blocker, resolution) as you work — never as an end-of-turn summary",
273
- instructions: [
274
- "Emit session-narrative markers inline as you work. Each marker is one short string.",
275
- "Never bundle markers into an end-of-turn summary; emit them when the moment happens.",
276
- "",
277
- "When starting a non-trivial task:",
278
- " - Call `mark_intent({text: '...'})` with one short sentence describing the task (≤80 chars).",
279
- " - Call this ONCE at the start, not repeatedly.",
280
- "",
281
- "When choosing between approaches:",
282
- " - Call `mark_decision({text: '...', alternatives: [...]})` with the chosen path (≤140 chars).",
283
- " - List up to 5 alternatives that were considered (each ≤80 chars).",
284
- "",
285
- "When stuck on something you cannot resolve in this turn:",
286
- " - Call `mark_blocker({text: '...', file_path: '...'})` (text ≤140 chars).",
287
- " - Save the returned `marker_id` — you (or the next session) will pass it to mark_resolution.",
288
- "",
289
- "When you resolve a previously marked blocker:",
290
- " - Call `mark_resolution({blocker_ref: <prior marker_id>, text: '...'})` describing the fix.",
291
- " - Pass the EXACT marker_id returned by mark_blocker, not a free-form reference.",
292
- "",
293
- "Why this matters:",
294
- " - Markers are persisted to the shadow ledger and timeline.db.",
295
- " - They power turn titles, cross-session intent stitching, the resume strip, and loop/blocker miners.",
296
- " - Unresolved blockers carry into the next session — emitting them prevents you from rediscovering the same dead end tomorrow.",
297
- " - The timeline still works without these markers, but agents that mark intent + decisions make it dramatically more useful.",
298
- ].join("\n"),
299
- category: "behavior",
300
- trigger: { type: "auto" },
301
- tools: ["mark_intent", "mark_decision", "mark_blocker", "mark_resolution"],
302
- version: "1.0.0",
303
- };
304
- export const TURN_DISCIPLINE_SKILL = {
305
- id: "turn-discipline",
306
- name: "Don't Yield Mid-Tasklist",
307
- description: "When working a multi-step plan, do not produce mid-task status summaries — they end the turn and hand control back to the user.",
308
- instructions: [
309
- "When you are working through a TaskList with multiple pending items:",
310
- " - Do NOT emit user-facing status paragraphs between sub-tasks.",
311
- " - Pattern: edit → tool call → edit → tool call. No prose in between.",
312
- " - Save the summary for AFTER the last task completes.",
313
- "",
314
- "Why this matters:",
315
- " - A turn ends the moment the model emits text without an accompanying tool call.",
316
- " - Multi-paragraph 'X done, moving to Y' updates trigger that ending.",
317
- " - The user then has to re-prompt to continue — wasting their attention and turn budget.",
318
- "",
319
- "When it IS OK to narrate:",
320
- " - The user explicitly asked for a status update.",
321
- " - You hit a blocker that needs the user's decision before continuing.",
322
- " - You finished the ENTIRE tasklist (not just one sub-task).",
323
- "",
324
- "If unsure, do one more tool call instead of writing a paragraph.",
325
- ].join("\n"),
326
- category: "workflow",
327
- trigger: { type: "always" },
328
- tools: [],
329
- version: "1.0.0",
330
- };
331
- export const LOCAL_SKILLS = [
332
- TOKEN_EFFICIENT_SKILL,
333
- FILE_READ_PROTOCOL_SKILL,
334
- GRAPH_FIRST_NAVIGATION_SKILL,
335
- UNDERSTAND_BEFORE_MODIFY_SKILL,
336
- BLAST_RADIUS_FIRST_SKILL,
337
- CONVENTION_AWARE_GENERATION_SKILL,
338
- DEPENDENCY_AWARE_REFACTOR_SKILL,
339
- SAFE_MODIFICATION_WORKFLOW_SKILL,
340
- ARCHITECTURE_EXPLORATION_SKILL,
341
- SESSION_CONTEXT_PRESERVATION_SKILL,
342
- TIMELINE_MARKERS_SKILL,
343
- TURN_DISCIPLINE_SKILL,
344
- ];
345
- /**
346
- * Get always-on skills formatted for session context injection.
347
- * Only injects skills with trigger.type === "always" to respect token budget.
348
- */
349
- export function getSkillsContext() {
350
- const alwaysOn = LOCAL_SKILLS.filter((s) => s.trigger.type === "always");
351
- return {
352
- "dev.unerr/active_skills": alwaysOn.map((s) => ({
353
- id: s.id,
354
- name: s.name,
355
- instructions: s.instructions,
356
- })),
357
- "dev.unerr/available_skills": LOCAL_SKILLS.filter((s) => s.trigger.type !== "always").map((s) => ({
358
- id: s.id,
359
- name: s.name,
360
- description: s.description,
361
- trigger: s.trigger.type,
362
- })),
363
- };
364
- }
365
- /**
366
- * Get a specific skill by ID.
367
- */
368
- export function getSkill(id) {
369
- return LOCAL_SKILLS.find((s) => s.id === id) ?? null;
370
- }
371
- /**
372
- * Bundled skills in the schema-compatible format (name, description, content).
373
- * Used by the skill resolver for Tier 1 skill delivery.
374
- */
375
- export const BUNDLED_SKILLS = LOCAL_SKILLS.map((s) => ({
376
- name: s.id,
377
- description: s.description,
378
- content: s.instructions,
379
- version: s.version,
380
- }));