freeharness 0.4.1

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 (375) hide show
  1. package/LICENSE +21 -0
  2. package/NOTICE +108 -0
  3. package/README.md +134 -0
  4. package/canonical/HARVEST.yaml +858 -0
  5. package/canonical/PROVENANCE.yaml +740 -0
  6. package/canonical/agents/README.md +95 -0
  7. package/canonical/agents/agentic-architect.md +18 -0
  8. package/canonical/agents/database-reviewer.md +41 -0
  9. package/canonical/agents/explorer-ai-engineer-analyst.md +65 -0
  10. package/canonical/agents/pr-reviewer.md +96 -0
  11. package/canonical/agents/python-reviewer.md +55 -0
  12. package/canonical/agents/report-formatter.md +19 -0
  13. package/canonical/agents/security-reviewer.md +53 -0
  14. package/canonical/agents/test-writer.md +34 -0
  15. package/canonical/commands/fh-context.md +37 -0
  16. package/canonical/evals/promptfoo.redteam.yaml +108 -0
  17. package/canonical/hooks/cost-prices.json +14 -0
  18. package/canonical/hooks/freeharness-auto-memory.mjs +158 -0
  19. package/canonical/hooks/freeharness-config-guard.mjs +162 -0
  20. package/canonical/hooks/freeharness-context-monitor.mjs +198 -0
  21. package/canonical/hooks/freeharness-converge.mjs +227 -0
  22. package/canonical/hooks/freeharness-cost-tracker.mjs +1027 -0
  23. package/canonical/hooks/freeharness-memory-guard.mjs +57 -0
  24. package/canonical/hooks/freeharness-output-pruner.mjs +333 -0
  25. package/canonical/hooks/freeharness-precompact.mjs +323 -0
  26. package/canonical/hooks/freeharness-repeat-tool.mjs +208 -0
  27. package/canonical/hooks/freeharness-security-guidance.mjs +164 -0
  28. package/canonical/hooks/freeharness-session-start +583 -0
  29. package/canonical/hooks/hooks.auto-memory.claude-code.json +16 -0
  30. package/canonical/hooks/hooks.claude-code.json +17 -0
  31. package/canonical/hooks/hooks.config-guard.claude-code.json +16 -0
  32. package/canonical/hooks/hooks.context-monitor.claude-code.json +15 -0
  33. package/canonical/hooks/hooks.converge.claude-code.json +15 -0
  34. package/canonical/hooks/hooks.cost-tracker.claude-code.json +37 -0
  35. package/canonical/hooks/hooks.memory-guard.claude-code.json +16 -0
  36. package/canonical/hooks/hooks.output-pruner.claude-code.json +16 -0
  37. package/canonical/hooks/hooks.precompact.claude-code.json +15 -0
  38. package/canonical/hooks/hooks.repeat-tool.claude-code.json +25 -0
  39. package/canonical/hooks/hooks.security-guidance.claude-code.json +16 -0
  40. package/canonical/mcp/servers.json +20 -0
  41. package/canonical/openspec/config.base.yaml +89 -0
  42. package/canonical/openspec/schema.spec-driven.yaml +277 -0
  43. package/canonical/openspec/templates/data-contract.md +36 -0
  44. package/canonical/openspec/templates/design.md +84 -0
  45. package/canonical/openspec/templates/eval-plan.md +33 -0
  46. package/canonical/openspec/templates/follow-ups.md +2 -0
  47. package/canonical/openspec/templates/proposal.md +45 -0
  48. package/canonical/openspec/templates/spec.md +42 -0
  49. package/canonical/openspec/templates/tasks.md +38 -0
  50. package/canonical/profiles/local-llamacpp.LOCAL-MODELS.md +47 -0
  51. package/canonical/profiles/local-llamacpp.json +27 -0
  52. package/canonical/profiles/local-ollama.json +20 -0
  53. package/canonical/profiles/mcp.json +91 -0
  54. package/canonical/rules/CLAUDE.md +78 -0
  55. package/canonical/rules/project-CLAUDE.template.md +62 -0
  56. package/canonical/rules/routing.md +20 -0
  57. package/canonical/rules/safety.md +41 -0
  58. package/canonical/settings/settings.cache-hygiene.claude-code.json +5 -0
  59. package/canonical/skills/agent-evaluation/SKILL.md +102 -0
  60. package/canonical/skills/agent-evaluation/assets/evaluation_report_template.md +206 -0
  61. package/canonical/skills/agent-evaluation/evals/cases.yaml +106 -0
  62. package/canonical/skills/agent-evaluation/references/dataset-preparation.md +351 -0
  63. package/canonical/skills/agent-evaluation/references/scorers-constraints.md +165 -0
  64. package/canonical/skills/agent-evaluation/references/scorers.md +431 -0
  65. package/canonical/skills/agent-evaluation/references/setup-guide.md +252 -0
  66. package/canonical/skills/agent-evaluation/references/tracing-integration.md +164 -0
  67. package/canonical/skills/agent-evaluation/references/troubleshooting.md +514 -0
  68. package/canonical/skills/agent-evaluation/scripts/analyze_results.py +462 -0
  69. package/canonical/skills/agent-evaluation/scripts/create_dataset_template.py +382 -0
  70. package/canonical/skills/agent-evaluation/scripts/list_datasets.py +273 -0
  71. package/canonical/skills/agent-evaluation/scripts/run_evaluation_template.py +309 -0
  72. package/canonical/skills/agent-evaluation/scripts/setup_mlflow.py +353 -0
  73. package/canonical/skills/agent-evaluation/scripts/utils/__init__.py +27 -0
  74. package/canonical/skills/agent-evaluation/scripts/utils/env_validation.py +123 -0
  75. package/canonical/skills/agent-evaluation/scripts/utils/tracing_utils.py +108 -0
  76. package/canonical/skills/agent-evaluation/scripts/validate_agent_tracing.py +148 -0
  77. package/canonical/skills/agent-evaluation/scripts/validate_auth.py +240 -0
  78. package/canonical/skills/agent-evaluation/scripts/validate_environment.py +185 -0
  79. package/canonical/skills/agent-evaluation/scripts/validate_tracing_runtime.py +318 -0
  80. package/canonical/skills/agentic-architecture/SKILL.md +41 -0
  81. package/canonical/skills/agentic-architecture/evals/cases.yaml +94 -0
  82. package/canonical/skills/agentic-architecture/reference/context-engineering.md +75 -0
  83. package/canonical/skills/agentic-architecture/reference/patterns.md +76 -0
  84. package/canonical/skills/agentic-architecture/reference/reliability-observability.md +94 -0
  85. package/canonical/skills/agentic-architecture/reference/review-framework.md +59 -0
  86. package/canonical/skills/code-review/SKILL.md +52 -0
  87. package/canonical/skills/code-review/evals/cases.yaml +197 -0
  88. package/canonical/skills/git-workflow/SKILL.md +41 -0
  89. package/canonical/skills/git-workflow/evals/cases.yaml +92 -0
  90. package/canonical/skills/local-code/SKILL.md +24 -0
  91. package/canonical/skills/local-code/evals/cases.yaml +85 -0
  92. package/canonical/skills/local-code/scripts/query_llama.py +68 -0
  93. package/canonical/skills/report-formatting/SKILL.md +62 -0
  94. package/canonical/skills/report-formatting/evals/cases.yaml +83 -0
  95. package/canonical/skills/report-formatting/reference/ARCHITECTURE.md +135 -0
  96. package/canonical/skills/report-formatting/reference/HELPERS.md +120 -0
  97. package/canonical/skills/report-formatting/reference/PPTX.md +136 -0
  98. package/canonical/skills/report-formatting/reference/RELEASE.md +99 -0
  99. package/canonical/skills/report-formatting/reference/TEMPLATES.md +48 -0
  100. package/canonical/skills/report-formatting/reference/authoring.md +66 -0
  101. package/canonical/skills/report-formatting/scripts/architecture-template.md +271 -0
  102. package/canonical/skills/report-formatting/scripts/assets/claro-logo.png +0 -0
  103. package/canonical/skills/report-formatting/scripts/assets/claro-wordmark.svg +1 -0
  104. package/canonical/skills/report-formatting/scripts/build-architecture.js +57 -0
  105. package/canonical/skills/report-formatting/scripts/build-md-claro.js +224 -0
  106. package/canonical/skills/report-formatting/scripts/build-release.js +51 -0
  107. package/canonical/skills/report-formatting/scripts/check-env.js +58 -0
  108. package/canonical/skills/report-formatting/scripts/docmodel.js +283 -0
  109. package/canonical/skills/report-formatting/scripts/example-build.js +119 -0
  110. package/canonical/skills/report-formatting/scripts/example_build_ArchitectureReview_docx.js +195 -0
  111. package/canonical/skills/report-formatting/scripts/example_build_ExecutiveReport_docx.js +114 -0
  112. package/canonical/skills/report-formatting/scripts/package.json +17 -0
  113. package/canonical/skills/report-formatting/scripts/pptx/example_build_StatusReport_pptx.py +223 -0
  114. package/canonical/skills/report-formatting/scripts/pptx/example_build_WeeklyStatus_pptx.py +245 -0
  115. package/canonical/skills/report-formatting/scripts/pptx/pptx_office.py +144 -0
  116. package/canonical/skills/report-formatting/scripts/pptx/requirements.txt +7 -0
  117. package/canonical/skills/report-formatting/scripts/pptx/status_report_blocks.py +193 -0
  118. package/canonical/skills/report-formatting/scripts/pptx/theme_claro_pptx.py +473 -0
  119. package/canonical/skills/report-formatting/scripts/release-template.md +80 -0
  120. package/canonical/skills/report-formatting/scripts/render-mermaid.js +105 -0
  121. package/canonical/skills/report-formatting/scripts/theme-claro.js +403 -0
  122. package/canonical/skills/subagent-driven-development/SKILL.md +60 -0
  123. package/canonical/skills/subagent-driven-development/evals/cases.yaml +208 -0
  124. package/canonical/skills/subagent-driven-development/reference/brief.md +91 -0
  125. package/canonical/skills/subagent-driven-development/reference/handoff.md +118 -0
  126. package/canonical/skills/subagent-driven-development/scripts/validate-handoff.mjs +850 -0
  127. package/canonical/skills/systematic-debugging/SKILL.md +44 -0
  128. package/canonical/skills/systematic-debugging/evals/cases.yaml +90 -0
  129. package/canonical/skills/test-driven-development/SKILL.md +42 -0
  130. package/canonical/skills/test-driven-development/evals/cases.yaml +86 -0
  131. package/canonical/skills/test-driven-development/reference/writing-good-tests.md +52 -0
  132. package/canonical/skills/verification-before-completion/SKILL.md +53 -0
  133. package/canonical/skills/verification-before-completion/evals/cases.yaml +107 -0
  134. package/dist/adapters/content/language-lint.d.ts +46 -0
  135. package/dist/adapters/content/language-lint.js +191 -0
  136. package/dist/adapters/harness/claude-code.d.ts +57 -0
  137. package/dist/adapters/harness/claude-code.js +385 -0
  138. package/dist/adapters/harness/index.d.ts +3 -0
  139. package/dist/adapters/harness/index.js +17 -0
  140. package/dist/adapters/harness/opencode.d.ts +7 -0
  141. package/dist/adapters/harness/opencode.js +166 -0
  142. package/dist/adapters/harness/plugin.d.ts +22 -0
  143. package/dist/adapters/harness/plugin.js +257 -0
  144. package/dist/adapters/memory/doctor.d.ts +480 -0
  145. package/dist/adapters/memory/doctor.js +1217 -0
  146. package/dist/adapters/memory/vendored.d.ts +150 -0
  147. package/dist/adapters/memory/vendored.js +487 -0
  148. package/dist/adapters/package/node.d.ts +9 -0
  149. package/dist/adapters/package/node.js +20 -0
  150. package/dist/adapters/prompt/readline.d.ts +19 -0
  151. package/dist/adapters/prompt/readline.js +53 -0
  152. package/dist/adapters/sync/diff.d.ts +43 -0
  153. package/dist/adapters/sync/diff.js +380 -0
  154. package/dist/cli/cleanup.d.ts +86 -0
  155. package/dist/cli/cleanup.js +382 -0
  156. package/dist/cli/cost.d.ts +304 -0
  157. package/dist/cli/cost.js +501 -0
  158. package/dist/cli/doctor.d.ts +205 -0
  159. package/dist/cli/doctor.js +654 -0
  160. package/dist/cli/executor.d.ts +5 -0
  161. package/dist/cli/executor.js +48 -0
  162. package/dist/cli/plugin-validate.d.ts +37 -0
  163. package/dist/cli/plugin-validate.js +256 -0
  164. package/dist/cli/prefix.d.ts +68 -0
  165. package/dist/cli/prefix.js +218 -0
  166. package/dist/cli/profile.d.ts +170 -0
  167. package/dist/cli/profile.js +285 -0
  168. package/dist/cli/runner.d.ts +10 -0
  169. package/dist/cli/runner.js +27 -0
  170. package/dist/cli/uninstall.d.ts +65 -0
  171. package/dist/cli/uninstall.js +147 -0
  172. package/dist/index.d.ts +8 -0
  173. package/dist/index.js +989 -0
  174. package/dist/infra/dogfood.d.ts +31 -0
  175. package/dist/infra/dogfood.js +51 -0
  176. package/dist/infra/fsutil.d.ts +40 -0
  177. package/dist/infra/fsutil.js +143 -0
  178. package/dist/infra/manifest.d.ts +76 -0
  179. package/dist/infra/manifest.js +92 -0
  180. package/dist/infra/paths.d.ts +19 -0
  181. package/dist/infra/paths.js +74 -0
  182. package/dist/infra/routing.d.ts +4 -0
  183. package/dist/infra/routing.js +7 -0
  184. package/node_modules/@freeharness/core/dist/context.d.ts +30 -0
  185. package/node_modules/@freeharness/core/dist/context.js +1 -0
  186. package/node_modules/@freeharness/core/dist/index.d.ts +5 -0
  187. package/node_modules/@freeharness/core/dist/index.js +6 -0
  188. package/node_modules/@freeharness/core/dist/planner.d.ts +13 -0
  189. package/node_modules/@freeharness/core/dist/planner.js +18 -0
  190. package/node_modules/@freeharness/core/dist/ports.d.ts +90 -0
  191. package/node_modules/@freeharness/core/dist/ports.js +1 -0
  192. package/node_modules/@freeharness/core/dist/registry.d.ts +41 -0
  193. package/node_modules/@freeharness/core/dist/registry.js +124 -0
  194. package/node_modules/@freeharness/core/dist/tiers.d.ts +30 -0
  195. package/node_modules/@freeharness/core/dist/tiers.js +99 -0
  196. package/node_modules/@freeharness/core/package.json +34 -0
  197. package/node_modules/@freeharness/sdd/PROVENANCE.yaml +175 -0
  198. package/node_modules/@freeharness/sdd/dist/src/bin/openspec.d.ts +2 -0
  199. package/node_modules/@freeharness/sdd/dist/src/bin/openspec.js +166 -0
  200. package/node_modules/@freeharness/sdd/dist/src/index.d.ts +14 -0
  201. package/node_modules/@freeharness/sdd/dist/src/index.js +11 -0
  202. package/node_modules/@freeharness/sdd/dist/src/init.d.ts +39 -0
  203. package/node_modules/@freeharness/sdd/dist/src/init.js +190 -0
  204. package/node_modules/@freeharness/sdd/dist/src/root-resolver.d.ts +8 -0
  205. package/node_modules/@freeharness/sdd/dist/src/root-resolver.js +32 -0
  206. package/node_modules/@freeharness/sdd/dist/src/shim/archive.d.ts +81 -0
  207. package/node_modules/@freeharness/sdd/dist/src/shim/archive.js +483 -0
  208. package/node_modules/@freeharness/sdd/dist/src/shim/context.d.ts +4 -0
  209. package/node_modules/@freeharness/sdd/dist/src/shim/context.js +48 -0
  210. package/node_modules/@freeharness/sdd/dist/src/shim/follow-up.d.ts +57 -0
  211. package/node_modules/@freeharness/sdd/dist/src/shim/follow-up.js +279 -0
  212. package/node_modules/@freeharness/sdd/dist/src/shim/instructions.d.ts +67 -0
  213. package/node_modules/@freeharness/sdd/dist/src/shim/instructions.js +460 -0
  214. package/node_modules/@freeharness/sdd/dist/src/shim/list.d.ts +5 -0
  215. package/node_modules/@freeharness/sdd/dist/src/shim/list.js +95 -0
  216. package/node_modules/@freeharness/sdd/dist/src/shim/new-change.d.ts +6 -0
  217. package/node_modules/@freeharness/sdd/dist/src/shim/new-change.js +150 -0
  218. package/node_modules/@freeharness/sdd/dist/src/shim/schemas.d.ts +4 -0
  219. package/node_modules/@freeharness/sdd/dist/src/shim/schemas.js +23 -0
  220. package/node_modules/@freeharness/sdd/dist/src/shim/shared.d.ts +56 -0
  221. package/node_modules/@freeharness/sdd/dist/src/shim/shared.js +140 -0
  222. package/node_modules/@freeharness/sdd/dist/src/shim/status.d.ts +8 -0
  223. package/node_modules/@freeharness/sdd/dist/src/shim/status.js +85 -0
  224. package/node_modules/@freeharness/sdd/dist/src/shim/validate.d.ts +6 -0
  225. package/node_modules/@freeharness/sdd/dist/src/shim/validate.js +229 -0
  226. package/node_modules/@freeharness/sdd/dist/src/validate-change.d.ts +40 -0
  227. package/node_modules/@freeharness/sdd/dist/src/validate-change.js +114 -0
  228. package/node_modules/@freeharness/sdd/dist/src/validate.d.ts +24 -0
  229. package/node_modules/@freeharness/sdd/dist/src/validate.js +72 -0
  230. package/node_modules/@freeharness/sdd/dist/vendor/openspec/apply/specs-apply.d.ts +130 -0
  231. package/node_modules/@freeharness/sdd/dist/vendor/openspec/apply/specs-apply.js +981 -0
  232. package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/change-metadata.d.ts +46 -0
  233. package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/change-metadata.js +128 -0
  234. package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/change-status-policy.d.ts +26 -0
  235. package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/change-status-policy.js +32 -0
  236. package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/file-system.d.ts +50 -0
  237. package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/file-system.js +394 -0
  238. package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/global-config.d.ts +15 -0
  239. package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/global-config.js +49 -0
  240. package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/graph.d.ts +71 -0
  241. package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/graph.js +164 -0
  242. package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/index.d.ts +11 -0
  243. package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/index.js +21 -0
  244. package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/instruction-loader.d.ts +102 -0
  245. package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/instruction-loader.js +230 -0
  246. package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/outputs.d.ts +18 -0
  247. package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/outputs.js +138 -0
  248. package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/resolver.d.ts +82 -0
  249. package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/resolver.js +333 -0
  250. package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/schema.d.ts +12 -0
  251. package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/schema.js +110 -0
  252. package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/state.d.ts +11 -0
  253. package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/state.js +32 -0
  254. package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/task-progress.d.ts +33 -0
  255. package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/task-progress.js +149 -0
  256. package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/types.d.ts +39 -0
  257. package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/types.js +49 -0
  258. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/command-generation/adapters/claude.d.ts +12 -0
  259. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/command-generation/adapters/claude.js +31 -0
  260. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/command-generation/adapters/index.d.ts +10 -0
  261. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/command-generation/adapters/index.js +10 -0
  262. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/command-generation/adapters/opencode.d.ts +12 -0
  263. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/command-generation/adapters/opencode.js +26 -0
  264. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/command-generation/generator.d.ts +28 -0
  265. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/command-generation/generator.js +41 -0
  266. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/command-generation/index.d.ts +23 -0
  267. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/command-generation/index.js +25 -0
  268. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/command-generation/invocation.d.ts +72 -0
  269. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/command-generation/invocation.js +76 -0
  270. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/command-generation/registry.d.ts +39 -0
  271. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/command-generation/registry.js +53 -0
  272. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/command-generation/types.d.ts +62 -0
  273. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/command-generation/types.js +7 -0
  274. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/command-generation/yaml.d.ts +35 -0
  275. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/command-generation/yaml.js +47 -0
  276. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/command-references.d.ts +33 -0
  277. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/command-references.js +55 -0
  278. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/shared/allowed-tools.d.ts +11 -0
  279. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/shared/allowed-tools.js +11 -0
  280. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/shared/skill-generation.d.ts +48 -0
  281. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/shared/skill-generation.js +99 -0
  282. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/skill-templates.d.ts +19 -0
  283. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/skill-templates.js +18 -0
  284. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/types.d.ts +18 -0
  285. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/types.js +4 -0
  286. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/apply-change.d.ts +19 -0
  287. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/apply-change.js +207 -0
  288. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/archive-change.d.ts +12 -0
  289. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/archive-change.js +409 -0
  290. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/bulk-archive-change.d.ts +9 -0
  291. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/bulk-archive-change.js +673 -0
  292. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/continue-change.d.ts +9 -0
  293. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/continue-change.js +230 -0
  294. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/explore.d.ts +12 -0
  295. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/explore.js +550 -0
  296. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/feedback.d.ts +8 -0
  297. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/feedback.js +107 -0
  298. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/ff-change.d.ts +12 -0
  299. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/ff-change.js +228 -0
  300. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/new-change.d.ts +9 -0
  301. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/new-change.js +147 -0
  302. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/onboard.d.ts +9 -0
  303. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/onboard.js +571 -0
  304. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/propose.d.ts +12 -0
  305. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/propose.js +322 -0
  306. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/store-selection.d.ts +7 -0
  307. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/store-selection.js +7 -0
  308. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/sync-specs.d.ts +9 -0
  309. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/sync-specs.js +518 -0
  310. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/update-change.d.ts +9 -0
  311. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/update-change.js +176 -0
  312. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/verify-change.d.ts +9 -0
  313. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/verify-change.js +344 -0
  314. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/constants.d.ts +39 -0
  315. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/constants.js +54 -0
  316. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/delta-resolution.d.ts +35 -0
  317. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/delta-resolution.js +171 -0
  318. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/parsers/change-parser.d.ts +27 -0
  319. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/parsers/change-parser.js +210 -0
  320. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/parsers/code-fence.d.ts +14 -0
  321. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/parsers/code-fence.js +48 -0
  322. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/parsers/markdown-parser.d.ts +22 -0
  323. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/parsers/markdown-parser.js +186 -0
  324. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/parsers/requirement-blocks.d.ts +65 -0
  325. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/parsers/requirement-blocks.js +409 -0
  326. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/parsers/requirement-text.d.ts +55 -0
  327. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/parsers/requirement-text.js +98 -0
  328. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/parsers/spec-structure.d.ts +8 -0
  329. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/parsers/spec-structure.js +77 -0
  330. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/purpose-placeholder.d.ts +44 -0
  331. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/purpose-placeholder.js +116 -0
  332. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/schemas/base.schema.d.ts +12 -0
  333. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/schemas/base.schema.js +17 -0
  334. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/schemas/change.schema.d.ts +72 -0
  335. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/schemas/change.schema.js +30 -0
  336. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/schemas/index.d.ts +3 -0
  337. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/schemas/index.js +3 -0
  338. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/schemas/spec.schema.d.ts +17 -0
  339. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/schemas/spec.schema.js +14 -0
  340. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/spec-discovery.d.ts +39 -0
  341. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/spec-discovery.js +114 -0
  342. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/task-lines.d.ts +45 -0
  343. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/task-lines.js +105 -0
  344. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/task-numbering.d.ts +15 -0
  345. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/task-numbering.js +56 -0
  346. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/types.d.ts +17 -0
  347. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/types.js +1 -0
  348. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/validator.d.ts +94 -0
  349. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/validator.js +756 -0
  350. package/node_modules/@freeharness/sdd/package.json +57 -0
  351. package/node_modules/@freeharness/sdd/vendor/openspec/LICENSE.upstream +22 -0
  352. package/node_modules/@freeharness/sdd/vendor/openspec/assets/schema.upstream.yaml +232 -0
  353. package/node_modules/@freeharness/sdd/vendor/openspec/assets/skills/README.md +19 -0
  354. package/node_modules/@freeharness/sdd/vendor/openspec/assets/skills/openspec-apply-change/SKILL.md +187 -0
  355. package/node_modules/@freeharness/sdd/vendor/openspec/assets/skills/openspec-archive-change/SKILL.md +181 -0
  356. package/node_modules/@freeharness/sdd/vendor/openspec/assets/skills/openspec-bulk-archive-change/SKILL.md +338 -0
  357. package/node_modules/@freeharness/sdd/vendor/openspec/assets/skills/openspec-continue-change/SKILL.md +117 -0
  358. package/node_modules/@freeharness/sdd/vendor/openspec/assets/skills/openspec-explore/SKILL.md +342 -0
  359. package/node_modules/@freeharness/sdd/vendor/openspec/assets/skills/openspec-ff-change/SKILL.md +116 -0
  360. package/node_modules/@freeharness/sdd/vendor/openspec/assets/skills/openspec-new-change/SKILL.md +76 -0
  361. package/node_modules/@freeharness/sdd/vendor/openspec/assets/skills/openspec-onboard/SKILL.md +560 -0
  362. package/node_modules/@freeharness/sdd/vendor/openspec/assets/skills/openspec-propose/SKILL.md +162 -0
  363. package/node_modules/@freeharness/sdd/vendor/openspec/assets/skills/openspec-sync-specs/SKILL.md +261 -0
  364. package/node_modules/@freeharness/sdd/vendor/openspec/assets/skills/openspec-update-change/SKILL.md +90 -0
  365. package/node_modules/@freeharness/sdd/vendor/openspec/assets/skills/openspec-verify-change/SKILL.md +174 -0
  366. package/package.json +70 -0
  367. package/provenance/canonical.PROVENANCE.yaml +740 -0
  368. package/provenance/claude-mem.LICENSE.upstream +202 -0
  369. package/provenance/memory.PROVENANCE.yaml +399 -0
  370. package/provenance/sdd.PROVENANCE.yaml +175 -0
  371. package/vendor-licenses/caveman.LICENSE +27 -0
  372. package/vendor-licenses/deepseek-harness.LICENSE +21 -0
  373. package/vendor-licenses/ecc.LICENSE +21 -0
  374. package/vendor-licenses/pi.LICENSE +21 -0
  375. package/vendor-licenses/superpowers.LICENSE +21 -0
@@ -0,0 +1,480 @@
1
+ import { spawnSync } from "node:child_process";
2
+ export interface CacheVersion {
3
+ version: string;
4
+ dir: string;
5
+ ours: boolean;
6
+ skills: string[];
7
+ /** Found under the upstream (thedotmack/claude-mem) cache root: a previous FreeHarness
8
+ * build (pre-rename) or a genuine upstream install, never our current native path. */
9
+ legacy: boolean;
10
+ }
11
+ export interface WorkerProbe {
12
+ port: number;
13
+ reachable: boolean;
14
+ version?: string;
15
+ viewer?: boolean;
16
+ ours?: boolean;
17
+ }
18
+ /** Marker in the FreeHarness viewer page served on GET / (plugin/ui/viewer.html). */
19
+ export declare const VIEWER_MARKER = "FreeHarness memory";
20
+ /** Mirror of engine shared/observer-health.ts: warn only after this many consecutive failures. */
21
+ export declare const OBSERVER_UNHEALTHY_FAILURE_THRESHOLD = 3;
22
+ /** Mirror of engine shared/quota-cooldown.ts: how long requests are withheld after a quota refusal. */
23
+ export declare const QUOTA_EXHAUSTED_RECHECK_COOLDOWN_MS: number;
24
+ /** Ledger file names (engine shared/observer-health.ts, shared/quota-cooldown.ts), under the data dir. */
25
+ export declare const OBSERVER_HEALTH_FILENAME = "observer-health.json";
26
+ export declare const QUOTA_COOLDOWN_FILENAME = "quota-cooldown.json";
27
+ /** The observer-health ledger as the engine writes it (all fields optional for older builds). */
28
+ export interface ObserverHealth {
29
+ consecutiveFailures: number;
30
+ failingSinceAt: number | null;
31
+ lastErrorAt: number | null;
32
+ lastErrorMessage: string | null;
33
+ lastErrorProvider: string | null;
34
+ lastSuccessAt: number | null;
35
+ lastErrorKind?: string | null;
36
+ lastErrorCode?: string | null;
37
+ lastErrorAction?: string | null;
38
+ }
39
+ /** One armed quota breaker (the persisted half; probe claims are never on disk). */
40
+ export interface QuotaCooldown {
41
+ provider: string;
42
+ message: string;
43
+ window?: string;
44
+ armedAtMs: number;
45
+ /** Milliseconds left in the cooldown (0 when it elapsed and the next observation re-probes). */
46
+ remainingMs: number;
47
+ }
48
+ /** Observer state derived from the ledgers. */
49
+ export interface ObserverStatus {
50
+ health: ObserverHealth | null;
51
+ unhealthy: boolean;
52
+ cooldowns: QuotaCooldown[];
53
+ }
54
+ export interface MemoryDiagnosis {
55
+ configDir: string;
56
+ dataDir: string;
57
+ dbPath: string;
58
+ dbBytes: number;
59
+ chromaPresent: boolean;
60
+ cache: CacheVersion[];
61
+ activeInstallPath?: string;
62
+ activeVersion?: string;
63
+ activeIsOurs?: boolean;
64
+ worker: WorkerProbe;
65
+ observer: ObserverStatus;
66
+ verdict: "ours" | "upstream" | "mixed" | "none";
67
+ lines: string[];
68
+ }
69
+ /**
70
+ * Read the observer ledgers of the data dir.
71
+ *
72
+ * Args:
73
+ * data: The claude-mem data dir.
74
+ * now: Clock (ms), injectable for tests.
75
+ *
76
+ * Returns:
77
+ * Health (null when no ledger), the unhealthy verdict (engine rule: >= threshold failures
78
+ * and the last error newer than the last success) and every armed cooldown with its remaining time.
79
+ */
80
+ export declare function readObserverStatus(data: string, now?: number): ObserverStatus;
81
+ /**
82
+ * How long an unresolved observer verdict stays worth a fresh warning. Independent of the
83
+ * engine's own `isObserverUnhealthy` (that gate does not carry an age bound yet): this reads
84
+ * the same ledger file directly so `memory status` can down-rank a failure with no session in
85
+ * between from a live WARN to a dated INFO line.
86
+ */
87
+ export declare const OBSERVER_STALE_AFTER_MS: number;
88
+ /**
89
+ * True when the ledger's last failure is old enough that a fresh WARN would be noise: the
90
+ * same unhealthy condition (>= threshold consecutive failures, the last error newer than the
91
+ * last success) plus that last error being older than `OBSERVER_STALE_AFTER_MS`.
92
+ *
93
+ * Args:
94
+ * ledger: The observer-health ledger (null when no ledger file exists yet).
95
+ * nowMs: Clock (ms), injectable for tests.
96
+ *
97
+ * Returns:
98
+ * Whether the verdict is stale.
99
+ */
100
+ export declare function isObserverVerdictStale(ledger: ObserverHealth | null, nowMs?: number): boolean;
101
+ /**
102
+ * Printable lines for the observer state (OK/WARN/INFO prefixed).
103
+ *
104
+ * Args:
105
+ * s: The observer status.
106
+ * now: Clock (ms).
107
+ *
108
+ * Returns:
109
+ * Lines: one for the health ledger, one per cooldown (or "no quota cooldown").
110
+ */
111
+ export declare function observerLines(s: ObserverStatus, now?: number): string[];
112
+ /** Highest schema_versions row our vendored SessionStore applies (13.24.0 port; the upstream v50 observed_model/observed_billing migration is telemetry-only and not ported). */
113
+ export declare const OUR_SCHEMA_VERSION = 49;
114
+ /** One (window, model) group from the `observations` table. */
115
+ export interface SpendRow {
116
+ window: "today" | "seven_day";
117
+ model: string;
118
+ observations: number;
119
+ tokens: number;
120
+ }
121
+ type SpawnSyncFn = typeof spawnSync;
122
+ /**
123
+ * Why `observerSpend` could not read spend rows: the sqlite3 binary itself is missing
124
+ * (`missingBinary: true`, `spendLines` prints the fixed "unavailable without sqlite3" line),
125
+ * or a present binary reported a query/database error (`missingBinary: false`, `spendLines`
126
+ * prints `reason` — the first line of sqlite3's own stderr — so a real query failure is never
127
+ * mistaken for "install sqlite3").
128
+ */
129
+ export interface SpendUnavailable {
130
+ reason: string;
131
+ missingBinary: boolean;
132
+ }
133
+ /**
134
+ * Reads observer spend (observation count and summed `discovery_tokens`) grouped by day
135
+ * window and `generated_by_model`, through `sqlite3 -readonly` (same invocation shape as
136
+ * `dbSchemaVersion`). The seven-day window includes today, matching the running total an
137
+ * owner reads off `memory status` (not "the other six days").
138
+ *
139
+ * Args:
140
+ * dbPath: Path of claude-mem.db.
141
+ * spawn: Injectable spawnSync, so the missing-binary path is deterministic in tests
142
+ * regardless of whether sqlite3 happens to be on the test machine's PATH.
143
+ *
144
+ * Returns:
145
+ * One row per (window, model) with a row, or the reason spend could not be read.
146
+ */
147
+ export declare function observerSpend(dbPath: string, spawn?: SpawnSyncFn): SpendRow[] | SpendUnavailable;
148
+ /**
149
+ * Model ids that name metered Claude spend: the `claude-*` families, a bare tier alias
150
+ * (`haiku`, `sonnet`, `opus`, alone or with a `-` suffix) and the `$TIER:` placeholder the
151
+ * engine writes before a tier is resolved. `generated_by_model` stores the id as configured,
152
+ * and the engine's own default simple-tier model is the bare alias `haiku`, so a plain
153
+ * `claude` prefix test would file the whole simple tier as free local spend.
154
+ *
155
+ * The same rule, with the same expression, lives in the cost-tracker hook
156
+ * (`canonical/hooks/freeharness-cost-tracker.mjs`): the two split the same rows and a
157
+ * divergence would make `memory status` and `cost report` disagree on one machine.
158
+ *
159
+ * Args:
160
+ * model: A `generated_by_model` value.
161
+ *
162
+ * Returns:
163
+ * True for a Claude id, false for a local one.
164
+ */
165
+ export declare function isClaudeModelId(model: string): boolean;
166
+ /**
167
+ * Renders `observerSpend`'s result as printable INFO lines: for each window (today, then the
168
+ * seven-day window) that has at least one row, the Claude model rows, then the local model
169
+ * rows, then a `subscription observer tokens` subtotal summing the Claude rows of that window
170
+ * only — the subscription is the metered resource, so a local row never inflates it and a
171
+ * local-only window still gets a printed (zero) subtotal, since the window itself had
172
+ * activity. A window with no rows at all (a fresh install, or a provider not yet run today)
173
+ * prints nothing, matching the pre-split behavior for an empty result. A single line instead
174
+ * when spend could not be read at all (the fixed sqlite3-missing wording, or the
175
+ * query/database error's own reason).
176
+ *
177
+ * Args:
178
+ * spend: `observerSpend`'s return value.
179
+ *
180
+ * Returns:
181
+ * Lines in today-rows/today-subtotal/seven-day-rows/seven-day-subtotal order; `[]` when
182
+ * `spend` is an empty array (no observations in either window).
183
+ */
184
+ export declare function spendLines(spend: SpendRow[] | SpendUnavailable): string[];
185
+ /** The day's local-provider activity, read from `<data-dir>/local-provider.jsonl`. */
186
+ export interface LocalProviderLogSummary {
187
+ /** Local-attempted batches today (`attempted === "local"`), served locally or falling back. */
188
+ batches: number;
189
+ /** Of `batches`, the ones the local server actually answered (`answered === "local"`). */
190
+ local: number;
191
+ /** `batches - local`, broken down by failure kind (`local_timeout`, `local_unparseable`, ...). */
192
+ fallbacks: Record<string, number>;
193
+ /** Lines that were not valid JSON, or lacked a parseable `ts` or a recognized `attempted`. */
194
+ skippedLines: number;
195
+ /** True when the file exceeded the read cap and only its tail was scanned (see `readLocalProviderLog`'s `maxBytes`). */
196
+ truncated: boolean;
197
+ }
198
+ /** A present but unreadable batch log (permissions, I/O), distinct from one that does not exist. */
199
+ export interface LocalProviderLogUnavailable {
200
+ reason: string;
201
+ }
202
+ /**
203
+ * Reads today's local-provider activity from the append-only batch log, at most its last
204
+ * `maxBytes` (default 4 MB) so an unrotated, ever-growing log never makes `memory status`
205
+ * read the whole file.
206
+ *
207
+ * Args:
208
+ * logPath: `<data-dir>/local-provider.jsonl`.
209
+ * dayStartMs: Start of the UTC day being summarized. The engine writes `ts` as an ISO
210
+ * instant and the only caller passes `startOfUtcDayMs`, so the window matches the UTC
211
+ * boundary `observerSpend`'s `date('now')` already uses and the two lines describe one day.
212
+ * nowMs: End of the window (the day so far).
213
+ * maxBytes: Read cap, injectable so a test can exercise truncation without writing a
214
+ * multi-megabyte fixture.
215
+ *
216
+ * Returns:
217
+ * The day's batch/fallback counts and whether the read was truncated; null when the log file
218
+ * does not exist yet (a fresh `CLAUDE_MEM_PROVIDER=claude` machine has never written one);
219
+ * the reason when the file is there but could not be read, which is a different state from
220
+ * an absent log and gets its own printed line.
221
+ */
222
+ export declare function readLocalProviderLog(logPath: string, dayStartMs: number, nowMs: number, maxBytes?: number): LocalProviderLogSummary | LocalProviderLogUnavailable | null;
223
+ /** One day's locally answered observation count and how many share a title within a session. */
224
+ export interface DuplicateCounts {
225
+ observations: number;
226
+ duplicates: number;
227
+ }
228
+ /** The near-duplicate figures the eval plan compares: the day so far against the one before it. */
229
+ export interface DuplicateStats {
230
+ today: DuplicateCounts;
231
+ yesterday: DuplicateCounts;
232
+ }
233
+ /**
234
+ * Reads the near-duplicate rate of the locally answered observations, for the UTC day so far
235
+ * and for the one before it: rows are grouped by `(generated_by_model, memory_session_id,
236
+ * title)` and every row past the first of a group counts as a near-duplicate. Only rows whose
237
+ * `generated_by_model` fails `isClaudeModelId` are counted — a stateless local batch has no
238
+ * prior context to avoid repeating itself, which is the cost the figure exists to measure, and
239
+ * a Claude row would dilute it. The previous day is read in the same pass so the rate has a
240
+ * local-to-local baseline: the day so far compared against the day before it, both counting
241
+ * only locally answered rows.
242
+ *
243
+ * Same unavailability shape as `observerSpend`.
244
+ *
245
+ * Args:
246
+ * dbPath: Path of claude-mem.db.
247
+ * spawn: Injectable spawnSync (see `observerSpend`).
248
+ *
249
+ * Returns:
250
+ * Both days' observation and duplicate counts, or the reason the rate could not be read.
251
+ */
252
+ export declare function observerDuplicateRate(dbPath: string, spawn?: SpawnSyncFn): DuplicateStats | SpendUnavailable;
253
+ /**
254
+ * Renders the local-provider log summary and near-duplicate rate as printable INFO lines: the
255
+ * batch/fallback line, then the near-duplicate-rate line (omitted when the rate could not be
256
+ * read). Nothing at all when `summary` is null (no `local-provider.jsonl` yet); a single WARN
257
+ * naming the reason when the log is present but unreadable, so a permission or I/O failure
258
+ * never reads like a machine that has not run the local provider.
259
+ *
260
+ * Args:
261
+ * summary: `readLocalProviderLog`'s return value.
262
+ * duplicates: `observerDuplicateRate`'s return value.
263
+ *
264
+ * Returns:
265
+ * Zero, one or two lines.
266
+ */
267
+ export declare function localProviderLines(summary: LocalProviderLogSummary | LocalProviderLogUnavailable | null, duplicates: DuplicateStats | SpendUnavailable): string[];
268
+ /** A `haiku` alias (bare or `claude-haiku-*`), the FreeHarness-recommended observer model kind. */
269
+ export declare function isHaikuAlias(model: string): boolean;
270
+ /** Effective observer model per tier, after merging engine defaults with the owner's file. */
271
+ export interface EffectiveObserverModels {
272
+ base: string;
273
+ simple: string;
274
+ summary: string;
275
+ }
276
+ /**
277
+ * Effective observer model per tier: the engine defaults with the owner's settings.json layered
278
+ * on top, and the summary tier's empty-default resolved to the base model (the engine's own
279
+ * "empty = use default model for summaries" rule) so the printed value is what actually runs.
280
+ *
281
+ * Args:
282
+ * settingsPath: Path of the data dir's settings.json (absent or malformed = engine defaults).
283
+ *
284
+ * Returns:
285
+ * Base, simple and summary model ids.
286
+ */
287
+ export declare function effectiveObserverModels(settingsPath: string): EffectiveObserverModels;
288
+ /** Which provider the observer actually runs on, and its model when that provider is local. */
289
+ export interface ObserverProvider {
290
+ provider: "claude" | "local";
291
+ /** `CLAUDE_MEM_LOCAL_MODEL` (or the engine's `local-model` default) when `provider` is
292
+ * `local`; null when `provider` is `claude` (no local model is in play). */
293
+ model: string | null;
294
+ }
295
+ /**
296
+ * Effective observer provider: `CLAUDE_MEM_PROVIDER` from settings.json (default `claude`; any
297
+ * value other than the literal `local` is treated as `claude`, mirroring the engine's own
298
+ * `SettingsDefaultsManager` fallback), and when local, the configured `CLAUDE_MEM_LOCAL_MODEL`
299
+ * or the engine's `local-model` default.
300
+ *
301
+ * Args:
302
+ * settingsPath: Path of the data dir's settings.json (absent or malformed = claude).
303
+ *
304
+ * Returns:
305
+ * The effective provider and, for local, its model id.
306
+ */
307
+ export declare function effectiveObserverProvider(settingsPath: string): ObserverProvider;
308
+ /**
309
+ * The FreeHarness-recommended observer settings: a haiku base and simple tier (the daily-spend
310
+ * gate), a sonnet summary tier (session summaries read by every future session, worth the
311
+ * larger model), the upstream skip list extended with the tools whose decisions matter for
312
+ * recall (Read, Glob, Grep and the multi-agent tools), and a concurrency cap of 2. Shared by
313
+ * `memory status`'s WARN check and the `memory settings` command.
314
+ */
315
+ export declare const RECOMMENDED_OBSERVER_SETTINGS: Record<string, string>;
316
+ /**
317
+ * `memory settings --no-local`: the two keys that return the observer to the Claude provider —
318
+ * `CLAUDE_MEM_PROVIDER` and `CLAUDE_MEM_SKIP_TOOLS` restored to the recommended default, so the
319
+ * skip list follows the provider back.
320
+ */
321
+ export declare const NO_LOCAL_OBSERVER_SETTINGS: Record<string, string>;
322
+ /** `memory settings --local <base-url> <model>` / `--no-local` request, on top of the plain command. */
323
+ export interface ObserverSettingsOptions {
324
+ local?: {
325
+ baseUrl: string;
326
+ model: string;
327
+ };
328
+ noLocal?: boolean;
329
+ }
330
+ /** One recommended key's current-vs-recommended state, for the `memory settings` preview. */
331
+ export interface ObserverSettingsRow {
332
+ key: string;
333
+ current: string | undefined;
334
+ recommended: string;
335
+ changed: boolean;
336
+ }
337
+ export interface ObserverSettingsPreview {
338
+ rows: ObserverSettingsRow[];
339
+ /** Set when settingsPath exists but is not valid JSON; rows then compare against "absent". */
340
+ parseError?: string;
341
+ }
342
+ /**
343
+ * Previews `memory settings`: the selected key set against the current file, same or
344
+ * would-change, writing nothing. Plain (no options): the five recommended keys. `--local`:
345
+ * `CLAUDE_MEM_PROVIDER` plus the four `CLAUDE_MEM_LOCAL_*` keys plus the narrowed
346
+ * `CLAUDE_MEM_SKIP_TOOLS`. `--no-local`: `CLAUDE_MEM_PROVIDER` and `CLAUDE_MEM_SKIP_TOOLS`
347
+ * restored to the recommended default.
348
+ *
349
+ * Args:
350
+ * settingsPath: Path of the data dir's settings.json.
351
+ * opts: The command's `--local`/`--no-local` request, if any.
352
+ *
353
+ * Returns:
354
+ * One row per key in the selected set, and the parse error when the file is present but
355
+ * invalid.
356
+ *
357
+ * Raises:
358
+ * Error: `opts` fails validation (see `resolveObserverKeySet`); nothing is read or written.
359
+ */
360
+ export declare function previewObserverSettings(settingsPath: string, opts?: ObserverSettingsOptions): ObserverSettingsPreview;
361
+ export interface ApplyObserverSettingsResult {
362
+ /** True when settings.json did not exist and was created with exactly the five keys. */
363
+ created: boolean;
364
+ /** The timestamped backup path; absent when the file was created rather than updated. */
365
+ backupPath?: string;
366
+ }
367
+ /**
368
+ * Applies `memory settings`: adds or updates the selected key set (see `previewObserverSettings`
369
+ * for which set), preserving every other key, after backing up an existing file first. Refuses
370
+ * (throws) without writing anything when `opts` fails validation or the existing file is not
371
+ * valid JSON.
372
+ *
373
+ * Args:
374
+ * settingsPath: Path of the data dir's settings.json.
375
+ * opts: The command's `--local`/`--no-local` request, if any.
376
+ *
377
+ * Returns:
378
+ * Whether the file was created, and the backup path when one was made.
379
+ *
380
+ * Raises:
381
+ * Error: `opts` fails validation, or the existing file is not valid JSON (its message names
382
+ * the parse error).
383
+ */
384
+ export declare function applyObserverSettings(settingsPath: string, opts?: ObserverSettingsOptions): ApplyObserverSettingsResult;
385
+ /** `probeMemoryProvider`'s outcome: reachable and serving the configured model, or not. */
386
+ export interface MemoryProviderProbe {
387
+ ok: boolean;
388
+ /**
389
+ * One-line reason when `ok` is false: a connection error, `health <status>`,
390
+ * `model <id> not listed`, or `timeout after <n> ms` when the shared deadline elapses.
391
+ */
392
+ reason?: string;
393
+ }
394
+ /**
395
+ * Probes a local memory-provider server: `<root>/health` (200 expected), then `<base>/models`
396
+ * (the configured model id expected in `data[].id`), both requests bound by one
397
+ * `AbortController` armed once for `timeoutMs` — so a slow-but-live server cannot push the
398
+ * total probe time past the configured deadline by stacking a full timeout on each request.
399
+ * Down is a one-line reason, never a throw.
400
+ *
401
+ * Args:
402
+ * baseUrl: `CLAUDE_MEM_LOCAL_BASE_URL`.
403
+ * model: `CLAUDE_MEM_LOCAL_MODEL`.
404
+ * timeoutMs: The whole probe's deadline (both requests together).
405
+ *
406
+ * Returns:
407
+ * ok, or ok:false with a one-line reason.
408
+ */
409
+ export declare function probeMemoryProvider(baseUrl: string, model: string, timeoutMs?: number): Promise<MemoryProviderProbe>;
410
+ /**
411
+ * The `memory provider` doctor line: only when the data dir's settings.json sets
412
+ * `CLAUDE_MEM_PROVIDER=local`, a probe of the configured base URL and model, OK or WARN with
413
+ * the reason; absent or `claude` prints nothing.
414
+ *
415
+ * Args:
416
+ * settingsPath: Path of the data dir's settings.json.
417
+ * probe: Injectable probe function.
418
+ *
419
+ * Returns:
420
+ * Zero or one printable line.
421
+ */
422
+ export declare function memoryProviderLines(settingsPath: string, probe?: (baseUrl: string, model: string, timeoutMs?: number) => Promise<MemoryProviderProbe>): Promise<string[]>;
423
+ /** Resolve $CLAUDE_CONFIG_DIR or ~/.claude. */
424
+ export declare function configDir(): string;
425
+ /** Mirror engine shared/paths.ts resolveDataDir (env, then settings.json, then default). */
426
+ export declare function dataDir(): string;
427
+ /**
428
+ * Diagnose which claude-mem is active.
429
+ *
430
+ * Returns:
431
+ * A MemoryDiagnosis with a verdict and printable lines (OK/WARN prefixed).
432
+ */
433
+ export declare function diagnoseMemory(): Promise<MemoryDiagnosis>;
434
+ /**
435
+ * Copy the claude-mem data dir to a timestamped sibling (never moves the original).
436
+ *
437
+ * Returns:
438
+ * The backup directory path.
439
+ */
440
+ export declare function backupMemoryData(): string;
441
+ export interface RestartResult {
442
+ /** How the restart was performed. */
443
+ method: "worker-service restart" | "shutdown-only" | "nothing";
444
+ detail: string;
445
+ }
446
+ /**
447
+ * Restart the claude-mem worker of the registered FreeHarness build.
448
+ *
449
+ * Prefers the plugin's own launcher (`node <install>/scripts/bun-runner.js
450
+ * <install>/scripts/worker-service.cjs restart`, detached) so the new worker is the
451
+ * registered version; without a registered FreeHarness install it only asks a running
452
+ * worker to shut down (the next SessionStart hook respawns it). The observer ledgers are
453
+ * left alone: a restart does not clear an armed quota cooldown (that is by design in the
454
+ * engine; the breaker is persisted so restarts cannot reopen a request storm).
455
+ *
456
+ * Args:
457
+ * dryRun: Report only.
458
+ * diagnosis: A diagnosis already computed by the caller (a fresh one otherwise).
459
+ *
460
+ * Returns:
461
+ * What was (or would be) done.
462
+ */
463
+ export declare function restartWorker(dryRun: boolean, diagnosis?: MemoryDiagnosis): Promise<RestartResult>;
464
+ export interface ActivateResult {
465
+ stoppedWorker: boolean;
466
+ disabled: string[];
467
+ registered: boolean;
468
+ }
469
+ /**
470
+ * Make the FreeHarness build the only active claude-mem: stop a running worker, move
471
+ * foreign cache versions aside (never deleted), point installed_plugins at ours.
472
+ *
473
+ * Args:
474
+ * dryRun: Report only.
475
+ *
476
+ * Returns:
477
+ * What was (or would be) done.
478
+ */
479
+ export declare function activateOurs(dryRun: boolean): Promise<ActivateResult>;
480
+ export {};