@sushanglewis/lincoln 1.5.0 → 1.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (305) hide show
  1. package/dist/main.d.ts +3 -0
  2. package/dist/main.js +1286 -916
  3. package/dist/main.js.map +1 -1
  4. package/dist/postinstall.d.ts +3 -0
  5. package/dist/postinstall.js +18 -0
  6. package/dist/postinstall.js.map +1 -0
  7. package/framework/.claude/agents/_contract.md +79 -0
  8. package/framework/.claude/agents/architect.md +31 -0
  9. package/framework/.claude/agents/default.md +151 -0
  10. package/framework/.claude/agents/designer.md +33 -0
  11. package/framework/.claude/agents/engineer.md +42 -0
  12. package/framework/.claude/agents/external/NOTICES.md +12 -0
  13. package/framework/.claude/agents/external/everything-claude-code.manifest.yaml +23 -0
  14. package/framework/.claude/agents/external/oh-my-claudecode.manifest.yaml +26 -0
  15. package/framework/.claude/agents/external/wshobson-agents.manifest.yaml +23 -0
  16. package/framework/.claude/agents/frontend-engineer.md +32 -0
  17. package/framework/.claude/agents/knowledge-curator.md +28 -0
  18. package/framework/.claude/agents/pm.md +38 -0
  19. package/framework/.claude/agents/qa.md +28 -0
  20. package/framework/.claude/agents/release-coordinator.md +25 -0
  21. package/framework/.claude/agents/researcher.md +41 -0
  22. package/framework/.claude/harnesses/claude-code.yaml +15 -0
  23. package/framework/.claude/harnesses/codex.yaml +40 -0
  24. package/framework/.claude/harnesses/command-map.yaml +255 -0
  25. package/framework/.claude/harnesses/opencode.yaml +32 -0
  26. package/framework/.claude/harnesses/scenarios.yaml +45 -0
  27. package/framework/.claude/hooks/on-pr-event.sh +69 -0
  28. package/framework/.claude/hooks/on-session-start.sh +427 -0
  29. package/framework/.claude/hooks/on-stop.sh +104 -0
  30. package/framework/.claude/hooks/post-tool-use.sh +161 -0
  31. package/framework/.claude/hooks/pre-tool-use.sh +246 -0
  32. package/framework/.claude/schemas/agent-definition.schema.json +35 -0
  33. package/framework/.claude/schemas/benchmark-report.schema.json +148 -0
  34. package/framework/.claude/schemas/pm-to-ux-handoff.schema.yaml +128 -0
  35. package/framework/.claude/schemas/stage-definition.schema.json +233 -0
  36. package/framework/.claude/schemas/workflow-stage.schema.json +86 -0
  37. package/framework/.claude/schemas/workflow-template.schema.json +88 -0
  38. package/framework/.claude/settings.json +14 -0
  39. package/framework/.claude/skills/build-product-prototype/SKILL.md +35 -0
  40. package/framework/.claude/skills/build-product-prototype/prompts/main.md +78 -0
  41. package/framework/.claude/skills/clarify-requirements/SKILL.md +32 -0
  42. package/framework/.claude/skills/clarify-requirements/prompts/main.md +81 -0
  43. package/framework/.claude/skills/dependencies.yaml +139 -0
  44. package/framework/.claude/skills/draft-product-design/SKILL.md +40 -0
  45. package/framework/.claude/skills/draft-product-design/prompts/main.md +47 -0
  46. package/framework/.claude/skills/lc-analyze-frameworks/SKILL.md +43 -0
  47. package/framework/.claude/skills/lc-analyze-frameworks/prompts/main.md +95 -0
  48. package/framework/.claude/skills/lc-benchmark/SKILL.md +61 -0
  49. package/framework/.claude/skills/lc-build-codebase-knowledge/SKILL.md +38 -0
  50. package/framework/.claude/skills/lc-build-codebase-knowledge/prompts/build-codebase-knowledge.md +61 -0
  51. package/framework/.claude/skills/lc-collect-intelligence/SKILL.md +43 -0
  52. package/framework/.claude/skills/lc-collect-intelligence/prompts/main.md +72 -0
  53. package/framework/.claude/skills/lc-competitive-analysis/SKILL.md +43 -0
  54. package/framework/.claude/skills/lc-competitive-analysis/prompts/main.md +70 -0
  55. package/framework/.claude/skills/lc-explore-opensource/SKILL.md +36 -0
  56. package/framework/.claude/skills/lc-explore-opensource/prompts/explore-opensource.md +77 -0
  57. package/framework/.claude/skills/lc-first-principles/SKILL.md +43 -0
  58. package/framework/.claude/skills/lc-first-principles/prompts/main.md +73 -0
  59. package/framework/.claude/skills/lc-handoff/SKILL.md +34 -0
  60. package/framework/.claude/skills/lc-init-branch/SKILL.md +52 -0
  61. package/framework/.claude/skills/lc-market-research/SKILL.md +43 -0
  62. package/framework/.claude/skills/lc-market-research/prompts/main.md +79 -0
  63. package/framework/.claude/skills/lc-product-research/SKILL.md +43 -0
  64. package/framework/.claude/skills/lc-product-research/prompts/main.md +80 -0
  65. package/framework/.claude/skills/lc-research-report/SKILL.md +43 -0
  66. package/framework/.claude/skills/lc-research-report/prompts/main.md +90 -0
  67. package/framework/.claude/skills/lc-research-scope/SKILL.md +43 -0
  68. package/framework/.claude/skills/lc-research-scope/prompts/main.md +82 -0
  69. package/framework/.claude/skills/lc-setup/SKILL.md +68 -0
  70. package/framework/.claude/skills/lc-setup/prompts/main.md +88 -0
  71. package/framework/.claude/skills/lc-stage/SKILL.md +45 -0
  72. package/framework/.claude/skills/lc-stakeholder-research/SKILL.md +43 -0
  73. package/framework/.claude/skills/lc-stakeholder-research/prompts/main.md +65 -0
  74. package/framework/.claude/skills/lc-status/SKILL.md +25 -0
  75. package/framework/.claude/skills/lc-storytelling/SKILL.md +43 -0
  76. package/framework/.claude/skills/lc-storytelling/prompts/main.md +77 -0
  77. package/framework/.claude/skills/lc-wf/SKILL.md +54 -0
  78. package/framework/.claude/skills/lc-workflow/SKILL.md +48 -0
  79. package/framework/.claude/skills/lc-workflow/validators/validate.py +755 -0
  80. package/framework/.claude/skills/lc-workflow-router/SKILL.md +41 -0
  81. package/framework/.claude/skills/lc-workflow-router/prompts/intake-prompt.md +91 -0
  82. package/framework/.claude/skills/lc-workflow-router/prompts/router-prompt.md +44 -0
  83. package/framework/.claude/skills/plan-tdd-development/SKILL.md +31 -0
  84. package/framework/.claude/skills/plan-tdd-development/prompts/main.md +44 -0
  85. package/framework/.claude/skills/process-interview/SKILL.md +32 -0
  86. package/framework/.claude/skills/process-interview/prompts/main.md +47 -0
  87. package/framework/.claude/skills/propose-with-openspec/SKILL.md +37 -0
  88. package/framework/.claude/skills/propose-with-openspec/prompts/main.md +53 -0
  89. package/framework/.claude/skills/split-to-github/SKILL.md +32 -0
  90. package/framework/.claude/skills/split-to-github/prompts/main.md +42 -0
  91. package/framework/.claude/skills/sync-to-knowledge/SKILL.md +35 -0
  92. package/framework/.claude/skills/sync-to-knowledge/prompts/main.md +54 -0
  93. package/framework/.claude/skills/workflow-continue/SKILL.md +24 -0
  94. package/framework/.claude/skills/workflow-continue/prompts/main.md +25 -0
  95. package/framework/.claude/stages/build-codebase-knowledge.yaml +42 -0
  96. package/framework/.claude/stages/clarify.yaml +59 -0
  97. package/framework/.claude/stages/explore-opensource.yaml +40 -0
  98. package/framework/.claude/stages/implement.yaml +60 -0
  99. package/framework/.claude/stages/ingest.yaml +40 -0
  100. package/framework/.claude/stages/lc-analyze-frameworks.yaml +37 -0
  101. package/framework/.claude/stages/lc-collect-intelligence.yaml +37 -0
  102. package/framework/.claude/stages/lc-competitive-analysis.yaml +37 -0
  103. package/framework/.claude/stages/lc-first-principles.yaml +37 -0
  104. package/framework/.claude/stages/lc-market-research.yaml +37 -0
  105. package/framework/.claude/stages/lc-product-research.yaml +37 -0
  106. package/framework/.claude/stages/lc-research-report.yaml +38 -0
  107. package/framework/.claude/stages/lc-research-scope.yaml +38 -0
  108. package/framework/.claude/stages/lc-stakeholder-research.yaml +37 -0
  109. package/framework/.claude/stages/lc-storytelling.yaml +37 -0
  110. package/framework/.claude/stages/product-design-docs.yaml +66 -0
  111. package/framework/.claude/stages/product-prototype.yaml +53 -0
  112. package/framework/.claude/stages/propose.yaml +45 -0
  113. package/framework/.claude/stages/split.yaml +41 -0
  114. package/framework/.claude/stages/sync-knowledge.yaml +49 -0
  115. package/framework/.claude/stages/tdd-development-plan.yaml +43 -0
  116. package/framework/.claude/stages/workflow-router.yaml +45 -0
  117. package/framework/.claude/templates/solo-workflow-context.yaml +23 -0
  118. package/framework/.claude/workflows/README.md +93 -0
  119. package/framework/.claude/workflows/bug-fix.yaml +81 -0
  120. package/framework/.claude/workflows/design-spike.yaml +55 -0
  121. package/framework/.claude/workflows/existing-project-iteration.yaml +106 -0
  122. package/framework/.claude/workflows/interview-to-knowledge.yaml +189 -0
  123. package/framework/.claude/workflows/oss-first-design.yaml +100 -0
  124. package/framework/.claude/workflows/pm-research.yaml +115 -0
  125. package/framework/.claude-plugin/hooks.json +6 -0
  126. package/framework/.claude-plugin/marketplace.json +32 -0
  127. package/framework/.claude-plugin/plugin.json +57 -0
  128. package/framework/.version-bump.json +43 -0
  129. package/framework/CLAUDE.md +140 -0
  130. package/framework/CONTRIBUTING.md +219 -0
  131. package/framework/LICENSE +21 -0
  132. package/framework/README.en.md +139 -0
  133. package/framework/README.md +139 -0
  134. package/framework/RELEASE.md +334 -0
  135. package/framework/SKILL.md +24 -0
  136. package/framework/USAGE.md +356 -0
  137. package/framework/manifest.json +1214 -0
  138. package/framework/requirements.txt +4 -0
  139. package/framework/scripts/__init__.py +0 -0
  140. package/framework/scripts/build_codebase_knowledge.py +76 -0
  141. package/framework/scripts/bump_version.py +181 -0
  142. package/framework/scripts/check-dependency-drift.py +69 -0
  143. package/framework/scripts/check-harness-drift.sh +57 -0
  144. package/framework/scripts/check-main-merge-hygiene.py +128 -0
  145. package/framework/scripts/check-skill-dependencies.sh +124 -0
  146. package/framework/scripts/init-lincoln-branch.sh +300 -0
  147. package/framework/scripts/init-project.sh +184 -0
  148. package/framework/scripts/lc-benchmark-cli.py +66 -0
  149. package/framework/scripts/lincoln-audit.py +288 -0
  150. package/framework/scripts/lincoln-setup.py +651 -0
  151. package/framework/scripts/lincoln-status.py +448 -0
  152. package/framework/scripts/lincoln_benchmark.py +224 -0
  153. package/framework/scripts/lincoln_benchmark_eval.py +104 -0
  154. package/framework/scripts/lincoln_benchmark_metrics.py +818 -0
  155. package/framework/scripts/lincoln_benchmark_report.py +141 -0
  156. package/framework/scripts/lincoln_command_map.py +289 -0
  157. package/framework/scripts/lincoln_dependency_manager.py +335 -0
  158. package/framework/scripts/lincoln_documents.py +175 -0
  159. package/framework/scripts/lincoln_harness_adapter.py +319 -0
  160. package/framework/scripts/lincoln_index.py +255 -0
  161. package/framework/scripts/lincoln_paths.py +198 -0
  162. package/framework/scripts/lincoln_prd.py +227 -0
  163. package/framework/scripts/lincoln_role.py +46 -0
  164. package/framework/scripts/lincoln_scenario.py +59 -0
  165. package/framework/scripts/lincoln_session_start_metrics.py +71 -0
  166. package/framework/scripts/lincoln_skill_prompt.py +48 -0
  167. package/framework/scripts/lincoln_trace.py +335 -0
  168. package/framework/scripts/lincoln_workflow.py +199 -0
  169. package/framework/scripts/list-active-lincoln-branches.sh +87 -0
  170. package/framework/scripts/package-lincoln-plugin.py +340 -0
  171. package/framework/scripts/run-infrastructure-tests.py +84 -0
  172. package/framework/scripts/stage_loader.py +1071 -0
  173. package/framework/scripts/static-check.sh +356 -0
  174. package/framework/scripts/sync-external-agents.sh +210 -0
  175. package/framework/scripts/sync-framework-package.mjs +218 -0
  176. package/framework/scripts/task_tool_guard.py +213 -0
  177. package/framework/scripts/track-artifacts.py +140 -0
  178. package/framework/scripts/validate_stage.py +350 -0
  179. package/{README.md → framework/tools/lincoln/README.md} +4 -4
  180. package/framework/tools/lincoln/package-lock.json +3349 -0
  181. package/framework/tools/lincoln/package.json +48 -0
  182. package/framework/tools/lincoln/src/cli.tsx +60 -0
  183. package/framework/tools/lincoln/src/components/AudioMeter.tsx +34 -0
  184. package/framework/tools/lincoln/src/components/CancelledScreen.tsx +11 -0
  185. package/framework/tools/lincoln/src/components/DevicesMenu.tsx +79 -0
  186. package/framework/tools/lincoln/src/components/HintBar.tsx +25 -0
  187. package/framework/tools/lincoln/src/components/LogView.tsx +36 -0
  188. package/framework/tools/lincoln/src/components/ModelMenu.tsx +122 -0
  189. package/framework/tools/lincoln/src/components/ReadyScreen.tsx +54 -0
  190. package/framework/tools/lincoln/src/components/RecordingApp.tsx +211 -0
  191. package/framework/tools/lincoln/src/components/RecordingScreen.tsx +41 -0
  192. package/framework/tools/lincoln/src/components/SelectMenu.tsx +53 -0
  193. package/framework/tools/lincoln/src/components/StatusPanel.tsx +52 -0
  194. package/framework/tools/lincoln/src/components/StopConfirmation.tsx +32 -0
  195. package/framework/tools/lincoln/src/config/args.ts +35 -0
  196. package/framework/tools/lincoln/src/config/loadConfig.ts +81 -0
  197. package/framework/tools/lincoln/src/config/resolveConfig.ts +85 -0
  198. package/framework/tools/lincoln/src/devices/listDevices.ts +11 -0
  199. package/framework/tools/lincoln/src/devices/parseDevices.ts +25 -0
  200. package/framework/tools/lincoln/src/hooks/useKeyHandler.ts +63 -0
  201. package/framework/tools/lincoln/src/main.tsx +4 -0
  202. package/framework/tools/lincoln/src/models/models.ts +34 -0
  203. package/framework/tools/lincoln/src/models/runWarmup.ts +46 -0
  204. package/framework/tools/lincoln/src/models/warmupProgress.ts +30 -0
  205. package/framework/tools/lincoln/src/recording/spawnRecorder.ts +127 -0
  206. package/framework/tools/lincoln/src/recording/useRecorder.ts +146 -0
  207. package/framework/tools/lincoln/src/utils/amplitudeToMeter.ts +4 -0
  208. package/framework/tools/lincoln/src/utils/formatDuration.ts +6 -0
  209. package/framework/tools/lincoln/src/utils/sessionId.ts +25 -0
  210. package/framework/tools/lincoln/tests/cli.test.tsx +52 -0
  211. package/framework/tools/lincoln/tests/components/AudioMeter.test.tsx +31 -0
  212. package/framework/tools/lincoln/tests/components/CancelledScreen.test.tsx +12 -0
  213. package/framework/tools/lincoln/tests/components/ReadyScreen.test.tsx +68 -0
  214. package/framework/tools/lincoln/tests/components/RecordingApp.menus.test.tsx +158 -0
  215. package/framework/tools/lincoln/tests/components/RecordingApp.test.tsx +248 -0
  216. package/framework/tools/lincoln/tests/components/RecordingScreen.test.tsx +37 -0
  217. package/framework/tools/lincoln/tests/components/SelectMenu.test.tsx +59 -0
  218. package/framework/tools/lincoln/tests/components/StopConfirmation.test.tsx +38 -0
  219. package/framework/tools/lincoln/tests/config/args.test.ts +49 -0
  220. package/framework/tools/lincoln/tests/config/loadConfig.test.ts +59 -0
  221. package/framework/tools/lincoln/tests/config/resolveConfig.test.ts +72 -0
  222. package/framework/tools/lincoln/tests/devices/parseDevices.test.ts +21 -0
  223. package/framework/tools/lincoln/tests/hooks/useKeyHandler.enabled.test.tsx +44 -0
  224. package/framework/tools/lincoln/tests/hooks/useKeyHandler.test.tsx +130 -0
  225. package/framework/tools/lincoln/tests/models/models.test.ts +27 -0
  226. package/framework/tools/lincoln/tests/models/warmupProgress.test.ts +25 -0
  227. package/framework/tools/lincoln/tests/recording/spawnRecorder.test.ts +85 -0
  228. package/framework/tools/lincoln/tests/recording/useRecorder.test.tsx +172 -0
  229. package/framework/tools/lincoln/tests/utils/amplitudeToMeter.test.ts +22 -0
  230. package/framework/tools/lincoln/tests/utils/formatDuration.test.ts +11 -0
  231. package/framework/tools/lincoln/tests/utils/sessionId.test.ts +30 -0
  232. package/framework/tools/lincoln/tsconfig.json +22 -0
  233. package/framework/tools/lincoln/tsconfig.tests.json +10 -0
  234. package/framework/tools/lincoln/tsup.config.ts +17 -0
  235. package/framework/tools/lincoln/vitest.config.ts +20 -0
  236. package/framework/tools/lincoln-installer/package-lock.json +3611 -0
  237. package/framework/tools/lincoln-installer/package.json +53 -0
  238. package/framework/tools/lincoln-installer/src/cli.tsx +63 -0
  239. package/framework/tools/lincoln-installer/src/components/HarnessSelectScreen.tsx +43 -0
  240. package/framework/tools/lincoln-installer/src/components/InstallerApp.tsx +98 -0
  241. package/framework/tools/lincoln-installer/src/components/OptionsScreen.tsx +56 -0
  242. package/framework/tools/lincoln-installer/src/components/ProgressScreen.tsx +25 -0
  243. package/framework/tools/lincoln-installer/src/components/ResultScreen.tsx +40 -0
  244. package/framework/tools/lincoln-installer/src/components/SelectMenu.tsx +73 -0
  245. package/framework/tools/lincoln-installer/src/components/SummaryScreen.tsx +49 -0
  246. package/framework/tools/lincoln-installer/src/components/UpdateApp.tsx +135 -0
  247. package/framework/tools/lincoln-installer/src/components/WelcomeScreen.tsx +22 -0
  248. package/framework/tools/lincoln-installer/src/config/args.ts +76 -0
  249. package/framework/tools/lincoln-installer/src/config/resolveConfig.ts +33 -0
  250. package/framework/tools/lincoln-installer/src/config/updateArgs.ts +67 -0
  251. package/framework/tools/lincoln-installer/src/hooks/useSetup.ts +149 -0
  252. package/framework/tools/lincoln-installer/src/main.tsx +11 -0
  253. package/framework/tools/lincoln-installer/src/types.ts +19 -0
  254. package/framework/tools/lincoln-installer/src/update-main.tsx +11 -0
  255. package/framework/tools/lincoln-installer/src/update.tsx +90 -0
  256. package/framework/tools/lincoln-installer/src/utils/detectHarness.ts +51 -0
  257. package/framework/tools/lincoln-installer/src/utils/runSetup.ts +62 -0
  258. package/framework/tools/lincoln-installer/src/utils/updateRelease.ts +454 -0
  259. package/framework/tools/lincoln-installer/tests/components/InstallerApp.test.tsx +88 -0
  260. package/framework/tools/lincoln-installer/tests/components/SelectMenu.test.tsx +26 -0
  261. package/framework/tools/lincoln-installer/tests/components/UpdateApp.test.tsx +170 -0
  262. package/framework/tools/lincoln-installer/tests/components/screens.test.tsx +310 -0
  263. package/framework/tools/lincoln-installer/tests/config/args.test.ts +66 -0
  264. package/framework/tools/lincoln-installer/tests/config/resolveConfig.test.ts +75 -0
  265. package/framework/tools/lincoln-installer/tests/config/updateArgs.test.ts +52 -0
  266. package/framework/tools/lincoln-installer/tests/hooks/useSetup.test.tsx +213 -0
  267. package/framework/tools/lincoln-installer/tests/update.test.tsx +108 -0
  268. package/framework/tools/lincoln-installer/tests/utils/detectHarness.test.ts +40 -0
  269. package/framework/tools/lincoln-installer/tests/utils/runSetup.test.ts +45 -0
  270. package/framework/tools/lincoln-installer/tests/utils/updateRelease.test.ts +559 -0
  271. package/framework/tools/lincoln-installer/tsconfig.json +22 -0
  272. package/framework/tools/lincoln-installer/tsconfig.tests.json +8 -0
  273. package/framework/tools/lincoln-installer/tsup.config.ts +17 -0
  274. package/framework/tools/lincoln-installer/vitest.config.ts +20 -0
  275. package/framework/tools/lincoln-record/Cargo.lock +1896 -0
  276. package/framework/tools/lincoln-record/Cargo.toml +24 -0
  277. package/framework/tools/lincoln-record/diarize/diarize.py +117 -0
  278. package/framework/tools/lincoln-record/diarize/merge.py +55 -0
  279. package/framework/tools/lincoln-record/src/audio/capture/microphone.rs +194 -0
  280. package/framework/tools/lincoln-record/src/audio/capture/mod.rs +1 -0
  281. package/framework/tools/lincoln-record/src/audio/devices.rs +20 -0
  282. package/framework/tools/lincoln-record/src/audio/mod.rs +5 -0
  283. package/framework/tools/lincoln-record/src/audio/resampler.rs +44 -0
  284. package/framework/tools/lincoln-record/src/audio/saver.rs +87 -0
  285. package/framework/tools/lincoln-record/src/audio/source.rs +104 -0
  286. package/framework/tools/lincoln-record/src/cli.rs +96 -0
  287. package/framework/tools/lincoln-record/src/config.rs +135 -0
  288. package/framework/tools/lincoln-record/src/lib.rs +6 -0
  289. package/framework/tools/lincoln-record/src/main.rs +242 -0
  290. package/framework/tools/lincoln-record/src/model/mod.rs +248 -0
  291. package/framework/tools/lincoln-record/src/output/metadata.rs +30 -0
  292. package/framework/tools/lincoln-record/src/output/mod.rs +2 -0
  293. package/framework/tools/lincoln-record/src/output/transcript.rs +42 -0
  294. package/framework/tools/lincoln-record/src/transcription/diarization.rs +64 -0
  295. package/framework/tools/lincoln-record/src/transcription/mod.rs +3 -0
  296. package/framework/tools/lincoln-record/src/transcription/provider.rs +43 -0
  297. package/framework/tools/lincoln-record/src/transcription/whisper.rs +176 -0
  298. package/framework/tools/lincoln-record/tests/cli_args.rs +103 -0
  299. package/framework/tools/lincoln-record/tests/config_test.rs +70 -0
  300. package/framework/tools/lincoln-record/tests/devices_test.rs +23 -0
  301. package/framework/tools/lincoln-record/tests/diarization_tests.rs +101 -0
  302. package/framework/tools/lincoln-record/tests/integration_tests.rs +44 -0
  303. package/framework/tools/lincoln-record/tests/model_test.rs +68 -0
  304. package/framework/tools/lincoln-record/tests/transcription_tests.rs +73 -0
  305. package/package.json +19 -13
@@ -0,0 +1,246 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ # PreToolUse hook for Lincoln workflow.
5
+ # Blocks side-effect tools when the current stage has not passed entry checks
6
+ # or is paused/waiting_for_human/validation_failed.
7
+ #
8
+ # Usage (manual):
9
+ # .claude/hooks/pre-tool-use.sh "Write" '{"file_path": "foo.md"}'
10
+ #
11
+ # Expected arguments:
12
+ # $1: tool name (e.g. Bash, Write, Edit, mcp__pencil__batch_design)
13
+ # $2: JSON-encoded tool arguments
14
+
15
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
16
+ LOCAL_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
17
+ PROJECT_ROOT="$(pwd)"
18
+
19
+ FRAMEWORK_ROOT="${CLAUDE_PLUGIN_ROOT:-${LINCOLN_HOME:-}}"
20
+ if [[ -z "$FRAMEWORK_ROOT" ]]; then
21
+ # If this hook file lives inside a vendored project framework, prefer that.
22
+ if [[ "$SCRIPT_DIR" == "$LOCAL_ROOT/.claude/hooks"* && -d "$LOCAL_ROOT/.claude/stages" ]]; then
23
+ FRAMEWORK_ROOT="$LOCAL_ROOT"
24
+ elif [[ -d "$HOME/.lincoln/current" ]]; then
25
+ FRAMEWORK_ROOT="$HOME/.lincoln/current"
26
+ else
27
+ FRAMEWORK_ROOT="$LOCAL_ROOT"
28
+ fi
29
+ fi
30
+
31
+ if [[ "$FRAMEWORK_ROOT" != "$LOCAL_ROOT" ]]; then
32
+ MARKER_FOUND="false"
33
+ SEARCH_DIR="$PROJECT_ROOT"
34
+ while [[ "$SEARCH_DIR" != "/" ]]; do
35
+ if [[ -f "$SEARCH_DIR/.lincoln.yaml" || -f "$SEARCH_DIR/.claude/workflow-state.yaml" ]]; then
36
+ MARKER_FOUND="true"
37
+ break
38
+ fi
39
+ SEARCH_DIR="$(dirname "$SEARCH_DIR")"
40
+ done
41
+ if [[ "$MARKER_FOUND" != "true" && -z "${LINCOLN_ALWAYS_ON:-}" ]]; then
42
+ echo "Lincoln inactive: no .lincoln.yaml in $PROJECT_ROOT"
43
+ exit 0
44
+ fi
45
+ fi
46
+
47
+ ROOT="$PROJECT_ROOT"
48
+
49
+ if [ -x "$FRAMEWORK_ROOT/.venv/bin/python3" ]; then
50
+ PYTHON="$FRAMEWORK_ROOT/.venv/bin/python3"
51
+ elif [ -x "$FRAMEWORK_ROOT/venv/bin/python3" ]; then
52
+ PYTHON="$FRAMEWORK_ROOT/venv/bin/python3"
53
+ elif [ -x "$HOME/.lincoln/venv/bin/python3" ]; then
54
+ PYTHON="$HOME/.lincoln/venv/bin/python3"
55
+ else
56
+ PYTHON="python3"
57
+ fi
58
+
59
+ TOOL_NAME="${1:-}"
60
+ TOOL_ARGS="${2:-}"
61
+ STATE_FILE=$("$PYTHON" - "$FRAMEWORK_ROOT" "$ROOT" "${LINCOLN_STATE_FILE:-}" <<'PY'
62
+ import sys
63
+ from pathlib import Path
64
+ framework_root = Path(sys.argv[1])
65
+ project_root = Path(sys.argv[2])
66
+ provided = sys.argv[3]
67
+ sys.path.insert(0, str(framework_root))
68
+ from scripts.lincoln_paths import resolve_state_path
69
+ path = Path(provided) if provided else None
70
+ print(resolve_state_path(path, project_root))
71
+ PY
72
+ )
73
+
74
+ # If state file does not exist, allow everything (not a Lincoln project or not initialized)
75
+ if [[ ! -f "$STATE_FILE" ]]; then
76
+ exit 0
77
+ fi
78
+
79
+ # Read current stage and status using Python for reliable YAML parsing
80
+ read_state() {
81
+ "$PYTHON" - "$STATE_FILE" <<'PY'
82
+ import sys
83
+ import yaml
84
+ path = sys.argv[1]
85
+ state = yaml.safe_load(open(path, encoding="utf-8"))
86
+ current = state.get("current_run", {}).get("current_stage") or "not_started"
87
+ # New schema: derive status from the latest node for the current stage; legacy schema: from stages map.
88
+ nodes = state.get("nodes", [])
89
+ matching = [n for n in nodes if n.get("stage_id") == current]
90
+ if matching:
91
+ stage_state = matching[-1]
92
+ elif "stages" in state and current in state["stages"]:
93
+ stage_state = state["stages"][current]
94
+ else:
95
+ stage_state = {}
96
+ status = stage_state.get("status") or state.get("current_run", {}).get("status") or "not_started"
97
+ print(current)
98
+ print(status)
99
+ PY
100
+ }
101
+
102
+ STATE_OUTPUT=$(read_state)
103
+ CURRENT_STAGE=$(echo "$STATE_OUTPUT" | sed -n '1p')
104
+ STAGE_STATUS=$(echo "$STATE_OUTPUT" | sed -n '2p')
105
+ PROCESS_SLUG=$("$PYTHON" - "$FRAMEWORK_ROOT" "$ROOT" "$STATE_FILE" <<'PY'
106
+ import sys, yaml
107
+ from pathlib import Path
108
+ framework_root = Path(sys.argv[1])
109
+ project_root = Path(sys.argv[2])
110
+ state_file = Path(sys.argv[3])
111
+ sys.path.insert(0, str(framework_root))
112
+ from scripts.lincoln_paths import get_process_slug
113
+ state = yaml.safe_load(open(state_file, encoding="utf-8"))
114
+ print(get_process_slug(state, state_file))
115
+ PY
116
+ )
117
+
118
+ TARGET_PATH=$("$PYTHON" - "$TOOL_ARGS" <<'PY'
119
+ import json, sys
120
+ try:
121
+ data = json.loads(sys.argv[1] or "{}")
122
+ except Exception:
123
+ data = {}
124
+ print(data.get("file_path") or data.get("path") or "")
125
+ PY
126
+ )
127
+
128
+ # Task-tool guard: prevent TaskCreate/TaskUpdate from being used as
129
+ # placeholders for user messages in dialogue stages, and cap consecutive
130
+ # task-tool calls everywhere else. This is invoked for every tool so it can
131
+ # reset the burst counter on non-task actions.
132
+ "$PYTHON" "$FRAMEWORK_ROOT/scripts/task_tool_guard.py" \
133
+ --state-file "$STATE_FILE" \
134
+ --tool-name "$TOOL_NAME" \
135
+ --tool-args "$TOOL_ARGS"
136
+
137
+ # Define side-effect tools
138
+ SIDE_EFFECT_TOOLS=(
139
+ "Bash"
140
+ "Edit"
141
+ "Write"
142
+ "NotebookEdit"
143
+ "mcp__pencil__batch_design"
144
+ "mcp__pencil__export_nodes"
145
+ "mcp__pencil__export_html"
146
+ "mcp__plugin_ecc_github__create_issue"
147
+ "mcp__plugin_ecc_github__create_pull_request"
148
+ "mcp__plugin_ecc_github__merge_pull_request"
149
+ )
150
+
151
+ is_side_effect() {
152
+ local tool="$1"
153
+ for t in "${SIDE_EFFECT_TOOLS[@]}"; do
154
+ if [[ "$tool" == "$t" ]]; then
155
+ return 0
156
+ fi
157
+ done
158
+ return 1
159
+ }
160
+
161
+ is_plain_file_tool() {
162
+ case "$1" in
163
+ Read|Write|Edit|NotebookEdit)
164
+ return 0
165
+ ;;
166
+ esac
167
+ return 1
168
+ }
169
+
170
+ if [[ -n "$TARGET_PATH" ]]; then
171
+ NORMALIZED_TARGET="${TARGET_PATH#$ROOT/}"
172
+
173
+ if [[ "$NORMALIZED_TARGET" == *.pen ]] && is_plain_file_tool "$TOOL_NAME"; then
174
+ echo "BLOCKED: .pen files must be handled through Pencil tools, not $TOOL_NAME." >&2
175
+ exit 1
176
+ fi
177
+
178
+ if [[ "$NORMALIZED_TARGET" == "$PROCESS_SLUG/prd-v"*.md ]] && is_side_effect "$TOOL_NAME"; then
179
+ echo "BLOCKED: PRD snapshots are immutable. Create them with 'python scripts/lincoln_prd.py freeze'." >&2
180
+ exit 1
181
+ fi
182
+
183
+ if [[ "$NORMALIZED_TARGET" == "$PROCESS_SLUG/workflow-stage.yaml" ]] && is_side_effect "$TOOL_NAME"; then
184
+ echo "BLOCKED: workflow state must be updated through stage_loader, not $TOOL_NAME." >&2
185
+ exit 1
186
+ fi
187
+
188
+ if [[ "$NORMALIZED_TARGET" == "$PROCESS_SLUG/recordings/"* ]] && is_side_effect "$TOOL_NAME"; then
189
+ echo "BLOCKED: recordings are read-only process inputs." >&2
190
+ exit 1
191
+ fi
192
+
193
+ if is_side_effect "$TOOL_NAME"; then
194
+ if [[ -n "$PROCESS_SLUG" ]]; then
195
+ case "$NORMALIZED_TARGET" in
196
+ recordings/*|*/recordings/*|interviews/*|*/interviews/*|requirements/*|*/requirements/*|designs/*|*/designs/*|openspec/changes/*|*/openspec/changes/*|docs/research/*|*/docs/research/*)
197
+ if [[ "$NORMALIZED_TARGET" != "$PROCESS_SLUG/"* ]]; then
198
+ echo "BLOCKED: process artifacts must be written under '$PROCESS_SLUG/'." >&2
199
+ exit 1
200
+ fi
201
+ ;;
202
+ esac
203
+ else
204
+ case "$NORMALIZED_TARGET" in
205
+ recordings/*|*/recordings/*|interviews/*|*/interviews/*|requirements/*|*/requirements/*|designs/*|*/designs/*|openspec/changes/*|*/openspec/changes/*|docs/research/*|*/docs/research/*)
206
+ echo "BLOCKED: process artifacts must be written under an initialized <process_slug>/." >&2
207
+ exit 1
208
+ ;;
209
+ esac
210
+ fi
211
+ fi
212
+ fi
213
+
214
+ # Block side-effect tools when entry checks have not passed
215
+ if [[ "$STAGE_STATUS" == "not_started" || "$STAGE_STATUS" == "entry_validating" ]]; then
216
+ if is_side_effect "$TOOL_NAME"; then
217
+ echo "BLOCKED: Entry checks for stage '$CURRENT_STAGE' have not passed yet." >&2
218
+ echo "Run: python scripts/stage_loader.py --stage $CURRENT_STAGE --action validate-entry" >&2
219
+ exit 1
220
+ fi
221
+ fi
222
+
223
+ # When paused/waiting_for_human/validation_failed, only allow read-only tools
224
+ if [[ "$STAGE_STATUS" == "paused" || "$STAGE_STATUS" == "waiting_for_human" || "$STAGE_STATUS" == "validation_failed" ]]; then
225
+ if [[ "$TOOL_NAME" != "Read" && "$TOOL_NAME" != "Grep" && "$TOOL_NAME" != "Glob" ]]; then
226
+ echo "BLOCKED: Stage '$CURRENT_STAGE' is $STAGE_STATUS. Only Read/Grep/Glob allowed." >&2
227
+ echo "To resume: run the stage's skill command or call workflow-continue." >&2
228
+ exit 1
229
+ fi
230
+ fi
231
+
232
+ # Exit gate check: block side-effect tools that would advance to the next stage
233
+ # if the current stage's exit gate has not been approved.
234
+ if is_side_effect "$TOOL_NAME"; then
235
+ GATE_STATUS=$("$PYTHON" "$FRAMEWORK_ROOT/scripts/stage_loader.py" \
236
+ --stage "$CURRENT_STAGE" \
237
+ --action validate-exit \
238
+ 2>/dev/null | grep -c "^PASS:" || echo "0")
239
+ # For now, only warn rather than block to avoid breaking legitimate edits.
240
+ if [[ "$GATE_STATUS" == "0" && "$TOOL_NAME" != "Read" ]]; then
241
+ echo "[Lincoln] Warning: exit gate for '$CURRENT_STAGE' is not yet approved." >&2
242
+ echo "[Lincoln] Run 'python scripts/stage_loader.py --stage $CURRENT_STAGE --action validate-exit' to check." >&2
243
+ fi
244
+ fi
245
+
246
+ exit 0
@@ -0,0 +1,35 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$id": "https://lincoln-framework.dev/schemas/agent-definition.schema.json",
4
+ "title": "Lincoln Agent Definition Schema",
5
+ "description": "Validates agent markdown files under .claude/agents/.",
6
+ "type": "object",
7
+ "required": ["name", "description"],
8
+ "properties": {
9
+ "name": {
10
+ "type": "string",
11
+ "description": "Unique agent identifier"
12
+ },
13
+ "description": {
14
+ "type": "string",
15
+ "description": "Short description of the agent's role"
16
+ },
17
+ "extends": {
18
+ "type": "array",
19
+ "items": { "type": "string" },
20
+ "description": "List of agent files this agent extends"
21
+ },
22
+ "model": {
23
+ "type": "string",
24
+ "enum": ["haiku", "sonnet", "opus"]
25
+ },
26
+ "tools": {
27
+ "type": "array",
28
+ "items": { "type": "string" }
29
+ },
30
+ "disallowed_tools": {
31
+ "type": "array",
32
+ "items": { "type": "string" }
33
+ }
34
+ }
35
+ }
@@ -0,0 +1,148 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$id": "https://lincoln-framework.dev/schemas/benchmark-report.schema.json",
4
+ "title": "Lincoln Benchmark Report",
5
+ "description": "Schema for a Lincoln benchmark report generated from session trace and workflow state.",
6
+ "type": "object",
7
+ "required": [
8
+ "report_id",
9
+ "schema_version",
10
+ "scenario",
11
+ "trigger",
12
+ "generated_at",
13
+ "metadata",
14
+ "metrics",
15
+ "confidence",
16
+ "evaluation"
17
+ ],
18
+ "properties": {
19
+ "report_id": {
20
+ "type": "string"
21
+ },
22
+ "schema_version": {
23
+ "type": "string",
24
+ "pattern": "^\\d+\\.\\d+\\.\\d+$"
25
+ },
26
+ "scenario": {
27
+ "type": "string",
28
+ "enum": ["S1", "S2", "S3", "S4", "S5"]
29
+ },
30
+ "trigger": {
31
+ "type": "string",
32
+ "enum": ["handoff", "pr_created", "pr_merged", "session_stop", "manual"]
33
+ },
34
+ "generated_at": {
35
+ "type": "string",
36
+ "format": "date-time"
37
+ },
38
+ "metadata": {
39
+ "type": "object",
40
+ "required": ["process_slug", "run_id", "branch", "issue_number", "current_stage", "workflow_template"],
41
+ "properties": {
42
+ "process_slug": { "type": "string" },
43
+ "run_id": { "type": "string" },
44
+ "branch": { "type": "string" },
45
+ "issue_number": { "type": "string" },
46
+ "linear_id": { "type": "string" },
47
+ "current_stage": { "type": "string" },
48
+ "trace_files": {
49
+ "type": "array",
50
+ "items": { "type": "string" }
51
+ },
52
+ "workflow_template": { "type": "string" }
53
+ }
54
+ },
55
+ "metrics": {
56
+ "type": "object",
57
+ "required": ["session", "workflow", "collaboration", "quality", "outcome"],
58
+ "properties": {
59
+ "session": {
60
+ "type": "object",
61
+ "properties": {
62
+ "session_duration_seconds": { "type": "integer" },
63
+ "trace_line_count": { "type": "integer" },
64
+ "total_tool_calls": { "type": "integer" },
65
+ "tool_calls_by_category": { "type": "object" },
66
+ "unique_skills": { "type": "array", "items": { "type": "string" } },
67
+ "unique_files_touched": { "type": "integer" },
68
+ "test_runs": { "type": "integer" },
69
+ "error_count": { "type": "integer" },
70
+ "retry_count": { "type": "integer" }
71
+ }
72
+ },
73
+ "workflow": {
74
+ "type": "object",
75
+ "properties": {
76
+ "stage_transition_count": { "type": "integer" },
77
+ "stage_durations": { "type": "object" },
78
+ "stage_completion_rate": { "type": "number" },
79
+ "stage_rework_count": { "type": "integer" },
80
+ "artifact_completion_rate": { "type": "number" },
81
+ "validation_failure_count": { "type": "integer" },
82
+ "workflow_adherence_score": { "type": "number" },
83
+ "human_gate_count": { "type": "integer" },
84
+ "human_gate_wait_seconds": { "type": "integer" },
85
+ "human_gate_pass_rate": { "type": "number" },
86
+ "build_codebase_knowledge_duration_seconds": { "type": "integer" }
87
+ }
88
+ },
89
+ "collaboration": {
90
+ "type": "object",
91
+ "properties": {
92
+ "handoff_count": { "type": "integer" },
93
+ "agent_switches": { "type": "integer" },
94
+ "pm_turns": { "type": "integer" },
95
+ "time_to_first_handoff": { "type": "integer" }
96
+ }
97
+ },
98
+ "quality": {
99
+ "type": "object",
100
+ "properties": {
101
+ "requirements_clarity_score": { "type": "integer" },
102
+ "design_doc_completeness": { "type": "number" },
103
+ "tdd_plan_red_green_refactor": { "type": "object" },
104
+ "openspec_task_count": { "type": "integer" },
105
+ "static_check_pass": { "type": ["boolean", "null"] },
106
+ "test_coverage": { "type": ["number", "null"] },
107
+ "pr_size": { "type": "integer" },
108
+ "audit_score": { "type": ["object", "null"] },
109
+ "code_review_calls": { "type": "integer" }
110
+ }
111
+ },
112
+ "outcome": {
113
+ "type": "object",
114
+ "properties": {
115
+ "issue_closed": { "type": ["boolean", "null"] },
116
+ "pr_merged": { "type": ["boolean", "null"] },
117
+ "pr_merge_latency_seconds": { "type": "integer" },
118
+ "knowledge_synced": { "type": ["boolean", "null"] },
119
+ "time_to_pr_seconds": { "type": "integer" },
120
+ "time_to_merge_seconds": { "type": "integer" },
121
+ "unique_files_touched_ratio": { "type": "number" }
122
+ }
123
+ }
124
+ }
125
+ },
126
+ "confidence": {
127
+ "type": "object",
128
+ "additionalProperties": {
129
+ "type": "string",
130
+ "enum": ["exact", "estimated", "pending"]
131
+ }
132
+ },
133
+ "evaluation": {
134
+ "type": "object",
135
+ "additionalProperties": {
136
+ "type": "object",
137
+ "properties": {
138
+ "value": {},
139
+ "threshold": {},
140
+ "status": {
141
+ "type": "string",
142
+ "enum": ["green", "yellow", "red", "unknown"]
143
+ }
144
+ }
145
+ }
146
+ }
147
+ }
148
+ }
@@ -0,0 +1,128 @@
1
+ $schema: "http://json-schema.org/draft-07/schema#"
2
+ title: PM-to-UX Handoff Contract
3
+ description: |
4
+ Machine-readable contract for PM→UX handoff in Lincoln issue packages.
5
+ UX Agents must read this file first, then the human master doc, then the ordered context pack.
6
+ type: object
7
+ required:
8
+ - contract_version
9
+ - issue_number
10
+ - feature_slug
11
+ - from_stage
12
+ - to_stage
13
+ - from_agent
14
+ - to_agent
15
+ - handoff_type
16
+ - human_master_doc
17
+ - based_on
18
+ - context_pack
19
+ - reading_rules
20
+ - open_questions
21
+ - approval
22
+ properties:
23
+ contract_version:
24
+ type: string
25
+ pattern: "^\\d+\\.\\d+\\.\\d+$"
26
+ description: Schema version of this contract file.
27
+ issue_number:
28
+ type: string
29
+ description: GitHub issue number.
30
+ feature_slug:
31
+ type: string
32
+ description: Feature/design slug used in the issue package.
33
+ from_stage:
34
+ type: string
35
+ enum: ["clarify", "product-design-docs"]
36
+ to_stage:
37
+ type: string
38
+ enum: ["product-design-docs", "product-prototype"]
39
+ from_agent:
40
+ type: string
41
+ to_agent:
42
+ type: string
43
+ handoff_type:
44
+ type: string
45
+ enum: ["pm-to-ux"]
46
+ human_master_doc:
47
+ type: object
48
+ required: [path, version]
49
+ properties:
50
+ path:
51
+ type: string
52
+ version:
53
+ type: string
54
+ pattern: "^v\\d+\\.\\d+$"
55
+ based_on:
56
+ type: array
57
+ items:
58
+ type: object
59
+ required: [path, version]
60
+ properties:
61
+ path:
62
+ type: string
63
+ version:
64
+ type: string
65
+ pattern: "^v\\d+\\.\\d+$"
66
+ context_pack:
67
+ type: object
68
+ required: [tier_0, tier_1, tier_2]
69
+ properties:
70
+ tier_0:
71
+ type: array
72
+ items:
73
+ type: object
74
+ required: [path, reason]
75
+ properties:
76
+ path: { type: string }
77
+ reason: { type: string }
78
+ tier_1:
79
+ type: array
80
+ items:
81
+ type: object
82
+ required: [path, reason]
83
+ properties:
84
+ path: { type: string }
85
+ reason: { type: string }
86
+ tier_2:
87
+ type: array
88
+ items:
89
+ type: object
90
+ required: [feature, links]
91
+ properties:
92
+ feature: { type: string }
93
+ links:
94
+ type: array
95
+ items:
96
+ type: object
97
+ required: [path, reason]
98
+ properties:
99
+ path: { type: string }
100
+ reason: { type: string }
101
+ reading_rules:
102
+ type: array
103
+ items:
104
+ type: string
105
+ open_questions:
106
+ type: array
107
+ items:
108
+ type: object
109
+ required: [id, question, owner, status]
110
+ properties:
111
+ id: { type: string }
112
+ question: { type: string }
113
+ owner: { type: string }
114
+ status:
115
+ type: string
116
+ enum: ["open", "resolved", "deferred"]
117
+ approval:
118
+ type: object
119
+ required: [pm_confirmed]
120
+ properties:
121
+ pm_confirmed:
122
+ type: boolean
123
+ approved_at:
124
+ type: string
125
+ approved_by:
126
+ type: string
127
+ notes:
128
+ type: string