@a-company/paradigm 6.6.6 → 7.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. package/dist/{accept-orchestration-JHDCVHB2.js → accept-orchestration-YO2V2WYA.js} +1 -1
  2. package/dist/{agents-suggest-IKY6VD2R.js → agents-suggest-WZEGQT5E.js} +1 -1
  3. package/dist/ambient-7HBJHJL2.js +2 -0
  4. package/dist/{ambient-FNNFB4AP.js → ambient-OX7YJ4PJ.js} +1 -1
  5. package/dist/ambient-SST5CLEC.js +35 -0
  6. package/dist/captain-YUP3KVCA.js +2 -0
  7. package/dist/chunk-33ERV2MW.js +18 -0
  8. package/dist/chunk-3MZ4J2LF.js +2 -0
  9. package/dist/chunk-47YPID6H.js +142 -0
  10. package/dist/chunk-6AKNXD22.js +32 -0
  11. package/dist/chunk-6HVOZANP.js +4 -0
  12. package/dist/chunk-ACJWUOMA.js +3 -0
  13. package/dist/chunk-B5KLSBOZ.js +2 -0
  14. package/dist/chunk-DLMDHS2X.js +10 -0
  15. package/dist/chunk-FRQRREJ6.js +29 -0
  16. package/dist/{chunk-5RFISGUW.js → chunk-G6DK3ND3.js} +250 -25
  17. package/dist/{chunk-XKNJSPB5.js → chunk-JCGCPAHF.js} +1 -1
  18. package/dist/chunk-K54L6CFR.js +25 -0
  19. package/dist/chunk-QBIQ2FYB.js +20 -0
  20. package/dist/chunk-QEQCPVF5.js +4 -0
  21. package/dist/chunk-ROU3F2HZ.js +6 -0
  22. package/dist/chunk-S4J337EQ.js +504 -0
  23. package/dist/chunk-V6MIKLMY.js +18 -0
  24. package/dist/chunk-WROJSWAO.js +93 -0
  25. package/dist/{chunk-TQOT2LBO.js → chunk-YXLGVOZO.js} +1 -1
  26. package/dist/chunk-ZSWXLFN7.js +12 -0
  27. package/dist/{compliance-J3VOV445.js → compliance-MLG4W6S4.js} +1 -1
  28. package/dist/{diff-ANKTFDRA.js → diff-MC6AXLKX.js} +1 -1
  29. package/dist/{docs-TSAAS4W3.js → docs-3YFNNZRV.js} +1 -1
  30. package/dist/doctor-CBZYYQQH.js +2 -0
  31. package/dist/{hooks-45WDP6QS.js → hooks-AXBWYJ5V.js} +1 -1
  32. package/dist/index.js +4 -4
  33. package/dist/mcp.js +3 -3
  34. package/dist/{migrate-R64OQGSM.js → migrate-5M4KUQ2L.js} +1 -1
  35. package/dist/{nomination-engine-NCLTGMAK.js → nomination-engine-AQHU2KBU.js} +1 -1
  36. package/dist/notebook-loader-6DYFMNJ2.js +2 -0
  37. package/dist/orchestrate-GMYEBA5T.js +8 -0
  38. package/dist/orchestration-G5MAY6IA.js +2 -0
  39. package/dist/propose-block-ZEMEWJQF.js +2 -0
  40. package/dist/{providers-TBPOE4DI.js → providers-5EHD45C6.js} +1 -1
  41. package/dist/reindex-XTRF23F7.js +2 -0
  42. package/dist/{serve-3FMUWW5K.js → serve-SMGWGJLM.js} +1 -1
  43. package/dist/session-tracker-BZ7FU4AT.js +2 -0
  44. package/dist/session-work-log-QXPAXY5K.js +2 -0
  45. package/dist/session-work-log-T2IE4Y4T.js +2 -0
  46. package/dist/{shift-TNA2E5O7.js → shift-JBCEDCGA.js} +2 -2
  47. package/dist/solo-OWR3MX74.js +3 -0
  48. package/dist/{spawn-KKDDR6UR.js → spawn-PHA2SVQ3.js} +1 -1
  49. package/dist/task-loader-IGQQ6ZFL.js +2 -0
  50. package/dist/task-settlement-NW4XMJGJ.js +3 -0
  51. package/dist/{team-PEGP6F7S.js → team-J2YXPEGX.js} +1 -1
  52. package/dist/team-funnel-RAJ6EDG3.js +2 -0
  53. package/dist/tools-HNJ7D5IO.js +2 -0
  54. package/dist/university-content/notes/N-para-801-cid-becomes-real.md +60 -0
  55. package/dist/university-content/notes/N-para-801-falsifiable-self-improvement.md +66 -0
  56. package/dist/university-content/notes/N-para-801-honest-routing-and-the-method.md +57 -0
  57. package/dist/university-content/notes/N-para-801-orchestration-emits-dag.md +60 -0
  58. package/dist/university-content/notes/N-para-801-settlement-closes-the-loop.md +64 -0
  59. package/dist/university-content/notes/N-para-801-the-task-dag.md +93 -0
  60. package/dist/university-content/paths/LP-para-801.yaml +43 -0
  61. package/dist/university-content/quizzes/Q-para-801-cid-becomes-real.yaml +54 -0
  62. package/dist/university-content/quizzes/Q-para-801-falsifiable-self-improvement.yaml +54 -0
  63. package/dist/university-content/quizzes/Q-para-801-honest-routing-and-the-method.yaml +54 -0
  64. package/dist/university-content/quizzes/Q-para-801-orchestration-emits-dag.yaml +54 -0
  65. package/dist/university-content/quizzes/Q-para-801-settlement-closes-the-loop.yaml +54 -0
  66. package/dist/university-content/quizzes/Q-para-801-the-task-dag.yaml +54 -0
  67. package/dist/university-ui/assets/{index-DrtbBC21.js → index-B8hm_MdR.js} +2 -2
  68. package/dist/university-ui/assets/{index-DrtbBC21.js.map → index-B8hm_MdR.js.map} +1 -1
  69. package/dist/university-ui/index.html +1 -1
  70. package/package.json +1 -1
  71. package/dist/ambient-AI42BOM5.js +0 -35
  72. package/dist/chunk-3OXR6F65.js +0 -666
  73. package/dist/chunk-4N56FRNE.js +0 -29
  74. package/dist/chunk-6QXBXZF6.js +0 -3
  75. package/dist/chunk-AMLD7IYC.js +0 -10
  76. package/dist/chunk-DVZWCXB6.js +0 -2
  77. package/dist/chunk-F6E3HW45.js +0 -14
  78. package/dist/chunk-K7X3Z3GL.js +0 -4
  79. package/dist/chunk-LAYBUKMB.js +0 -14
  80. package/dist/chunk-MU5YWTNE.js +0 -24
  81. package/dist/chunk-PMKZMCTS.js +0 -111
  82. package/dist/chunk-XQLO5URP.js +0 -11
  83. package/dist/doctor-L5XZENCF.js +0 -2
  84. package/dist/notebook-loader-3J2OFMS3.js +0 -2
  85. package/dist/orchestrate-UG5QXNAU.js +0 -8
  86. package/dist/reindex-PTIQ2UGY.js +0 -2
  87. package/dist/session-tracker-HHNY6J4I.js +0 -2
  88. package/dist/session-work-log-MEJ33TYD.js +0 -2
  89. package/dist/session-work-log-ZVVJGO7X.js +0 -2
  90. package/dist/task-loader-NZFDTUQ5.js +0 -2
  91. package/dist/tools-PUSDXUYE.js +0 -2
  92. /package/dist/{chunk-HXGYVS2N.js → chunk-ECLUYHAR.js} +0 -0
  93. /package/dist/{platform-server-ANOALDPL.js → platform-server-WIBVYHIV.js} +0 -0
package/dist/mcp.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import {d,g as g$1,h,e,a as a$1,b as b$2,f,c}from'./chunk-3OXR6F65.js';import {t,b as b$1,fa}from'./chunk-PMKZMCTS.js';import'./chunk-4UJ4NIEQ.js';import'./chunk-4N56FRNE.js';import'./chunk-Q527BPUF.js';import'./chunk-KLBH26PA.js';import'./chunk-RGSFU2YW.js';import {p,q as q$1,k,l as l$1}from'./chunk-TMDPDIWA.js';import'./chunk-JNSJVCTU.js';import'./chunk-XROULIQN.js';import'./chunk-ZUAUFZRJ.js';import'./chunk-3KVVC4WV.js';import'./chunk-M4UMM6DC.js';import'./chunk-GRZQIKST.js';import'./chunk-KAFQA7HV.js';import {j as j$1}from'./chunk-6QXBXZF6.js';import {b,a}from'./chunk-EK4ZRIFJ.js';import'./chunk-LAYBUKMB.js';import'./chunk-DVZWCXB6.js';import'./chunk-QGZRM6ZB.js';import'./chunk-K7X3Z3GL.js';import'./chunk-5TAVYPOV.js';import {Server}from'@modelcontextprotocol/sdk/server/index.js';import {StdioServerTransport}from'@modelcontextprotocol/sdk/server/stdio.js';import {ListResourcesRequestSchema,ReadResourceRequestSchema}from'@modelcontextprotocol/sdk/types.js';import*as l from'fs';import*as g from'path';function ce(e){return {id:e.id,symbol:`^${e.id}`,description:e.description,locks:e.locks?.map(s=>({id:s.id,description:s.description,keys:s.keys?.map(n=>n.expression||n),mode:s.mode||"all"})),prizes:e.prizes?.map(s=>({id:s.id,oneTime:s.oneTime}))}}function F(e){let s=e.gateConfig?.gates||[],n=l$1(e.index,"gate"),t=new Map;for(let o of n){let i=o.symbol.replace(/^\^/,"");t.set(i,{id:i,symbol:o.symbol,description:o.description,source:"purpose",filePath:o.filePath,data:o.data});}for(let o of s)t.set(o.id,{...ce(o),source:"portal.yaml"});return Array.from(t.values())}function z(e){let s=e.gateConfig?.flows||[],n=l$1(e.index,"flow"),t=new Map;for(let o of n){let i=o.symbol.replace(/^\$/,"");t.set(i,{id:i,symbol:o.symbol,description:o.description,source:"purpose",filePath:o.filePath,data:o.data});}for(let o of s)t.set(o.id,{id:o.id,symbol:`$${o.id}`,description:o.description,gates:o.gates,source:"portal.yaml"});return Array.from(t.values())}function U(){return [{uri:"paradigm://wisdom/preferences",name:"Wisdom - Preferences",description:"Team preferences for patterns, testing, and code style",mimeType:"application/json"},{uri:"paradigm://wisdom/antipatterns",name:"Wisdom - Antipatterns",description:"What NOT to do, with reasons and alternatives",mimeType:"application/json"},{uri:"paradigm://wisdom/decisions",name:"Wisdom - Decisions",description:"Architectural Decision Records (ADRs) index",mimeType:"application/json"}]}async function $(e$1,s){if(e$1==="wisdom/preferences"){let n=await e(s);return {handled:true,text:JSON.stringify({version:n.preferences?.version||"1.0",global:n.preferences?.global||{},by_symbol:n.preferences?.by_symbol||{},symbol_count:Object.keys(n.preferences?.by_symbol||{}).length},null,2)}}if(e$1.startsWith("wisdom/preferences/")){let n=decodeURIComponent(e$1.replace("wisdom/preferences/","")),t=await e(s),o=a$1(t,n);return {handled:true,text:JSON.stringify({symbol:n,preferences:o.preferences,global:t.preferences?.global||{}},null,2)}}if(e$1==="wisdom/antipatterns"){let n=await e(s);return {handled:true,text:JSON.stringify({count:n.antipatterns.length,antipatterns:n.antipatterns},null,2)}}if(e$1.startsWith("wisdom/antipatterns/")){let n=decodeURIComponent(e$1.replace("wisdom/antipatterns/","")),t=await e(s),o=a$1(t,n);return {handled:true,text:JSON.stringify({symbol:n,count:o.antipatterns.length,antipatterns:o.antipatterns},null,2)}}if(e$1==="wisdom/decisions"){let n=await e(s);return {handled:true,text:JSON.stringify({count:n.decisions.length,decisions:n.decisions.map(t=>({id:t.id,title:t.title,status:t.status,date:t.date,symbols:t.symbols}))},null,2)}}if(e$1.startsWith("wisdom/decision/")){let n=e$1.replace("wisdom/decision/",""),t=await e(s),o=t.decisions.find(i=>i.id===n);return o?{handled:true,text:JSON.stringify(o,null,2)}:{handled:true,text:JSON.stringify({error:"Decision not found",id:n,available:t.decisions.map(i=>i.id)},null,2)}}if(e$1.startsWith("wisdom/expertise/")){let n=decodeURIComponent(e$1.replace("wisdom/expertise/","")),t=await e(s),o=b$2(t,{symbol:n});return {handled:true,text:JSON.stringify({symbol:n,count:o.length,experts:o.map(i=>({name:i.name,symbols:i.symbols,areas:i.areas,contact:i.contact}))},null,2)}}return {handled:false,text:""}}function G(){return [{uri:"paradigm://history/fragile",name:"History - Fragile Symbols",description:"Symbols with high fragility that need extra care when modifying",mimeType:"application/json"},{uri:"paradigm://history/validation/summary",name:"History - Validation Summary",description:"Overall validation statistics and pass rates",mimeType:"application/json"}]}async function q(e,s){if(e.startsWith("history/symbol/")&&!e.endsWith("/recent")){let n=decodeURIComponent(e.replace("history/symbol/","")),t=await f(s),o=c(t,n);return {handled:true,text:JSON.stringify({symbol:n,summary:o.summary?{total_changes:o.summary.total_changes,last_modified:o.summary.last_modified,stability_score:o.summary.stability_score,fragility:o.summary.fragility,contributors:o.summary.contributors}:null,recent:o.recent,co_changes:o.co_changes,validation:o.validation},null,2)}}if(e.startsWith("history/symbol/")&&e.endsWith("/recent")){let n=decodeURIComponent(e.replace("history/symbol/","").replace("/recent","")),t=await f(s),o=c(t,n);return {handled:true,text:JSON.stringify({symbol:n,fragility:o.summary?.fragility||"unknown",stability_score:o.summary?.stability_score,recent:o.recent.slice(0,5)},null,2)}}if(e==="history/fragile"){let n=await f(s);return {handled:true,text:JSON.stringify({count:n.index?.fragile_symbols?.length||0,fragile_symbols:n.index?.fragile_symbols||[],recommendation:"Consider adding extra test coverage and reviewing recent changes before modifying these symbols"},null,2)}}if(e.startsWith("history/cochanges/")){let n=decodeURIComponent(e.replace("history/cochanges/","")),o=(await f(s)).index?.co_changes?.filter(i=>i.symbols.includes(n))||[];return {handled:true,text:JSON.stringify({symbol:n,count:o.length,co_changes:o.map(i=>({with:i.symbols.filter(a=>a!==n),frequency:i.frequency,correlation:i.correlation})),recommendation:o.length>0?"These symbols often change together - consider if they need updates too":"No strong co-change patterns detected"},null,2)}}if(e==="history/validation/summary"){let n=await f(s);return {handled:true,text:JSON.stringify({last_run:n.validation?.last_run,total_validations:n.validation?.total_validations||0,pass_rate:n.validation?.pass_rate||0,by_symbol:n.validation?.by_symbol||{}},null,2)}}return {handled:false,text:""}}function H(){return [{uri:"paradigm://context/agent-protocol",name:"Agent Protocol",description:"IMPORTANT: Read this first. Workflow instructions for using Paradigm MCP tools effectively.",mimeType:"text/markdown"},{uri:"paradigm://context/session",name:"Session Info",description:"Current MCP session statistics and context usage estimate",mimeType:"application/json"},{uri:"paradigm://context/handoff-guide",name:"Handoff Guide",description:"When and how to perform context handoffs",mimeType:"text/markdown"}]}async function J(e,s){if(e==="context/agent-protocol")return {handled:true,text:'# Agent Protocol for Paradigm MCP Tools\n\n## What Paradigm Is\n\nParadigm adds a metadata layer (`.purpose` files + `portal.yaml`) to any codebase so AI agents can query architecture context via MCP instead of reading source files directly.\n\n**What it does**\n- Tracks codebase symbols: `#components`, `$flows`, `^gates`, `!signals`, `~aspects`\n- Answers queries about structure, dependencies, authorization, and history without file reads\n- Enforces coverage: hooks block sessions that modify code without updating `.purpose` files\n\n**Tool surface (50+ tools)**\n- Navigation: `paradigm_status`, `paradigm_search`, `paradigm_navigate`, `paradigm_related`\n- Impact: `paradigm_ripple`, `paradigm_flows_affected`\n- Authorization: `paradigm_gates_for_route`, `paradigm_portal_add_gate`\n- History: `paradigm_history_context`, `paradigm_lore_record`, `paradigm_lore_search`\n- Agents: `paradigm_agent_list`, `paradigm_orchestrate_inline`, `paradigm_ambient_events`\n- Compliance: `paradigm_aspect_check`, `paradigm_protocol_search`\n- Session: `paradigm_session_health`, `paradigm_handoff_prepare`\n\n**Setup** (if not already initialized)\nRun `paradigm shift` \u2014 auto-detects language/framework, creates `.paradigm/` config, scaffolds `.purpose` and `portal.yaml`, installs hooks.\n\n---\n\n## Query Before Modify\n\n**Always query before making changes** - this ensures you understand impact and dependencies.\n\n| Before doing this... | Call this MCP tool |\n|---------------------|-------------------|\n| Modifying a symbol | `paradigm_ripple` with the symbol |\n| Starting a session | `paradigm_status` for project overview |\n| Understanding code | `paradigm_navigate` with explore intent |\n| Checking dependencies | `paradigm_related` for connections |\n\n## Example Workflow\n\n1. **Get oriented**: Call `paradigm_status` to see project symbols and health\n2. **Find relevant code**: Call `paradigm_navigate` with intent "find" or "explore"\n3. **Before editing**: Call `paradigm_ripple` on symbols you\'ll modify\n4. **Check context**: Call `paradigm_session_health` every 10-15 tool calls\n\n## Benefits\n\n- **Fresh data**: Always current from live project index\n- **Precise**: Only get the data you need\n- **Token-efficient**: ~100 tokens per query vs ~2000 for reading files\n\n## Context Monitoring\n\nCall `paradigm_session_health` periodically to monitor session health:\n- **<50%**: Continue working\n- **50-70%**: Plan a stopping point\n- **70-85%**: Prepare handoff soon\n- **>85%**: Handoff after current task\n\n## Tool Surface by Category\n\n| Category | Tools |\n|----------|-------|\n| Navigation | `paradigm_status`, `paradigm_search`, `paradigm_navigate`, `paradigm_related` |\n| Impact analysis | `paradigm_ripple`, `paradigm_flows_affected` |\n| Authorization | `paradigm_gates_for_route`, `paradigm_portal_add_gate` |\n| History & lore | `paradigm_history_context`, `paradigm_lore_record`, `paradigm_lore_search` |\n| Agent team | `paradigm_agent_list`, `paradigm_orchestrate_inline`, `paradigm_captain_brief` |\n| Compliance | `paradigm_aspect_check`, `paradigm_protocol_search`, `paradigm_aspect_drift` |\n| Session | `paradigm_session_health`, `paradigm_handoff_prepare`, `paradigm_session_recover` |\n| Architecture | `paradigm_arch_status`, `paradigm_arch_diagram` |\n\n---\n\n*This protocol ensures efficient, safe modifications to the codebase.*\n'};if(e==="context/session"){let n=j$1(),t=n.getStats(),o=n.getDurationMinutes();return {handled:true,text:JSON.stringify({session:{durationMinutes:o,startTime:new Date(t.startTime).toISOString(),lastActivity:new Date(t.lastActivity).toISOString()},interactions:{toolCalls:t.totals.toolCallCount,resourceReads:t.totals.resourceReadCount,totalInteractions:t.totals.toolCallCount+t.totals.resourceReadCount},tokens:{estimatedMcpContribution:t.totals.totalTokens,note:"Use paradigm_session_health tool for full analysis with handoff recommendations"}},null,2)}}return e==="context/handoff-guide"?{handled:true,text:`# Context Handoff Guide
2
+ import {a as a$1,b as b$1}from'./chunk-47YPID6H.js';import'./chunk-ZUAUFZRJ.js';import'./chunk-S4J337EQ.js';import {i,j as j$2,a as a$2,b as b$2,k as k$1,d}from'./chunk-K54L6CFR.js';import {p as p$1}from'./chunk-WROJSWAO.js';import {n,P}from'./chunk-QBIQ2FYB.js';import'./chunk-M4UMM6DC.js';import'./chunk-B5KLSBOZ.js';import'./chunk-4UJ4NIEQ.js';import'./chunk-ROU3F2HZ.js';import'./chunk-FRQRREJ6.js';import'./chunk-3KVVC4WV.js';import'./chunk-QEQCPVF5.js';import'./chunk-Q527BPUF.js';import'./chunk-RGSFU2YW.js';import {p,q as q$1,k,l as l$1}from'./chunk-TMDPDIWA.js';import'./chunk-KLBH26PA.js';import'./chunk-XROULIQN.js';import'./chunk-GRZQIKST.js';import'./chunk-KAFQA7HV.js';import {j as j$1}from'./chunk-ACJWUOMA.js';import'./chunk-33ERV2MW.js';import'./chunk-3MZ4J2LF.js';import {b,a}from'./chunk-EK4ZRIFJ.js';import'./chunk-JNSJVCTU.js';import'./chunk-QGZRM6ZB.js';import'./chunk-5TAVYPOV.js';import {Server}from'@modelcontextprotocol/sdk/server/index.js';import {StdioServerTransport}from'@modelcontextprotocol/sdk/server/stdio.js';import {ListResourcesRequestSchema,ReadResourceRequestSchema}from'@modelcontextprotocol/sdk/types.js';import*as l from'fs';import*as g from'path';function ce(e){return {id:e.id,symbol:`^${e.id}`,description:e.description,locks:e.locks?.map(s=>({id:s.id,description:s.description,keys:s.keys?.map(n=>n.expression||n),mode:s.mode||"all"})),prizes:e.prizes?.map(s=>({id:s.id,oneTime:s.oneTime}))}}function F(e){let s=e.gateConfig?.gates||[],n=l$1(e.index,"gate"),t=new Map;for(let o of n){let i=o.symbol.replace(/^\^/,"");t.set(i,{id:i,symbol:o.symbol,description:o.description,source:"purpose",filePath:o.filePath,data:o.data});}for(let o of s)t.set(o.id,{...ce(o),source:"portal.yaml"});return Array.from(t.values())}function z(e){let s=e.gateConfig?.flows||[],n=l$1(e.index,"flow"),t=new Map;for(let o of n){let i=o.symbol.replace(/^\$/,"");t.set(i,{id:i,symbol:o.symbol,description:o.description,source:"purpose",filePath:o.filePath,data:o.data});}for(let o of s)t.set(o.id,{id:o.id,symbol:`$${o.id}`,description:o.description,gates:o.gates,source:"portal.yaml"});return Array.from(t.values())}function U(){return [{uri:"paradigm://wisdom/preferences",name:"Wisdom - Preferences",description:"Team preferences for patterns, testing, and code style",mimeType:"application/json"},{uri:"paradigm://wisdom/antipatterns",name:"Wisdom - Antipatterns",description:"What NOT to do, with reasons and alternatives",mimeType:"application/json"},{uri:"paradigm://wisdom/decisions",name:"Wisdom - Decisions",description:"Architectural Decision Records (ADRs) index",mimeType:"application/json"}]}async function $(e,s){if(e==="wisdom/preferences"){let n=await j$2(s);return {handled:true,text:JSON.stringify({version:n.preferences?.version||"1.0",global:n.preferences?.global||{},by_symbol:n.preferences?.by_symbol||{},symbol_count:Object.keys(n.preferences?.by_symbol||{}).length},null,2)}}if(e.startsWith("wisdom/preferences/")){let n=decodeURIComponent(e.replace("wisdom/preferences/","")),t=await j$2(s),o=a$2(t,n);return {handled:true,text:JSON.stringify({symbol:n,preferences:o.preferences,global:t.preferences?.global||{}},null,2)}}if(e==="wisdom/antipatterns"){let n=await j$2(s);return {handled:true,text:JSON.stringify({count:n.antipatterns.length,antipatterns:n.antipatterns},null,2)}}if(e.startsWith("wisdom/antipatterns/")){let n=decodeURIComponent(e.replace("wisdom/antipatterns/","")),t=await j$2(s),o=a$2(t,n);return {handled:true,text:JSON.stringify({symbol:n,count:o.antipatterns.length,antipatterns:o.antipatterns},null,2)}}if(e==="wisdom/decisions"){let n=await j$2(s);return {handled:true,text:JSON.stringify({count:n.decisions.length,decisions:n.decisions.map(t=>({id:t.id,title:t.title,status:t.status,date:t.date,symbols:t.symbols}))},null,2)}}if(e.startsWith("wisdom/decision/")){let n=e.replace("wisdom/decision/",""),t=await j$2(s),o=t.decisions.find(i=>i.id===n);return o?{handled:true,text:JSON.stringify(o,null,2)}:{handled:true,text:JSON.stringify({error:"Decision not found",id:n,available:t.decisions.map(i=>i.id)},null,2)}}if(e.startsWith("wisdom/expertise/")){let n=decodeURIComponent(e.replace("wisdom/expertise/","")),t=await j$2(s),o=b$2(t,{symbol:n});return {handled:true,text:JSON.stringify({symbol:n,count:o.length,experts:o.map(i=>({name:i.name,symbols:i.symbols,areas:i.areas,contact:i.contact}))},null,2)}}return {handled:false,text:""}}function G(){return [{uri:"paradigm://history/fragile",name:"History - Fragile Symbols",description:"Symbols with high fragility that need extra care when modifying",mimeType:"application/json"},{uri:"paradigm://history/validation/summary",name:"History - Validation Summary",description:"Overall validation statistics and pass rates",mimeType:"application/json"}]}async function q(e,s){if(e.startsWith("history/symbol/")&&!e.endsWith("/recent")){let n=decodeURIComponent(e.replace("history/symbol/","")),t=await k$1(s),o=d(t,n);return {handled:true,text:JSON.stringify({symbol:n,summary:o.summary?{total_changes:o.summary.total_changes,last_modified:o.summary.last_modified,stability_score:o.summary.stability_score,fragility:o.summary.fragility,contributors:o.summary.contributors}:null,recent:o.recent,co_changes:o.co_changes,validation:o.validation},null,2)}}if(e.startsWith("history/symbol/")&&e.endsWith("/recent")){let n=decodeURIComponent(e.replace("history/symbol/","").replace("/recent","")),t=await k$1(s),o=d(t,n);return {handled:true,text:JSON.stringify({symbol:n,fragility:o.summary?.fragility||"unknown",stability_score:o.summary?.stability_score,recent:o.recent.slice(0,5)},null,2)}}if(e==="history/fragile"){let n=await k$1(s);return {handled:true,text:JSON.stringify({count:n.index?.fragile_symbols?.length||0,fragile_symbols:n.index?.fragile_symbols||[],recommendation:"Consider adding extra test coverage and reviewing recent changes before modifying these symbols"},null,2)}}if(e.startsWith("history/cochanges/")){let n=decodeURIComponent(e.replace("history/cochanges/","")),o=(await k$1(s)).index?.co_changes?.filter(i=>i.symbols.includes(n))||[];return {handled:true,text:JSON.stringify({symbol:n,count:o.length,co_changes:o.map(i=>({with:i.symbols.filter(a=>a!==n),frequency:i.frequency,correlation:i.correlation})),recommendation:o.length>0?"These symbols often change together - consider if they need updates too":"No strong co-change patterns detected"},null,2)}}if(e==="history/validation/summary"){let n=await k$1(s);return {handled:true,text:JSON.stringify({last_run:n.validation?.last_run,total_validations:n.validation?.total_validations||0,pass_rate:n.validation?.pass_rate||0,by_symbol:n.validation?.by_symbol||{}},null,2)}}return {handled:false,text:""}}function H(){return [{uri:"paradigm://context/agent-protocol",name:"Agent Protocol",description:"IMPORTANT: Read this first. Workflow instructions for using Paradigm MCP tools effectively.",mimeType:"text/markdown"},{uri:"paradigm://context/session",name:"Session Info",description:"Current MCP session statistics and context usage estimate",mimeType:"application/json"},{uri:"paradigm://context/handoff-guide",name:"Handoff Guide",description:"When and how to perform context handoffs",mimeType:"text/markdown"}]}async function J(e,s){if(e==="context/agent-protocol")return {handled:true,text:'# Agent Protocol for Paradigm MCP Tools\n\n## What Paradigm Is\n\nParadigm adds a metadata layer (`.purpose` files + `portal.yaml`) to any codebase so AI agents can query architecture context via MCP instead of reading source files directly.\n\n**What it does**\n- Tracks codebase symbols: `#components`, `$flows`, `^gates`, `!signals`, `~aspects`\n- Answers queries about structure, dependencies, authorization, and history without file reads\n- Enforces coverage: hooks block sessions that modify code without updating `.purpose` files\n\n**Tool surface (50+ tools)**\n- Navigation: `paradigm_status`, `paradigm_search`, `paradigm_navigate`, `paradigm_related`\n- Impact: `paradigm_ripple`, `paradigm_flows_affected`\n- Authorization: `paradigm_gates_for_route`, `paradigm_portal_add_gate`\n- History: `paradigm_history_context`, `paradigm_lore_record`, `paradigm_lore_search`\n- Agents: `paradigm_agent_list`, `paradigm_orchestrate_inline`, `paradigm_ambient_events`\n- Compliance: `paradigm_aspect_check`, `paradigm_protocol_search`\n- Session: `paradigm_session_health`, `paradigm_handoff_prepare`\n\n**Setup** (if not already initialized)\nRun `paradigm shift` \u2014 auto-detects language/framework, creates `.paradigm/` config, scaffolds `.purpose` and `portal.yaml`, installs hooks.\n\n---\n\n## Query Before Modify\n\n**Always query before making changes** - this ensures you understand impact and dependencies.\n\n| Before doing this... | Call this MCP tool |\n|---------------------|-------------------|\n| Modifying a symbol | `paradigm_ripple` with the symbol |\n| Starting a session | `paradigm_status` for project overview |\n| Understanding code | `paradigm_navigate` with explore intent |\n| Checking dependencies | `paradigm_related` for connections |\n\n## Example Workflow\n\n1. **Get oriented**: Call `paradigm_status` to see project symbols and health\n2. **Find relevant code**: Call `paradigm_navigate` with intent "find" or "explore"\n3. **Before editing**: Call `paradigm_ripple` on symbols you\'ll modify\n4. **Check context**: Call `paradigm_session_health` every 10-15 tool calls\n\n## Benefits\n\n- **Fresh data**: Always current from live project index\n- **Precise**: Only get the data you need\n- **Token-efficient**: ~100 tokens per query vs ~2000 for reading files\n\n## Context Monitoring\n\nCall `paradigm_session_health` periodically to monitor session health:\n- **<50%**: Continue working\n- **50-70%**: Plan a stopping point\n- **70-85%**: Prepare handoff soon\n- **>85%**: Handoff after current task\n\n## Tool Surface by Category\n\n| Category | Tools |\n|----------|-------|\n| Navigation | `paradigm_status`, `paradigm_search`, `paradigm_navigate`, `paradigm_related` |\n| Impact analysis | `paradigm_ripple`, `paradigm_flows_affected` |\n| Authorization | `paradigm_gates_for_route`, `paradigm_portal_add_gate` |\n| History & lore | `paradigm_history_context`, `paradigm_lore_record`, `paradigm_lore_search` |\n| Agent team | `paradigm_agent_list`, `paradigm_orchestrate_inline`, `paradigm_captain_brief` |\n| Compliance | `paradigm_aspect_check`, `paradigm_protocol_search`, `paradigm_aspect_drift` |\n| Session | `paradigm_session_health`, `paradigm_handoff_prepare`, `paradigm_session_recover` |\n| Architecture | `paradigm_arch_status`, `paradigm_arch_diagram` |\n\n---\n\n*This protocol ensures efficient, safe modifications to the codebase.*\n'};if(e==="context/session"){let n=j$1(),t=n.getStats(),o=n.getDurationMinutes();return {handled:true,text:JSON.stringify({session:{durationMinutes:o,startTime:new Date(t.startTime).toISOString(),lastActivity:new Date(t.lastActivity).toISOString()},interactions:{toolCalls:t.totals.toolCallCount,resourceReads:t.totals.resourceReadCount,totalInteractions:t.totals.toolCallCount+t.totals.resourceReadCount},tokens:{estimatedMcpContribution:t.totals.totalTokens,note:"Use paradigm_session_health tool for full analysis with handoff recommendations"}},null,2)}}return e==="context/handoff-guide"?{handled:true,text:`# Context Handoff Guide
3
3
 
4
4
  ## When to Handoff
5
5
 
@@ -48,7 +48,7 @@ Call the \`paradigm_session_health\` tool to get:
48
48
  - List specific file paths modified
49
49
  - Include any blockers or decisions needed
50
50
  - Reference relevant symbols (@feature, #component, etc.)
51
- `}:{handled:false,text:""}}var de={"add-feature":"Pathway for adding a new user-facing feature with proper symbol definitions","add-gate":"Add a new gate (portal) for authorization control","debug-auth":"Debug authentication and authorization issues","implement-ftux":"Implement First-Time User Experience (FTUX) flow","implement-sandbox":"Set up a sandbox environment for testing","read-docs":"Read and understand existing documentation",refactor:"Refactor existing code with proper planning","run-e2e-tests":"Run and debug end-to-end tests","trace-flow":"Trace a flow through the system","validate-portals":"Validate portal.yaml configuration"};function pe(e,s){let n=[g.join(__dirname,"../../../../paradigm/templates/paradigm",e),g.join(s.rootDir,"node_modules/@a-company/paradigm/templates/paradigm",e),g.join(s.rootDir,"../../packages/paradigm/templates/paradigm",e),g.join(process.env.HOME||"",".paradigm/templates",e),g.resolve(__dirname,"../../../paradigm/templates/paradigm",e)];for(let t of n)try{if(l.existsSync(t))return t}catch{}return null}function B(e){return pe("prompts",e)}function le(e){return Math.ceil(e.length/3.5)}function V(e){let s=B(e);if(!s)return [];try{return l.readdirSync(s).filter(t=>t.endsWith(".md")).map(t=>{let o=t.replace(".md",""),i=g.join(s,t),a=l.statSync(i),r=l.readFileSync(i,"utf8");return {name:o,description:de[o]||`Prompt template: ${o}`,filename:t,size:a.size,tokens:le(r)}})}catch{return []}}function me(e,s){let n=B(s);if(!n)return {found:false,content:"",error:"Prompts directory not found. Ensure @a-company/paradigm is installed."};let t=g.join(n,`${e}.md`);try{if(!l.existsSync(t)){let i=V(s).map(a=>a.name);return {found:!1,content:"",error:`Prompt "${e}" not found. Available prompts: ${i.join(", ")}`}}return {content:l.readFileSync(t,"utf8"),found:!0}}catch(o){return {found:false,content:"",error:`Error reading prompt: ${o.message}`}}}function Y(){return [{uri:"paradigm://prompts",name:"Prompts",description:"List all available prompt templates with metadata (name, description, size)",mimeType:"application/json"},{uri:"paradigm://prompts/{name}",name:"Prompt Content",description:"Get a specific prompt template content. Replace {name} with prompt name (e.g., add-feature)",mimeType:"text/markdown"}]}async function Q(e,s){let n=`paradigm://${e}`;if(e==="prompts"){let t=V(s),o=t.reduce((r,d)=>r+d.size,0),i=t.reduce((r,d)=>r+d.tokens,0),a=JSON.stringify({count:t.length,totalSize:o,totalTokens:i,prompts:t.map(r=>({name:r.name,description:r.description,size:r.size,tokens:r.tokens,uri:`paradigm://prompts/${r.name}`})),usage:"Read a specific prompt with paradigm://prompts/{name}"},null,2);return b$1(a.length,n),{handled:true,text:a,mimeType:"application/json"}}if(e.startsWith("prompts/")){let t=decodeURIComponent(e.replace("prompts/","")),{content:o,found:i,error:a}=me(t,s);if(!i){let r=JSON.stringify({error:a,name:t},null,2);return b$1(r.length,n),{handled:true,text:r,mimeType:"application/json"}}return b$1(o.length,n),{handled:true,text:o,mimeType:"text/markdown"}}return {handled:false,text:"",mimeType:"application/json"}}var A={disciplines:"Language and discipline-agnostic symbol mappings for different domains",scan:"Paradigm Probe protocol for visual discovery and UI-to-code mapping","context-tracking":"Context tracking system for session monitoring and handoffs"};function ge(e,s){let n=[g.join(__dirname,"../../../../paradigm/templates/paradigm",e),g.join(s.rootDir,"node_modules/@a-company/paradigm/templates/paradigm",e),g.join(s.rootDir,"../../packages/paradigm/templates/paradigm",e),g.join(process.env.HOME||"",".paradigm/templates",e),g.resolve(__dirname,"../../../paradigm/templates/paradigm",e)];for(let t of n)try{if(l.existsSync(t))return t}catch{}return null}function K(e){return ge("specs",e)}function ue(e){return Math.ceil(e.length/3.5)}function fe(e){let s=K(e);if(!s)return [];let n=[];for(let[t,o]of Object.entries(A)){let i=`${t}.md`,a=g.join(s,i);try{if(l.existsSync(a)){let r=l.statSync(a),d=l.readFileSync(a,"utf8");n.push({name:t,description:o,filename:i,size:r.size,tokens:ue(d)});}}catch{}}return n}function he(e,s){if(!A[e]){let o=Object.keys(A);return {found:false,content:"",error:`"${e}" is not a reference spec. Reference specs available via MCP: ${o.join(", ")}. Project-specific specs should be read from .paradigm/specs/ directly.`}}let n=K(s);if(!n)return {found:false,content:"",error:"Specs directory not found. Ensure @a-company/paradigm is installed."};let t=g.join(n,`${e}.md`);try{return l.existsSync(t)?{content:l.readFileSync(t,"utf8"),found:!0}:{found:!1,content:"",error:`Spec "${e}" file not found at expected location.`}}catch(o){return {found:false,content:"",error:`Error reading spec: ${o.message}`}}}function X(){return [{uri:"paradigm://specs",name:"Reference Specs",description:"List reference specifications (disciplines, scan, context-tracking)",mimeType:"application/json"},{uri:"paradigm://specs/{name}",name:"Spec Content",description:"Get a reference spec. Available: disciplines, scan, context-tracking",mimeType:"text/markdown"}]}async function Z(e,s){let n=`paradigm://${e}`;if(e==="specs"){let t=fe(s),o=t.reduce((r,d)=>r+d.size,0),i=t.reduce((r,d)=>r+d.tokens,0),a=JSON.stringify({count:t.length,totalSize:o,totalTokens:i,note:"These are reference specs served via MCP. Project-specific specs (logger, symbols, etc.) should be read from .paradigm/specs/ directly.",specs:t.map(r=>({name:r.name,description:r.description,size:r.size,tokens:r.tokens,uri:`paradigm://specs/${r.name}`}))},null,2);return b$1(a.length,n),{handled:true,text:a,mimeType:"application/json"}}if(e.startsWith("specs/")&&e!=="specs/"){let t=decodeURIComponent(e.replace("specs/","")),{content:o,found:i,error:a}=he(t,s);if(!i){let r=JSON.stringify({error:a,name:t},null,2);return b$1(r.length,n),{handled:true,text:r,mimeType:"application/json"}}return b$1(o.length,n),{handled:true,text:o,mimeType:"text/markdown"}}return {handled:false,text:"",mimeType:"application/json"}}var M={commands:"Complete CLI command reference with examples and usage guidance",queries:"jq query examples for querying the constellation symbol graph"};function ye(e,s){let n=[g.join(__dirname,"../../../../paradigm/templates/paradigm",e),g.join(s.rootDir,"node_modules/@a-company/paradigm/templates/paradigm",e),g.join(s.rootDir,"../../packages/paradigm/templates/paradigm",e),g.join(process.env.HOME||"",".paradigm/templates",e),g.resolve(__dirname,"../../../paradigm/templates/paradigm",e)];for(let t of n)try{if(l.existsSync(t))return t}catch{}return null}function ee(e){return ye("docs",e)}function be(e){return Math.ceil(e.length/3.5)}function _e(e){let s=ee(e);if(!s)return [];let n=[];for(let[t,o]of Object.entries(M)){let i=`${t}.md`,a=g.join(s,i);try{if(l.existsSync(a)){let r=l.statSync(a),d=l.readFileSync(a,"utf8");n.push({name:t,description:o,filename:i,size:r.size,tokens:be(d)});}}catch{}}return n}function we(e,s){if(!M[e]){let o=Object.keys(M);return {found:false,content:"",error:`"${e}" is not a reference doc. Reference docs available via MCP: ${o.join(", ")}. Project-specific docs (patterns, troubleshooting, etc.) should be read from .paradigm/docs/ directly.`}}let n=ee(s);if(!n)return {found:false,content:"",error:"Docs directory not found. Ensure @a-company/paradigm is installed."};let t=g.join(n,`${e}.md`);try{return l.existsSync(t)?{content:l.readFileSync(t,"utf8"),found:!0}:{found:!1,content:"",error:`Doc "${e}" file not found at expected location.`}}catch(o){return {found:false,content:"",error:`Error reading doc: ${o.message}`}}}function te(){return [{uri:"paradigm://docs",name:"Reference Docs",description:"List reference documentation (commands, queries)",mimeType:"application/json"},{uri:"paradigm://docs/{name}",name:"Doc Content",description:"Get a reference doc. Available: commands, queries",mimeType:"text/markdown"}]}async function oe(e,s){let n=`paradigm://${e}`;if(e==="docs"){let t=_e(s),o=t.reduce((r,d)=>r+d.size,0),i=t.reduce((r,d)=>r+d.tokens,0),a=JSON.stringify({count:t.length,totalSize:o,totalTokens:i,note:"These are reference docs served via MCP. Project-specific docs (patterns, troubleshooting, etc.) should be read from .paradigm/docs/ directly.",docs:t.map(r=>({name:r.name,description:r.description,size:r.size,tokens:r.tokens,uri:`paradigm://docs/${r.name}`}))},null,2);return b$1(a.length,n),{handled:true,text:a,mimeType:"application/json"}}if(e.startsWith("docs/")&&e!=="docs/"){let t=decodeURIComponent(e.replace("docs/","")),{content:o,found:i,error:a}=we(t,s);if(!i){let r=JSON.stringify({error:a,name:t},null,2);return b$1(r.length,n),{handled:true,text:r,mimeType:"application/json"}}return b$1(o.length,n),{handled:true,text:o,mimeType:"text/markdown"}}return {handled:false,text:"",mimeType:"application/json"}}var j={logging:{description:"Paradigm logger usage, symbol-to-method mapping by directory",generate:()=>"# Paradigm Logging Guide\n\n**IMPORTANT:** Use the Paradigm logger instead of raw console.log/print.\n\n## Usage Pattern\n\n```typescript\nlog.component('#login-handler').info('Starting login', { email });\nlog.component('#database').debug('Query executed', { duration });\nlog.gate('^authenticated').warn('Access denied', { userId });\nlog.signal('!login-success').info('User authenticated');\nlog.flow('$checkout').info('Flow step reached');\nlog.aspect('~audit-required').info('Audit triggered');\n```\n\n## Symbol Mapping by Directory\n\n| Directory | Symbol | Logger Method |\n|-----------|--------|---------------|\n| `features/**` | `#` | `log.component()` |\n| `routes/**` | `#` | `log.component()` |\n| `api/**` | `#` | `log.component()` |\n| `endpoints/**` | `#` | `log.component()` |\n| `commands/**` | `#` | `log.component()` |\n| `models/**` | `#` | `log.component()` |\n| `components/**` | `#` | `log.component()` |\n| `lib/**` | `#` | `log.component()` |\n| `utils/**` | `#` | `log.component()` |\n| `services/**` | `#` | `log.component()` |\n| `core/**` | `#` | `log.component()` |\n| `drivers/**` | `#` | `log.component()` |\n| `systems/**` | `#` | `log.component()` |\n| `integrations/**` | `#` | `log.component()` |\n| `external/**` | `#` | `log.component()` |\n| `vendors/**` | `#` | `log.component()` |\n| `stores/**` | `#` | `log.component()` |\n| `state/**` | `#` | `log.component()` |\n| `reducers/**` | `#` | `log.component()` |\n| `config/**` | `#` | `log.component()` |\n| `middleware/**` | `^` | `log.gate()` |\n| `auth/**` | `^` | `log.gate()` |\n| `guards/**` | `^` | `log.gate()` |\n| `policies/**` | `^` | `log.gate()` |\n| `events/**` | `!` | `log.signal()` |\n| `handlers/**` | `!` | `log.signal()` |\n| `listeners/**` | `!` | `log.signal()` |\n| `hooks/**` | `!` | `log.signal()` |\n| `flows/**` | `$` | `log.flow()` |\n| `sagas/**` | `$` | `log.flow()` |\n| `workflows/**` | `$` | `log.flow()` |\n| `pipelines/**` | `$` | `log.flow()` |\n| `aspects/**` | `~` | `log.aspect()` |\n| `rules/**` | `~` | `log.aspect()` |\n| `constraints/**` | `~` | `log.aspect()` |\n\nSee `.paradigm/specs/logger.md` for full specification."},portal:{description:"Portal protocol \u2014 authorization, gates, portal.yaml structure and workflow",generate:()=>`# Portal Protocol (Authorization)
51
+ `}:{handled:false,text:""}}var de={"add-feature":"Pathway for adding a new user-facing feature with proper symbol definitions","add-gate":"Add a new gate (portal) for authorization control","debug-auth":"Debug authentication and authorization issues","implement-ftux":"Implement First-Time User Experience (FTUX) flow","implement-sandbox":"Set up a sandbox environment for testing","read-docs":"Read and understand existing documentation",refactor:"Refactor existing code with proper planning","run-e2e-tests":"Run and debug end-to-end tests","trace-flow":"Trace a flow through the system","validate-portals":"Validate portal.yaml configuration"};function pe(e,s){let n=[g.join(__dirname,"../../../../paradigm/templates/paradigm",e),g.join(s.rootDir,"node_modules/@a-company/paradigm/templates/paradigm",e),g.join(s.rootDir,"../../packages/paradigm/templates/paradigm",e),g.join(process.env.HOME||"",".paradigm/templates",e),g.resolve(__dirname,"../../../paradigm/templates/paradigm",e)];for(let t of n)try{if(l.existsSync(t))return t}catch{}return null}function B(e){return pe("prompts",e)}function le(e){return Math.ceil(e.length/3.5)}function V(e){let s=B(e);if(!s)return [];try{return l.readdirSync(s).filter(t=>t.endsWith(".md")).map(t=>{let o=t.replace(".md",""),i=g.join(s,t),a=l.statSync(i),r=l.readFileSync(i,"utf8");return {name:o,description:de[o]||`Prompt template: ${o}`,filename:t,size:a.size,tokens:le(r)}})}catch{return []}}function me(e,s){let n=B(s);if(!n)return {found:false,content:"",error:"Prompts directory not found. Ensure @a-company/paradigm is installed."};let t=g.join(n,`${e}.md`);try{if(!l.existsSync(t)){let i=V(s).map(a=>a.name);return {found:!1,content:"",error:`Prompt "${e}" not found. Available prompts: ${i.join(", ")}`}}return {content:l.readFileSync(t,"utf8"),found:!0}}catch(o){return {found:false,content:"",error:`Error reading prompt: ${o.message}`}}}function Y(){return [{uri:"paradigm://prompts",name:"Prompts",description:"List all available prompt templates with metadata (name, description, size)",mimeType:"application/json"},{uri:"paradigm://prompts/{name}",name:"Prompt Content",description:"Get a specific prompt template content. Replace {name} with prompt name (e.g., add-feature)",mimeType:"text/markdown"}]}async function Q(e,s){let n=`paradigm://${e}`;if(e==="prompts"){let t=V(s),o=t.reduce((r,d)=>r+d.size,0),i=t.reduce((r,d)=>r+d.tokens,0),a=JSON.stringify({count:t.length,totalSize:o,totalTokens:i,prompts:t.map(r=>({name:r.name,description:r.description,size:r.size,tokens:r.tokens,uri:`paradigm://prompts/${r.name}`})),usage:"Read a specific prompt with paradigm://prompts/{name}"},null,2);return P(a.length,n),{handled:true,text:a,mimeType:"application/json"}}if(e.startsWith("prompts/")){let t=decodeURIComponent(e.replace("prompts/","")),{content:o,found:i,error:a}=me(t,s);if(!i){let r=JSON.stringify({error:a,name:t},null,2);return P(r.length,n),{handled:true,text:r,mimeType:"application/json"}}return P(o.length,n),{handled:true,text:o,mimeType:"text/markdown"}}return {handled:false,text:"",mimeType:"application/json"}}var A={disciplines:"Language and discipline-agnostic symbol mappings for different domains",scan:"Paradigm Probe protocol for visual discovery and UI-to-code mapping","context-tracking":"Context tracking system for session monitoring and handoffs"};function ge(e,s){let n=[g.join(__dirname,"../../../../paradigm/templates/paradigm",e),g.join(s.rootDir,"node_modules/@a-company/paradigm/templates/paradigm",e),g.join(s.rootDir,"../../packages/paradigm/templates/paradigm",e),g.join(process.env.HOME||"",".paradigm/templates",e),g.resolve(__dirname,"../../../paradigm/templates/paradigm",e)];for(let t of n)try{if(l.existsSync(t))return t}catch{}return null}function K(e){return ge("specs",e)}function ue(e){return Math.ceil(e.length/3.5)}function fe(e){let s=K(e);if(!s)return [];let n=[];for(let[t,o]of Object.entries(A)){let i=`${t}.md`,a=g.join(s,i);try{if(l.existsSync(a)){let r=l.statSync(a),d=l.readFileSync(a,"utf8");n.push({name:t,description:o,filename:i,size:r.size,tokens:ue(d)});}}catch{}}return n}function he(e,s){if(!A[e]){let o=Object.keys(A);return {found:false,content:"",error:`"${e}" is not a reference spec. Reference specs available via MCP: ${o.join(", ")}. Project-specific specs should be read from .paradigm/specs/ directly.`}}let n=K(s);if(!n)return {found:false,content:"",error:"Specs directory not found. Ensure @a-company/paradigm is installed."};let t=g.join(n,`${e}.md`);try{return l.existsSync(t)?{content:l.readFileSync(t,"utf8"),found:!0}:{found:!1,content:"",error:`Spec "${e}" file not found at expected location.`}}catch(o){return {found:false,content:"",error:`Error reading spec: ${o.message}`}}}function X(){return [{uri:"paradigm://specs",name:"Reference Specs",description:"List reference specifications (disciplines, scan, context-tracking)",mimeType:"application/json"},{uri:"paradigm://specs/{name}",name:"Spec Content",description:"Get a reference spec. Available: disciplines, scan, context-tracking",mimeType:"text/markdown"}]}async function Z(e,s){let n=`paradigm://${e}`;if(e==="specs"){let t=fe(s),o=t.reduce((r,d)=>r+d.size,0),i=t.reduce((r,d)=>r+d.tokens,0),a=JSON.stringify({count:t.length,totalSize:o,totalTokens:i,note:"These are reference specs served via MCP. Project-specific specs (logger, symbols, etc.) should be read from .paradigm/specs/ directly.",specs:t.map(r=>({name:r.name,description:r.description,size:r.size,tokens:r.tokens,uri:`paradigm://specs/${r.name}`}))},null,2);return P(a.length,n),{handled:true,text:a,mimeType:"application/json"}}if(e.startsWith("specs/")&&e!=="specs/"){let t=decodeURIComponent(e.replace("specs/","")),{content:o,found:i,error:a}=he(t,s);if(!i){let r=JSON.stringify({error:a,name:t},null,2);return P(r.length,n),{handled:true,text:r,mimeType:"application/json"}}return P(o.length,n),{handled:true,text:o,mimeType:"text/markdown"}}return {handled:false,text:"",mimeType:"application/json"}}var M={commands:"Complete CLI command reference with examples and usage guidance",queries:"jq query examples for querying the constellation symbol graph"};function ye(e,s){let n=[g.join(__dirname,"../../../../paradigm/templates/paradigm",e),g.join(s.rootDir,"node_modules/@a-company/paradigm/templates/paradigm",e),g.join(s.rootDir,"../../packages/paradigm/templates/paradigm",e),g.join(process.env.HOME||"",".paradigm/templates",e),g.resolve(__dirname,"../../../paradigm/templates/paradigm",e)];for(let t of n)try{if(l.existsSync(t))return t}catch{}return null}function ee(e){return ye("docs",e)}function be(e){return Math.ceil(e.length/3.5)}function _e(e){let s=ee(e);if(!s)return [];let n=[];for(let[t,o]of Object.entries(M)){let i=`${t}.md`,a=g.join(s,i);try{if(l.existsSync(a)){let r=l.statSync(a),d=l.readFileSync(a,"utf8");n.push({name:t,description:o,filename:i,size:r.size,tokens:be(d)});}}catch{}}return n}function we(e,s){if(!M[e]){let o=Object.keys(M);return {found:false,content:"",error:`"${e}" is not a reference doc. Reference docs available via MCP: ${o.join(", ")}. Project-specific docs (patterns, troubleshooting, etc.) should be read from .paradigm/docs/ directly.`}}let n=ee(s);if(!n)return {found:false,content:"",error:"Docs directory not found. Ensure @a-company/paradigm is installed."};let t=g.join(n,`${e}.md`);try{return l.existsSync(t)?{content:l.readFileSync(t,"utf8"),found:!0}:{found:!1,content:"",error:`Doc "${e}" file not found at expected location.`}}catch(o){return {found:false,content:"",error:`Error reading doc: ${o.message}`}}}function te(){return [{uri:"paradigm://docs",name:"Reference Docs",description:"List reference documentation (commands, queries)",mimeType:"application/json"},{uri:"paradigm://docs/{name}",name:"Doc Content",description:"Get a reference doc. Available: commands, queries",mimeType:"text/markdown"}]}async function oe(e,s){let n=`paradigm://${e}`;if(e==="docs"){let t=_e(s),o=t.reduce((r,d)=>r+d.size,0),i=t.reduce((r,d)=>r+d.tokens,0),a=JSON.stringify({count:t.length,totalSize:o,totalTokens:i,note:"These are reference docs served via MCP. Project-specific docs (patterns, troubleshooting, etc.) should be read from .paradigm/docs/ directly.",docs:t.map(r=>({name:r.name,description:r.description,size:r.size,tokens:r.tokens,uri:`paradigm://docs/${r.name}`}))},null,2);return P(a.length,n),{handled:true,text:a,mimeType:"application/json"}}if(e.startsWith("docs/")&&e!=="docs/"){let t=decodeURIComponent(e.replace("docs/","")),{content:o,found:i,error:a}=we(t,s);if(!i){let r=JSON.stringify({error:a,name:t},null,2);return P(r.length,n),{handled:true,text:r,mimeType:"application/json"}}return P(o.length,n),{handled:true,text:o,mimeType:"text/markdown"}}return {handled:false,text:"",mimeType:"application/json"}}var j={logging:{description:"Paradigm logger usage, symbol-to-method mapping by directory",generate:()=>"# Paradigm Logging Guide\n\n**IMPORTANT:** Use the Paradigm logger instead of raw console.log/print.\n\n## Usage Pattern\n\n```typescript\nlog.component('#login-handler').info('Starting login', { email });\nlog.component('#database').debug('Query executed', { duration });\nlog.gate('^authenticated').warn('Access denied', { userId });\nlog.signal('!login-success').info('User authenticated');\nlog.flow('$checkout').info('Flow step reached');\nlog.aspect('~audit-required').info('Audit triggered');\n```\n\n## Symbol Mapping by Directory\n\n| Directory | Symbol | Logger Method |\n|-----------|--------|---------------|\n| `features/**` | `#` | `log.component()` |\n| `routes/**` | `#` | `log.component()` |\n| `api/**` | `#` | `log.component()` |\n| `endpoints/**` | `#` | `log.component()` |\n| `commands/**` | `#` | `log.component()` |\n| `models/**` | `#` | `log.component()` |\n| `components/**` | `#` | `log.component()` |\n| `lib/**` | `#` | `log.component()` |\n| `utils/**` | `#` | `log.component()` |\n| `services/**` | `#` | `log.component()` |\n| `core/**` | `#` | `log.component()` |\n| `drivers/**` | `#` | `log.component()` |\n| `systems/**` | `#` | `log.component()` |\n| `integrations/**` | `#` | `log.component()` |\n| `external/**` | `#` | `log.component()` |\n| `vendors/**` | `#` | `log.component()` |\n| `stores/**` | `#` | `log.component()` |\n| `state/**` | `#` | `log.component()` |\n| `reducers/**` | `#` | `log.component()` |\n| `config/**` | `#` | `log.component()` |\n| `middleware/**` | `^` | `log.gate()` |\n| `auth/**` | `^` | `log.gate()` |\n| `guards/**` | `^` | `log.gate()` |\n| `policies/**` | `^` | `log.gate()` |\n| `events/**` | `!` | `log.signal()` |\n| `handlers/**` | `!` | `log.signal()` |\n| `listeners/**` | `!` | `log.signal()` |\n| `hooks/**` | `!` | `log.signal()` |\n| `flows/**` | `$` | `log.flow()` |\n| `sagas/**` | `$` | `log.flow()` |\n| `workflows/**` | `$` | `log.flow()` |\n| `pipelines/**` | `$` | `log.flow()` |\n| `aspects/**` | `~` | `log.aspect()` |\n| `rules/**` | `~` | `log.aspect()` |\n| `constraints/**` | `~` | `log.aspect()` |\n\nSee `.paradigm/specs/logger.md` for full specification."},portal:{description:"Portal protocol \u2014 authorization, gates, portal.yaml structure and workflow",generate:()=>`# Portal Protocol (Authorization)
52
52
 
53
53
  **Portal.yaml is REQUIRED when the project has protected routes.**
54
54
 
@@ -414,4 +414,4 @@ components:
414
414
  | When | Tool | Purpose |
415
415
  |------|------|---------|
416
416
  | Starting any task | \`paradigm_pm_preflight\` | Get compliance plan |
417
- | Finishing any task | _(handled by stop hook)_ | Auto-checks compliance |`}};function ke(e){return Math.ceil(e.length/3.5)}function ne(){return [{uri:"paradigm://guidance",name:"Guidance Topics",description:"List all available on-demand guidance topics (logging, portal, flows, orchestration, etc.)",mimeType:"application/json"},{uri:"paradigm://guidance/{topic}",name:"Guidance Content",description:`Get guidance for a topic. Available: ${Object.keys(j).join(", ")}`,mimeType:"text/markdown"}]}async function ie(e,s){let n=`paradigm://${e}`;if(e==="guidance"){let t=Object.entries(j).map(([i,a])=>{let r=a.generate();return {name:i,description:a.description,tokens:ke(r)}}),o=JSON.stringify({count:t.length,totalTokens:t.reduce((i,a)=>i+a.tokens,0),note:"These guidance topics were previously baked into CLAUDE.md. Load on-demand to save context.",topics:t.map(i=>({...i,uri:`paradigm://guidance/${i.name}`}))},null,2);return b$1(o.length,n),{handled:true,text:o,mimeType:"application/json"}}if(e.startsWith("guidance/")&&e!=="guidance/"){let t=decodeURIComponent(e.replace("guidance/","")),o=j[t];if(!o){let a=Object.keys(j),r=JSON.stringify({error:`Unknown guidance topic: "${t}"`,available:a},null,2);return b$1(r.length,n),{handled:true,text:r,mimeType:"application/json"}}let i=o.generate();return b$1(i.length,n),{handled:true,text:i,mimeType:"text/markdown"}}return {handled:false,text:"",mimeType:"application/json"}}function ae(e,s){e.setRequestHandler(ListResourcesRequestSchema,async()=>({resources:[{uri:"paradigm://symbols",name:"All Symbols",description:"Overview of all Paradigm symbols in the project",mimeType:"application/json"},{uri:"paradigm://symbols/type/feature",name:"Features",description:"All @feature symbols",mimeType:"application/json"},{uri:"paradigm://symbols/type/component",name:"Components",description:"All #component symbols",mimeType:"application/json"},{uri:"paradigm://symbols/type/gate",name:"Gates",description:"All ^gate symbols (authorization)",mimeType:"application/json"},{uri:"paradigm://symbols/type/flow",name:"Flows",description:"All $flow symbols (processes)",mimeType:"application/json"},{uri:"paradigm://symbols/type/signal",name:"Signals",description:"All !signal symbols (events)",mimeType:"application/json"},{uri:"paradigm://symbols/type/state",name:"States",description:"All %state symbols",mimeType:"application/json"},{uri:"paradigm://gates",name:"Gates (Detailed)",description:"All gates with locks, keys, and prizes from portal.yaml",mimeType:"application/json"},{uri:"paradigm://flows",name:"Flows (Detailed)",description:"All flows with gate sequences",mimeType:"application/json"},...U(),...G(),...H(),...Y(),...X(),...te(),...ne()]})),e.setRequestHandler(ReadResourceRequestSchema,async n=>{let t=n.params.uri;if(!t?.startsWith("paradigm://"))throw new Error(`Unknown URI scheme: ${t}`);let o=s(),i=t.replace("paradigm://","");if(i==="symbols"){let a=p(o.index),r=q$1(o.index),d=JSON.stringify({project:o.projectName,counts:a,total:Object.values(a).reduce((p,k)=>p+k,0),symbols:r.map(p=>({symbol:p.symbol,type:p.type,description:p.description}))},null,2);return b$1(d.length,t),{contents:[{uri:t,mimeType:"application/json",text:d}]}}if(i.startsWith("symbol/")){let a=decodeURIComponent(i.replace("symbol/","")),r=k(o.index,a);if(!r){let p=JSON.stringify({error:"Symbol not found",symbol:a,available:q$1(o.index).filter(k=>k.symbol.includes(a.slice(1))).slice(0,5).map(k=>k.symbol)},null,2);return b$1(p.length,t),{contents:[{uri:t,mimeType:"application/json",text:p}]}}let d=JSON.stringify({symbol:r.symbol,type:r.type,description:r.description,filePath:r.filePath,references:r.references,referencedBy:r.referencedBy,tags:r.tags,data:r.data},null,2);return b$1(d.length,t),{contents:[{uri:t,mimeType:"application/json",text:d}]}}if(i.startsWith("symbols/type/")){let a=i.replace("symbols/type/",""),r=l$1(o.index,a),d=JSON.stringify({type:a,count:r.length,symbols:r.map(p=>({symbol:p.symbol,description:p.description,filePath:p.filePath,referencesCount:p.references.length,referencedByCount:p.referencedBy.length}))},null,2);return b$1(d.length,t),{contents:[{uri:t,mimeType:"application/json",text:d}]}}if(i==="gates"){let a=F(o),r=JSON.stringify({count:a.length,gates:a},null,2);return b$1(r.length,t),{contents:[{uri:t,mimeType:"application/json",text:r}]}}if(i==="flows"){let a=z(o),r=JSON.stringify({count:a.length,flows:a},null,2);return b$1(r.length,t),{contents:[{uri:t,mimeType:"application/json",text:r}]}}if(i.startsWith("wisdom/")){let a=await $(i,o);if(a.handled)return b$1(a.text.length),{contents:[{uri:t,mimeType:"application/json",text:a.text}]}}if(i.startsWith("history/")){let a=await q(i,o);if(a.handled)return b$1(a.text.length),{contents:[{uri:t,mimeType:"application/json",text:a.text}]}}if(i.startsWith("context/")){let a=await J(i);if(a.handled)return b$1(a.text.length),{contents:[{uri:t,mimeType:a.text.startsWith("#")?"text/markdown":"application/json",text:a.text}]}}if(i==="prompts"||i.startsWith("prompts/")){let a=await Q(i,o);if(a.handled)return {contents:[{uri:t,mimeType:a.mimeType,text:a.text}]}}if(i==="specs"||i.startsWith("specs/")){let a=await Z(i,o);if(a.handled)return {contents:[{uri:t,mimeType:a.mimeType,text:a.text}]}}if(i==="docs"||i.startsWith("docs/")){let a=await oe(i,o);if(a.handled)return {contents:[{uri:t,mimeType:a.mimeType,text:a.text}]}}if(i==="guidance"||i.startsWith("guidance/")){let a=await ie(i);if(a.handled)return {contents:[{uri:t,mimeType:a.mimeType,text:a.text}]}}throw new Error(`Unknown resource: ${i}`)});}b();t({warn:(e,s)=>a.component("#university-loader").warn(e,s)});var v=process.argv[2]||process.cwd(),_=null;function re(){if(!_)throw new Error("Project context not loaded");return _}async function Te(){_=await d(v),fa(v,_).catch(e=>{a.component("#paradigm-mcp").warn("Background reindex failed",{error:e.message});});}async function Se(){a.component("#paradigm-mcp").info("Loading project",{projectDir:v});try{_=await d(v),j$1().setRootDir(_.rootDir),a.component("#paradigm-mcp").info("Project loaded",{symbols:_.aggregation.symbols.length,project:_.projectName});}catch(n){a.component("#paradigm-mcp").error("Error loading project",{error:n.message}),process.exit(1);}g$1(v);let e=new Server({name:"paradigm",version:"0.1.0"},{capabilities:{resources:{},tools:{}}});ae(e,re),h(e,re,Te),e.onerror=n=>{a.component("#paradigm-mcp").error("Server error",{error:String(n)});};let s=new StdioServerTransport;await e.connect(s),a.component("#paradigm-mcp").info("Server running on stdio");}Se().catch(e=>{a.component("#paradigm-mcp").error("Fatal error",{error:e.message}),process.exit(1);});
417
+ | Finishing any task | _(handled by stop hook)_ | Auto-checks compliance |`}};function ke(e){return Math.ceil(e.length/3.5)}function ne(){return [{uri:"paradigm://guidance",name:"Guidance Topics",description:"List all available on-demand guidance topics (logging, portal, flows, orchestration, etc.)",mimeType:"application/json"},{uri:"paradigm://guidance/{topic}",name:"Guidance Content",description:`Get guidance for a topic. Available: ${Object.keys(j).join(", ")}`,mimeType:"text/markdown"}]}async function ie(e,s){let n=`paradigm://${e}`;if(e==="guidance"){let t=Object.entries(j).map(([i,a])=>{let r=a.generate();return {name:i,description:a.description,tokens:ke(r)}}),o=JSON.stringify({count:t.length,totalTokens:t.reduce((i,a)=>i+a.tokens,0),note:"These guidance topics were previously baked into CLAUDE.md. Load on-demand to save context.",topics:t.map(i=>({...i,uri:`paradigm://guidance/${i.name}`}))},null,2);return P(o.length,n),{handled:true,text:o,mimeType:"application/json"}}if(e.startsWith("guidance/")&&e!=="guidance/"){let t=decodeURIComponent(e.replace("guidance/","")),o=j[t];if(!o){let a=Object.keys(j),r=JSON.stringify({error:`Unknown guidance topic: "${t}"`,available:a},null,2);return P(r.length,n),{handled:true,text:r,mimeType:"application/json"}}let i=o.generate();return P(i.length,n),{handled:true,text:i,mimeType:"text/markdown"}}return {handled:false,text:"",mimeType:"application/json"}}function ae(e,s){e.setRequestHandler(ListResourcesRequestSchema,async()=>({resources:[{uri:"paradigm://symbols",name:"All Symbols",description:"Overview of all Paradigm symbols in the project",mimeType:"application/json"},{uri:"paradigm://symbols/type/feature",name:"Features",description:"All @feature symbols",mimeType:"application/json"},{uri:"paradigm://symbols/type/component",name:"Components",description:"All #component symbols",mimeType:"application/json"},{uri:"paradigm://symbols/type/gate",name:"Gates",description:"All ^gate symbols (authorization)",mimeType:"application/json"},{uri:"paradigm://symbols/type/flow",name:"Flows",description:"All $flow symbols (processes)",mimeType:"application/json"},{uri:"paradigm://symbols/type/signal",name:"Signals",description:"All !signal symbols (events)",mimeType:"application/json"},{uri:"paradigm://symbols/type/state",name:"States",description:"All %state symbols",mimeType:"application/json"},{uri:"paradigm://gates",name:"Gates (Detailed)",description:"All gates with locks, keys, and prizes from portal.yaml",mimeType:"application/json"},{uri:"paradigm://flows",name:"Flows (Detailed)",description:"All flows with gate sequences",mimeType:"application/json"},...U(),...G(),...H(),...Y(),...X(),...te(),...ne()]})),e.setRequestHandler(ReadResourceRequestSchema,async n=>{let t=n.params.uri;if(!t?.startsWith("paradigm://"))throw new Error(`Unknown URI scheme: ${t}`);let o=s(),i=t.replace("paradigm://","");if(i==="symbols"){let a=p(o.index),r=q$1(o.index),d=JSON.stringify({project:o.projectName,counts:a,total:Object.values(a).reduce((p,k)=>p+k,0),symbols:r.map(p=>({symbol:p.symbol,type:p.type,description:p.description}))},null,2);return P(d.length,t),{contents:[{uri:t,mimeType:"application/json",text:d}]}}if(i.startsWith("symbol/")){let a=decodeURIComponent(i.replace("symbol/","")),r=k(o.index,a);if(!r){let p=JSON.stringify({error:"Symbol not found",symbol:a,available:q$1(o.index).filter(k=>k.symbol.includes(a.slice(1))).slice(0,5).map(k=>k.symbol)},null,2);return P(p.length,t),{contents:[{uri:t,mimeType:"application/json",text:p}]}}let d=JSON.stringify({symbol:r.symbol,type:r.type,description:r.description,filePath:r.filePath,references:r.references,referencedBy:r.referencedBy,tags:r.tags,data:r.data},null,2);return P(d.length,t),{contents:[{uri:t,mimeType:"application/json",text:d}]}}if(i.startsWith("symbols/type/")){let a=i.replace("symbols/type/",""),r=l$1(o.index,a),d=JSON.stringify({type:a,count:r.length,symbols:r.map(p=>({symbol:p.symbol,description:p.description,filePath:p.filePath,referencesCount:p.references.length,referencedByCount:p.referencedBy.length}))},null,2);return P(d.length,t),{contents:[{uri:t,mimeType:"application/json",text:d}]}}if(i==="gates"){let a=F(o),r=JSON.stringify({count:a.length,gates:a},null,2);return P(r.length,t),{contents:[{uri:t,mimeType:"application/json",text:r}]}}if(i==="flows"){let a=z(o),r=JSON.stringify({count:a.length,flows:a},null,2);return P(r.length,t),{contents:[{uri:t,mimeType:"application/json",text:r}]}}if(i.startsWith("wisdom/")){let a=await $(i,o);if(a.handled)return P(a.text.length),{contents:[{uri:t,mimeType:"application/json",text:a.text}]}}if(i.startsWith("history/")){let a=await q(i,o);if(a.handled)return P(a.text.length),{contents:[{uri:t,mimeType:"application/json",text:a.text}]}}if(i.startsWith("context/")){let a=await J(i);if(a.handled)return P(a.text.length),{contents:[{uri:t,mimeType:a.text.startsWith("#")?"text/markdown":"application/json",text:a.text}]}}if(i==="prompts"||i.startsWith("prompts/")){let a=await Q(i,o);if(a.handled)return {contents:[{uri:t,mimeType:a.mimeType,text:a.text}]}}if(i==="specs"||i.startsWith("specs/")){let a=await Z(i,o);if(a.handled)return {contents:[{uri:t,mimeType:a.mimeType,text:a.text}]}}if(i==="docs"||i.startsWith("docs/")){let a=await oe(i,o);if(a.handled)return {contents:[{uri:t,mimeType:a.mimeType,text:a.text}]}}if(i==="guidance"||i.startsWith("guidance/")){let a=await ie(i);if(a.handled)return {contents:[{uri:t,mimeType:a.mimeType,text:a.text}]}}throw new Error(`Unknown resource: ${i}`)});}b();n({warn:(e,s)=>a.component("#university-loader").warn(e,s)});var v=process.argv[2]||process.cwd(),_=null;function re(){if(!_)throw new Error("Project context not loaded");return _}async function Te(){_=await i(v),p$1(v,_).catch(e=>{a.component("#paradigm-mcp").warn("Background reindex failed",{error:e.message});});}async function Se(){a.component("#paradigm-mcp").info("Loading project",{projectDir:v});try{_=await i(v),j$1().setRootDir(_.rootDir),a.component("#paradigm-mcp").info("Project loaded",{symbols:_.aggregation.symbols.length,project:_.projectName});}catch(n){a.component("#paradigm-mcp").error("Error loading project",{error:n.message}),process.exit(1);}a$1(v);let e=new Server({name:"paradigm",version:"0.1.0"},{capabilities:{resources:{},tools:{}}});ae(e,re),b$1(e,re,Te),e.onerror=n=>{a.component("#paradigm-mcp").error("Server error",{error:String(n)});};let s=new StdioServerTransport;await e.connect(s),a.component("#paradigm-mcp").info("Server running on stdio");}Se().catch(e=>{a.component("#paradigm-mcp").error("Fatal error",{error:e.message}),process.exit(1);});
@@ -48,7 +48,7 @@ component_types:
48
48
  `),{status:"applied",message:"Added component_types glossary to config.yaml",filesModified:[".paradigm/config.yaml"]}):{status:"error",message:"Cannot read config.yaml"}}},ue={id:"add-discipline-config",introducedIn:"3.4.0",description:"Add discipline field to config.yaml",category:"config",auto:true,async check(e){let t=A(e);return t?D(t,"discipline")?{needed:false,reason:"discipline already set"}:{needed:true,reason:"Missing discipline field"}:{needed:false,reason:"No config.yaml found"}},async apply(e,t){if(t.dryRun)return {status:"skipped",message:"Would add discipline to config.yaml"};let n=I(e);if(!n)return {status:"error",message:"Cannot read config.yaml"};let i=n.replace(/^(project:\s*.+)$/m,`$1
49
49
  discipline: auto`);return i===n?x(e,n.trimEnd()+`
50
50
  discipline: auto
51
- `):x(e,i),{status:"applied",message:"Added discipline: auto to config.yaml",filesModified:[".paradigm/config.yaml"]}}},fe={id:"sync-templates",introducedIn:"evergreen",description:"Update specs/ and docs/ from installed CLI templates",category:"template",auto:true,async check(e){let t=$();if(!t)return {needed:false,reason:"Templates directory not found"};let n=[],i=["specs","docs","prompts"];for(let r of i){let a=p.join(t,r),d=p.join(e,".paradigm",r);if(o.existsSync(a))try{let g=o.readdirSync(a).filter(m=>o.statSync(p.join(a,m)).isFile());for(let m of g)o.existsSync(p.join(d,m))||n.push(`${r}/${m}`);}catch{}}return n.length===0?{needed:false,reason:"All templates are up to date"}:{needed:true,reason:`${n.length} new template file(s) available`,details:n.map(r=>`New: ${r}`)}},async apply(e,t){let n=$();if(!n)return {status:"error",message:"Templates directory not found"};let i=p.basename(e),r=[],a=["specs","docs","prompts"];for(let d of a){let g=p.join(n,d),m=p.join(e,".paradigm",d);if(o.existsSync(g)){t.dryRun||o.mkdirSync(m,{recursive:true});try{let S=o.readdirSync(g,{withFileTypes:!0});for(let k of S){if(k.isDirectory())continue;let M=p.join(m,k.name);if(!o.existsSync(M)){if(t.dryRun){r.push(`${d}/${k.name}`);continue}let c=o.readFileSync(p.join(g,k.name),"utf8");c=c.replace(/\{\{PROJECT_NAME\}\}/g,i),o.writeFileSync(M,c,"utf8"),r.push(`${d}/${k.name}`);}}}catch{}}}return t.dryRun?{status:"skipped",message:`Would copy ${r.length} template file(s)`}:r.length===0?{status:"skipped",message:"No new templates to sync"}:{status:"applied",message:`Synced ${r.length} template file(s)`,filesCreated:r.map(d=>`.paradigm/${d}`)}}},me={id:"refresh-hooks",introducedIn:"evergreen",description:"Reinstall hook scripts from plugin",category:"hook",auto:true,async check(e){let t=[p.join(e,".claude","hooks"),p.join(e,".cursor","hooks")];for(let i of t)if(o.existsSync(i))try{if(o.readdirSync(i).some(a=>a.includes("paradigm")))return {needed:!1,reason:"Hooks are installed"}}catch{}let n=p.join(e,".claude","settings.local.json");if(o.existsSync(n))try{if(JSON.parse(o.readFileSync(n,"utf8")).hooks)return {needed:!1,reason:"Plugin-managed hooks are configured"}}catch{}return {needed:true,reason:"No paradigm hooks found"}},async apply(e,t){if(t.dryRun)return {status:"skipped",message:"Would reinstall hooks"};try{let{hooksInstallCommand:n}=await import('./hooks-45WDP6QS.js');return await n({force:!0}),{status:"applied",message:"Hooks reinstalled"}}catch(n){return {status:"error",message:`Hook install failed: ${n.message}`}}}},b=[Q,X,Z,ee,te,ne,se,ue,de,le,re,oe,ie,ae,ce,pe,ge,fe,me];var he=createRequire(import.meta.url),{version:W}=he("../package.json");function C(e){let t=p.join(e,".paradigm","migrate.yaml");if(!o.existsSync(t))return null;try{let n=o.readFileSync(t,"utf8");return F.load(n)}catch{return null}}async function V(e){let t=p.join(e,".paradigm"),n=C(e),i=n?.applied.map(l=>l.id)??[],r="unknown",a=p.join(t,"config.yaml");if(o.existsSync(a))try{let l=F.load(o.readFileSync(a,"utf8"));r=String(l.version??"unknown");}catch{}let g=["specs","docs","prompts","lore","tasks","protocols","personas"].filter(l=>!o.existsSync(p.join(t,l))),m=["discipline","tag-bank","purpose-required","component_types"],S=[];if(o.existsSync(a))try{let l=F.load(o.readFileSync(a,"utf8"));S=m.filter(h=>{let j=h.replace(/-/g,"_");return !(h in l)&&!(j in l)&&!(h.replace(/_/g,"-")in l)});}catch{}let k=[],M=$();if(M){let l=["specs","docs"];for(let h of l){let j=p.join(M,h),L=p.join(t,h);if(o.existsSync(j)&&o.existsSync(L)){let J=o.readdirSync(j).filter(R=>!o.statSync(p.join(j,R)).isDirectory());for(let R of J){let Y=p.join(L,R);o.existsSync(Y)||k.push(`${h}/${R}`);}}}}let c=!o.existsSync(p.join(e,".claude","hooks")),u=[];for(let l of b){let h=l.introducedIn==="evergreen";if(i.includes(l.id)&&!h)continue;(await l.check(e)).needed&&u.push(l);}return {configVersion:r,cliVersion:W,pendingMigrations:u,appliedIds:i,health:{missingDirectories:g,missingConfigFields:S,staleTemplates:k,hooksOutdated:c}}}async function U(e){let t=[],n=new Date().toISOString();for(let i of b){if(i.introducedIn==="evergreen")continue;(await i.check(e)).needed||t.push({id:i.id,appliedAt:n,cliVersion:W});}return t}function $(){let e=new URL(import.meta.url).pathname,t=p.dirname(e),n=[p.join(t,"..","..","..","templates","paradigm"),p.join(t,"..","..","templates","paradigm"),p.join(t,"..","templates","paradigm")];for(let i of n)if(o.existsSync(i))return i;return null}var ke=createRequire(import.meta.url),{version:N}=ke("../package.json");async function B(e){let t=C(e);if(t)return t;let n=await U(e);return {version:"1.0",cliVersion:N,lastMigrated:new Date().toISOString(),applied:n}}function _(e,t){let n=p.join(e,".paradigm","migrate.yaml");o.mkdirSync(p.dirname(n),{recursive:true}),t.cliVersion=N,t.lastMigrated=new Date().toISOString(),o.writeFileSync(n,F.dump(t,{indent:2,lineWidth:120,noRefs:true,sortKeys:false,quotingType:'"'}),"utf8");}async function E(e,t,n,i){let r={applied:0,skipped:0,errors:0,manual:0,results:[]},a=new Date().toISOString();for(let d of t){if(!d.auto){r.manual++,r.results.push({id:d.id,result:{status:"skipped",message:"Manual review recommended"}});continue}try{let g=await d.apply(e,n);r.results.push({id:d.id,result:g}),g.status==="applied"?(r.applied++,i.applied.push({id:d.id,appliedAt:a,cliVersion:N})):g.status==="skipped"?r.skipped++:r.errors++;}catch(g){r.errors++,r.results.push({id:d.id,result:{status:"error",message:g.message}});}}return r}async function _e(e={}){let t=process.cwd(),n=p.join(t,".paradigm");if((!o.existsSync(n)||!o.statSync(n).isDirectory())&&!(o.existsSync(n)&&o.statSync(n).isFile())){e.quiet||console.log(s.yellow("\n No .paradigm/ directory found. Run `paradigm init` or `paradigm shift` first.\n"));return}let i=we();e.quiet||i.start("Detecting project state...");let r=await V(t);e.quiet||i.stop();let a=await B(t),d=r.pendingMigrations;if(e.only&&e.only.length>0&&(d=d.filter(c=>e.only.includes(c.id))),e.category&&(d=d.filter(c=>c.category===e.category)),e.force){let c=e.only?b.filter(u=>e.only.includes(u.id)):e.category?b.filter(u=>u.category===e.category):b;d=[];for(let u of c)((await u.check(t)).needed||e.force)&&d.push(u);}let g=d.filter(c=>c.auto),m=d.filter(c=>!c.auto);if(e.list){Me(a,r,e);return}if(e.quiet){if(g.length===0)return;let c=await E(t,g,e,a);return _(t,a),c}let S=C(t);if(console.log(s.blue(`
51
+ `):x(e,i),{status:"applied",message:"Added discipline: auto to config.yaml",filesModified:[".paradigm/config.yaml"]}}},fe={id:"sync-templates",introducedIn:"evergreen",description:"Update specs/ and docs/ from installed CLI templates",category:"template",auto:true,async check(e){let t=$();if(!t)return {needed:false,reason:"Templates directory not found"};let n=[],i=["specs","docs","prompts"];for(let r of i){let a=p.join(t,r),d=p.join(e,".paradigm",r);if(o.existsSync(a))try{let g=o.readdirSync(a).filter(m=>o.statSync(p.join(a,m)).isFile());for(let m of g)o.existsSync(p.join(d,m))||n.push(`${r}/${m}`);}catch{}}return n.length===0?{needed:false,reason:"All templates are up to date"}:{needed:true,reason:`${n.length} new template file(s) available`,details:n.map(r=>`New: ${r}`)}},async apply(e,t){let n=$();if(!n)return {status:"error",message:"Templates directory not found"};let i=p.basename(e),r=[],a=["specs","docs","prompts"];for(let d of a){let g=p.join(n,d),m=p.join(e,".paradigm",d);if(o.existsSync(g)){t.dryRun||o.mkdirSync(m,{recursive:true});try{let S=o.readdirSync(g,{withFileTypes:!0});for(let k of S){if(k.isDirectory())continue;let M=p.join(m,k.name);if(!o.existsSync(M)){if(t.dryRun){r.push(`${d}/${k.name}`);continue}let c=o.readFileSync(p.join(g,k.name),"utf8");c=c.replace(/\{\{PROJECT_NAME\}\}/g,i),o.writeFileSync(M,c,"utf8"),r.push(`${d}/${k.name}`);}}}catch{}}}return t.dryRun?{status:"skipped",message:`Would copy ${r.length} template file(s)`}:r.length===0?{status:"skipped",message:"No new templates to sync"}:{status:"applied",message:`Synced ${r.length} template file(s)`,filesCreated:r.map(d=>`.paradigm/${d}`)}}},me={id:"refresh-hooks",introducedIn:"evergreen",description:"Reinstall hook scripts from plugin",category:"hook",auto:true,async check(e){let t=[p.join(e,".claude","hooks"),p.join(e,".cursor","hooks")];for(let i of t)if(o.existsSync(i))try{if(o.readdirSync(i).some(a=>a.includes("paradigm")))return {needed:!1,reason:"Hooks are installed"}}catch{}let n=p.join(e,".claude","settings.local.json");if(o.existsSync(n))try{if(JSON.parse(o.readFileSync(n,"utf8")).hooks)return {needed:!1,reason:"Plugin-managed hooks are configured"}}catch{}return {needed:true,reason:"No paradigm hooks found"}},async apply(e,t){if(t.dryRun)return {status:"skipped",message:"Would reinstall hooks"};try{let{hooksInstallCommand:n}=await import('./hooks-AXBWYJ5V.js');return await n({force:!0}),{status:"applied",message:"Hooks reinstalled"}}catch(n){return {status:"error",message:`Hook install failed: ${n.message}`}}}},b=[Q,X,Z,ee,te,ne,se,ue,de,le,re,oe,ie,ae,ce,pe,ge,fe,me];var he=createRequire(import.meta.url),{version:W}=he("../package.json");function C(e){let t=p.join(e,".paradigm","migrate.yaml");if(!o.existsSync(t))return null;try{let n=o.readFileSync(t,"utf8");return F.load(n)}catch{return null}}async function V(e){let t=p.join(e,".paradigm"),n=C(e),i=n?.applied.map(l=>l.id)??[],r="unknown",a=p.join(t,"config.yaml");if(o.existsSync(a))try{let l=F.load(o.readFileSync(a,"utf8"));r=String(l.version??"unknown");}catch{}let g=["specs","docs","prompts","lore","tasks","protocols","personas"].filter(l=>!o.existsSync(p.join(t,l))),m=["discipline","tag-bank","purpose-required","component_types"],S=[];if(o.existsSync(a))try{let l=F.load(o.readFileSync(a,"utf8"));S=m.filter(h=>{let j=h.replace(/-/g,"_");return !(h in l)&&!(j in l)&&!(h.replace(/_/g,"-")in l)});}catch{}let k=[],M=$();if(M){let l=["specs","docs"];for(let h of l){let j=p.join(M,h),L=p.join(t,h);if(o.existsSync(j)&&o.existsSync(L)){let J=o.readdirSync(j).filter(R=>!o.statSync(p.join(j,R)).isDirectory());for(let R of J){let Y=p.join(L,R);o.existsSync(Y)||k.push(`${h}/${R}`);}}}}let c=!o.existsSync(p.join(e,".claude","hooks")),u=[];for(let l of b){let h=l.introducedIn==="evergreen";if(i.includes(l.id)&&!h)continue;(await l.check(e)).needed&&u.push(l);}return {configVersion:r,cliVersion:W,pendingMigrations:u,appliedIds:i,health:{missingDirectories:g,missingConfigFields:S,staleTemplates:k,hooksOutdated:c}}}async function U(e){let t=[],n=new Date().toISOString();for(let i of b){if(i.introducedIn==="evergreen")continue;(await i.check(e)).needed||t.push({id:i.id,appliedAt:n,cliVersion:W});}return t}function $(){let e=new URL(import.meta.url).pathname,t=p.dirname(e),n=[p.join(t,"..","..","..","templates","paradigm"),p.join(t,"..","..","templates","paradigm"),p.join(t,"..","templates","paradigm")];for(let i of n)if(o.existsSync(i))return i;return null}var ke=createRequire(import.meta.url),{version:N}=ke("../package.json");async function B(e){let t=C(e);if(t)return t;let n=await U(e);return {version:"1.0",cliVersion:N,lastMigrated:new Date().toISOString(),applied:n}}function _(e,t){let n=p.join(e,".paradigm","migrate.yaml");o.mkdirSync(p.dirname(n),{recursive:true}),t.cliVersion=N,t.lastMigrated=new Date().toISOString(),o.writeFileSync(n,F.dump(t,{indent:2,lineWidth:120,noRefs:true,sortKeys:false,quotingType:'"'}),"utf8");}async function E(e,t,n,i){let r={applied:0,skipped:0,errors:0,manual:0,results:[]},a=new Date().toISOString();for(let d of t){if(!d.auto){r.manual++,r.results.push({id:d.id,result:{status:"skipped",message:"Manual review recommended"}});continue}try{let g=await d.apply(e,n);r.results.push({id:d.id,result:g}),g.status==="applied"?(r.applied++,i.applied.push({id:d.id,appliedAt:a,cliVersion:N})):g.status==="skipped"?r.skipped++:r.errors++;}catch(g){r.errors++,r.results.push({id:d.id,result:{status:"error",message:g.message}});}}return r}async function _e(e={}){let t=process.cwd(),n=p.join(t,".paradigm");if((!o.existsSync(n)||!o.statSync(n).isDirectory())&&!(o.existsSync(n)&&o.statSync(n).isFile())){e.quiet||console.log(s.yellow("\n No .paradigm/ directory found. Run `paradigm init` or `paradigm shift` first.\n"));return}let i=we();e.quiet||i.start("Detecting project state...");let r=await V(t);e.quiet||i.stop();let a=await B(t),d=r.pendingMigrations;if(e.only&&e.only.length>0&&(d=d.filter(c=>e.only.includes(c.id))),e.category&&(d=d.filter(c=>c.category===e.category)),e.force){let c=e.only?b.filter(u=>e.only.includes(u.id)):e.category?b.filter(u=>u.category===e.category):b;d=[];for(let u of c)((await u.check(t)).needed||e.force)&&d.push(u);}let g=d.filter(c=>c.auto),m=d.filter(c=>!c.auto);if(e.list){Me(a,r,e);return}if(e.quiet){if(g.length===0)return;let c=await E(t,g,e,a);return _(t,a),c}let S=C(t);if(console.log(s.blue(`
52
52
  \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510`)),console.log(s.blue("\u2502")+s.white.bold(" paradigm migrate ")+s.blue("\u2502")),console.log(s.blue("\u2502")+s.gray(" Bring your project up to date ")+s.blue("\u2502")),console.log(s.blue(`\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518
53
53
  `)),console.log(s.white(` Project: ${s.cyan(p.basename(t))}`)),console.log(s.white(` Config version: ${s.cyan(r.configVersion)}`)),console.log(s.white(` CLI version: ${s.cyan(r.cliVersion)}`)),console.log(s.white(` Last migrated: ${s.cyan(S?.lastMigrated??"never")}`)),console.log(""),d.length===0){console.log(s.green(` All migrations are up to date.
54
54
  `)),S||(_(t,a),e.verbose&&console.log(s.gray(` Created .paradigm/migrate.yaml with bootstrap state.
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- import {v}from'./chunk-4N56FRNE.js';export{o as adjustAttentionFromFeedback,u as applySurfacingRules,s as autoPromoteJournalEntries,g as detectDebates,n as emitAndProcess,k as engageNomination,r as forwardNominationsToRelay,q as getNeverlandMetrics,p as getNominationStats,j as loadDebates,i as loadNominations,t as loadSurfacingConfig,h as persistNominations,f as processEvent,m as processPendingEvents,l as resolveDebate}from'./chunk-4N56FRNE.js';import'./chunk-3KVVC4WV.js';import'./chunk-KAFQA7HV.js';import'./chunk-EK4ZRIFJ.js';import'./chunk-QGZRM6ZB.js';import'./chunk-K7X3Z3GL.js';import'./chunk-5TAVYPOV.js';v();
2
+ import {v}from'./chunk-FRQRREJ6.js';export{o as adjustAttentionFromFeedback,u as applySurfacingRules,s as autoPromoteJournalEntries,g as detectDebates,n as emitAndProcess,k as engageNomination,r as forwardNominationsToRelay,q as getNeverlandMetrics,p as getNominationStats,j as loadDebates,i as loadNominations,t as loadSurfacingConfig,h as persistNominations,f as processEvent,m as processPendingEvents,l as resolveDebate}from'./chunk-FRQRREJ6.js';import'./chunk-3KVVC4WV.js';import'./chunk-QEQCPVF5.js';import'./chunk-KAFQA7HV.js';import'./chunk-EK4ZRIFJ.js';import'./chunk-QGZRM6ZB.js';import'./chunk-5TAVYPOV.js';v();
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import {i}from'./chunk-QEQCPVF5.js';export{e as addNotebookEntry,d as classifyNotebookScope,g as incrementApplied,b as loadNotebookEntries,a as normalizeConcept,f as promoteFromLore,c as searchNotebooks}from'./chunk-QEQCPVF5.js';import'./chunk-5TAVYPOV.js';i();
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env node
2
+ import {a,b}from'./chunk-6AKNXD22.js';import'./chunk-DLMDHS2X.js';import'./chunk-FYDRENK7.js';import'./chunk-ECLUYHAR.js';import'./chunk-TYWB5IQJ.js';import {e}from'./chunk-YXLGVOZO.js';import {d,c}from'./chunk-EKZDFEJW.js';import'./chunk-LPBCQM5Y.js';import'./chunk-4GC35IFF.js';import'./chunk-JIXHEBGK.js';import'./chunk-ZJQY5PPP.js';import'./chunk-5TAVYPOV.js';import*as S from'path';import o from'chalk';import O from'ora';async function I(e$1,s,t){let i=s?S.resolve(s):process.cwd();if(!e$1){t.json?console.log(JSON.stringify({error:"Task is required"})):(console.log(o.red(`
3
+ Task is required.`)),console.log(o.gray(`Example: paradigm team orchestrate "Build @payment-system with Stripe"
4
+ `)));return}if(!e(i)){t.json?console.log(JSON.stringify({error:"Team not configured"})):console.log(o.yellow("\nTeam not configured. Run `paradigm team init` first.\n"));return}let f="faceted";t.solo&&(f="solo"),t.faceted&&(f="faceted");let g;if(t.budget){let n=t.budget.split(",");g={};for(let l of n){let[r,a]=l.split("=");r==="tokens"&&(g.maxTokens=parseInt(a)),r==="cost"&&(g.maxCostUsd=parseFloat(a)),r==="warn"&&(g.warnAtPercent=parseInt(a));}}let c=O({text:"Initializing orchestrator...",isSilent:t.quiet||t.json}).start(),y=new a(i);try{await y.initialize();}catch(n){c.fail("Failed to initialize orchestrator"),t.json?console.log(JSON.stringify({error:n instanceof Error?n.message:String(n)})):console.log(o.red(`
5
+ Error: ${n instanceof Error?n.message:n}
6
+ `));return}if(t.background){c.text="Starting background orchestration...";let n=new b(i),l=t.notify?t.notify.split(",").filter(a=>["bell","desktop","file","webhook"].includes(a)):["bell"],r=await n.startBackground(e$1,{mode:f,orchestratorModel:t.model,budget:g,notify:true,notifyMethods:l});if(c.stop(),t.json){console.log(JSON.stringify({id:r.id,status:r.status,outputFile:r.outputFile,task:r.task},null,2));return}T(r);return}if(t.compare){c.text="Running comparison (solo vs faceted)...";let n=await y.compare(e$1,{orchestratorModel:t.model,budget:g,checkpoints:t.checkpoint?{beforeAgentSpawn:true,afterAgentComplete:true}:void 0,onAgentStart:(l,r,a)=>{if(!t.quiet&&!t.json){let p=`${l} (${a})`;c.text=`${p}: ${r.slice(0,50)}...`;}}});if(c.stop(),t.json){console.log(JSON.stringify(n,null,2));return}C(n);return}if(!t.quiet&&!t.json){let n=f==="solo"?"Solo":"Faceted";c.text=`Orchestrating (${n} mode)...`;}let $=await y.orchestrate(e$1,{mode:f,orchestratorModel:t.model,budget:g,checkpoints:t.checkpoint?{beforeAgentSpawn:true}:void 0,pmGovernance:t.pm?{enabled:true,blockOnViolations:true}:void 0,onMessage:(n,l)=>{t.json||t.quiet||t.live&&l.type==="text"&&process.stdout.write(o.gray(`[${n}] `)+l.content);},onAgentStart:(n,l,r)=>{if(t.json||t.quiet)return;let a=`${n} (${r})`;t.live?console.log(o.cyan(`
7
+ \u25B6 ${a}: ${l}`)):c.text=`${a}: ${l.slice(0,50)}...`;},onAgentComplete:(n,l,r)=>{if(!(t.json||t.quiet)&&t.live){let a=l.success?o.green("\u2713"):o.red("\u2717"),p=l.relay?d(l.relay.metrics.tokens_used.total):"0",w=`${n} (${r})`;console.log(`${a} ${w} completed (${p})`);}},onCheckpoint:async n=>t.checkpoint?(c.stop(),console.log(o.yellow(`
8
+ \u26A0 Checkpoint: ${n}`)),console.log(o.gray("Press Enter to continue, or Ctrl+C to abort...")),new Promise(l=>{process.stdin.once("data",()=>{c.start(),l(true);});})):true});if(c.stop(),t.json){console.log(JSON.stringify($,null,2));return}v($);}function v(e){if(console.log(),console.log(o.blue("\u2501".repeat(60))),console.log(o.blue(` Orchestration ${e.success?"Complete":"Failed"}`)),console.log(o.blue("\u2501".repeat(60))),console.log(),console.log(o.white(` Task: ${e.task.slice(0,50)}${e.task.length>50?"...":""}`)),console.log(o.gray(` Mode: ${e.mode}`)),console.log(o.gray(` ID: ${e.orchestrationId}`)),console.log(),e.success?console.log(o.green(" \u2713 Success")):console.log(o.red(` \u2717 Failed: ${e.error||"Unknown error"}`)),console.log(),console.log(o.cyan(" Metrics:")),console.log(o.gray(` Agents spawned: ${e.agentsSpawned}`)),console.log(o.gray(` Total tokens: ${d(e.totalTokens.total)}`)),console.log(o.gray(` Total cost: ${c(e.totalCost)}`)),console.log(o.gray(` Duration: ${(e.duration_ms/1e3).toFixed(1)}s`)),console.log(),e.iterationOutcome){let s=e.iterationOutcome;if(console.log(o.cyan(" Re-review loop:")),s.converged)console.log(o.green(` \u2713 Converged after ${s.roundsRun} round${s.roundsRun===1?"":"s"}`));else {console.log(o.yellow(` \u26A0 Unresolved after ${s.roundsRun} round${s.roundsRun===1?"":"s"} (non-blocking)`));for(let t of s.openThreads.slice(0,5))console.log(o.gray(` - ${t}`));}console.log();}if(e.agentResults.length>0){console.log(o.cyan(" Agents:"));for(let s of e.agentResults){let t=s.success?o.green("\u2713"):o.red("\u2717"),i=s.relay?d(s.relay.metrics.tokens_used.total):"0",u=s.relay?`${(s.relay.metrics.duration_ms/1e3).toFixed(1)}s`:"0s";console.log(o.gray(` ${t} ${s.relay?.agent||"unknown"}: ${i} (${u})`));}console.log();}if(e.complianceReport){console.log(o.cyan(" PM Compliance:"));let s=e.complianceReport.postflight;if(s){let t=s.status==="pass"?o.green("\u2713"):s.status==="warnings"?o.yellow("\u26A0"):o.red("\u2717");if(console.log(o.gray(` Status: ${t} ${s.status}`)),console.log(o.gray(` Checks: ${s.summary.passed}/${s.summary.totalChecks} passed`)),s.summary.errors>0&&console.log(o.red(` Errors: ${s.summary.errors}`)),s.summary.warnings>0&&console.log(o.yellow(` Warnings: ${s.summary.warnings}`)),s.violations.length>0)for(let i of s.violations.slice(0,5)){let u=i.severity==="error"?o.red("\u2717"):o.yellow("\u26A0");console.log(o.gray(` ${u} ${i.message}`));}}console.log();}e.log&&console.log(o.gray(` Log: .paradigm/orchestrations/${e.log.started.slice(0,10)}-*.yaml`)),console.log();}function C(e){console.log(),console.log(o.blue("\u2501".repeat(60))),console.log(o.blue(" A/B Comparison: Solo vs Faceted")),console.log(o.blue("\u2501".repeat(60))),console.log(),console.log(o.cyan(" Results:")),console.log(o.gray(" \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510")),console.log(o.gray(" \u2502 \u2502 Solo \u2502 Faceted \u2502")),console.log(o.gray(" \u251C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524"));let s=e.solo.success?o.green("\u2713 Success"):o.red("\u2717 Failed"),t=e.faceted.success?o.green("\u2713 Success"):o.red("\u2717 Failed");console.log(o.gray(` \u2502 Status \u2502 ${s.padEnd(21)} \u2502 ${t.padEnd(21)} \u2502`));let i=d(e.solo.totalTokens.total).padStart(10),u=d(e.faceted.totalTokens.total).padStart(10);console.log(o.gray(` \u2502 Tokens \u2502 ${i} \u2502 ${u} \u2502`));let f=c(e.solo.totalCost).padStart(10),g=c(e.faceted.totalCost).padStart(10);console.log(o.gray(` \u2502 Cost \u2502 ${f} \u2502 ${g} \u2502`));let c$1=`${(e.solo.duration_ms/1e3).toFixed(1)}s`.padStart(10),y=`${(e.faceted.duration_ms/1e3).toFixed(1)}s`.padStart(10);console.log(o.gray(` \u2502 Duration \u2502 ${c$1} \u2502 ${y} \u2502`));let $=`${e.solo.agentsSpawned}`.padStart(10),n=`${e.faceted.agentsSpawned}`.padStart(10);console.log(o.gray(` \u2502 Agents \u2502 ${$} \u2502 ${n} \u2502`)),console.log(o.gray(" \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518")),console.log();let{winner:l,tokensSaved:r,costDiff:a}=e.comparison;l==="tie"?console.log(o.yellow(" \u2696 Result: Tie")):l==="faceted"?(console.log(o.green(" \u{1F3C6} Winner: Faceted")),a>0&&console.log(o.gray(` Saved ${c(a)} (${d(Math.abs(r))} tokens)`))):(console.log(o.green(" \u{1F3C6} Winner: Solo")),a<0&&console.log(o.gray(` Saved ${c(Math.abs(a))} (${d(Math.abs(r))} tokens)`))),console.log(),console.log(o.cyan(" Recommendation:")),l==="faceted"?(console.log(o.gray(" Use --faceted (default) for this type of task.")),console.log(o.gray(" Multi-agent orchestration is more cost-effective."))):l==="solo"?(console.log(o.gray(" Use --solo for this type of task.")),console.log(o.gray(" Single agent is simpler and cheaper here."))):(console.log(o.gray(" Both approaches work similarly for this task.")),console.log(o.gray(" Default to --faceted for complex tasks, --solo for simple ones."))),console.log();}function T(e){console.log(),console.log(o.blue("\u2501".repeat(60))),console.log(o.blue(" Orchestration started in background")),console.log(o.blue("\u2501".repeat(60))),console.log(),console.log(o.white(` ID: ${e.id}`)),console.log(o.gray(` Task: ${e.task.slice(0,50)}${e.task.length>50?"...":""}`)),console.log(o.gray(` Mode: ${e.mode}`)),console.log(o.gray(` Status: ${e.status}`)),console.log(),console.log(o.cyan(" Commands:")),console.log(o.gray(` Monitor: paradigm team status ${e.id}`)),console.log(o.gray(` Logs: tail -f ${e.outputFile}`)),console.log(o.gray(` Diff: paradigm team diff ${e.id}`)),console.log(o.gray(` Accept: paradigm team accept ${e.id}`)),console.log();}export{I as teamOrchestrateCommand};
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export{c as classifyTaskLocal,f as emitTaskDag,a as getOrchestrationToolsList,b as handleOrchestrationTool,e as loadAgentsManifest,g as planBuilderStages,d as suggestAgentsForTask}from'./chunk-S4J337EQ.js';import'./chunk-K54L6CFR.js';import'./chunk-QBIQ2FYB.js';import'./chunk-Q527BPUF.js';import'./chunk-RGSFU2YW.js';import'./chunk-TMDPDIWA.js';import'./chunk-KLBH26PA.js';import'./chunk-GRZQIKST.js';import'./chunk-KAFQA7HV.js';import'./chunk-ACJWUOMA.js';import'./chunk-33ERV2MW.js';import'./chunk-EK4ZRIFJ.js';import'./chunk-5TAVYPOV.js';
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export{a as getProposeBlockToolsList,b as handleProposeBlockTool}from'./chunk-B5KLSBOZ.js';import'./chunk-5TAVYPOV.js';
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import {c,e as e$1,b as b$1,d}from'./chunk-HXGYVS2N.js';import'./chunk-5TAVYPOV.js';import*as f from'path';import e from'chalk';async function b(t,r){let s=t?f.resolve(t):process.cwd();if(r.set){try{await c(r.set,s),r.json?console.log(JSON.stringify({success:!0,provider:r.set})):(console.log(e.green(`
2
+ import {c,e as e$1,b as b$1,d}from'./chunk-ECLUYHAR.js';import'./chunk-5TAVYPOV.js';import*as f from'path';import e from'chalk';async function b(t,r){let s=t?f.resolve(t):process.cwd();if(r.set){try{await c(r.set,s),r.json?console.log(JSON.stringify({success:!0,provider:r.set})):(console.log(e.green(`
3
3
  \u2713 Provider set to: ${r.set}
4
4
  `)),r.set==="auto"?console.log(e.gray(`Will auto-detect best available provider.
5
5
  `)):console.log(e.gray(`Will use ${r.set} if available, otherwise fall back.
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export{n as getReindexToolsList,o as handleReindexTool,p as rebuildStaticFiles}from'./chunk-WROJSWAO.js';import'./chunk-QBIQ2FYB.js';import'./chunk-M4UMM6DC.js';import'./chunk-TMDPDIWA.js';import'./chunk-GRZQIKST.js';import'./chunk-ACJWUOMA.js';import'./chunk-33ERV2MW.js';import'./chunk-EK4ZRIFJ.js';import'./chunk-5TAVYPOV.js';
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import'./chunk-5TAVYPOV.js';import o from'chalk';async function i(e){let n=process.cwd(),t=parseInt(e.port||"3850",10),s=e.open!==false,a=e.sections?e.sections.split(",").map(r=>r.trim()):void 0;console.log(o.cyan(`
3
3
  Starting Paradigm Platform...
4
- `));try{let{startPlatformServer:r}=await import('./platform-server-ANOALDPL.js');await r({port:t,projectDir:n,open:s,sections:a}),console.log(o.green(` Platform running at ${o.bold(`http://localhost:${t}`)}`)),console.log(o.gray(` Press Ctrl+C to stop
4
+ `));try{let{startPlatformServer:r}=await import('./platform-server-WIBVYHIV.js');await r({port:t,projectDir:n,open:s,sections:a}),console.log(o.green(` Platform running at ${o.bold(`http://localhost:${t}`)}`)),console.log(o.gray(` Press Ctrl+C to stop
5
5
  `)),await new Promise(()=>{});}catch(r){r.code==="EADDRINUSE"?(console.error(o.red(`
6
6
  Error: Port ${t} is already in use.`)),console.log(o.gray(` Try: paradigm serve --port ${t+1}
7
7
  `))):console.error(o.red(`
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export{i as MODEL_PRICING,j as getSessionTracker,k as resetSessionTracker}from'./chunk-ACJWUOMA.js';import'./chunk-33ERV2MW.js';import'./chunk-EK4ZRIFJ.js';import'./chunk-5TAVYPOV.js';
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export{a as appendSessionWorkEntry,d as appendVerdictEntry,n as clearActivityMetrics,c as clearSessionWorkLog,q as countNotebookReferences,j as getAgentEntries,k as getAgentVerdicts,i as getContributingAgents,p as getNotebookReferences,m as getSessionActivitySummary,h as markIterationRevisionsConsumed,f as markVerdictsConsumed,g as readPendingIterationRevisions,e as readPendingVerdicts,b as readSessionWorkLog,l as recordActivityMetric,o as recordNotebookReference}from'./chunk-V6MIKLMY.js';import'./chunk-5TAVYPOV.js';
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import {s}from'./chunk-33ERV2MW.js';export{a as appendSessionWorkEntry,d as appendVerdictEntry,n as clearActivityMetrics,c as clearSessionWorkLog,q as countNotebookReferences,j as getAgentEntries,k as getAgentVerdicts,i as getContributingAgents,p as getNotebookReferences,m as getSessionActivitySummary,h as markIterationRevisionsConsumed,f as markVerdictsConsumed,g as readPendingIterationRevisions,e as readPendingVerdicts,b as readSessionWorkLog,l as recordActivityMetric,o as recordNotebookReference}from'./chunk-33ERV2MW.js';import'./chunk-5TAVYPOV.js';s();
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import {a as a$5,d as d$3,b as b$2,e as e$1,f}from'./chunk-Z72SDTBJ.js';import {b}from'./chunk-XKNJSPB5.js';import'./chunk-MU5YWTNE.js';import'./chunk-TYWB5IQJ.js';import'./chunk-AMLD7IYC.js';import'./chunk-FYDRENK7.js';import'./chunk-HXGYVS2N.js';import {d as d$2}from'./chunk-TQOT2LBO.js';import'./chunk-Y4XFVDZC.js';import {a as a$7}from'./chunk-5RFISGUW.js';import {d as d$1}from'./chunk-S3UVQ5RV.js';import {a as a$4,b as b$1}from'./chunk-GE3GQALR.js';import {a as a$8}from'./chunk-XQLO5URP.js';import'./chunk-EKZDFEJW.js';import {a as a$2}from'./chunk-QDP4G53M.js';import {b as b$3}from'./chunk-MBSY57RN.js';import'./chunk-4TXOVRWD.js';import'./chunk-VCKKJDLP.js';import'./chunk-WR6D3SC6.js';import {a as a$3}from'./chunk-UIKLE3WD.js';import {a as a$6}from'./chunk-UZ5H7K6Q.js';import'./chunk-LPBCQM5Y.js';import'./chunk-4GC35IFF.js';import'./chunk-JIXHEBGK.js';import'./chunk-ZJQY5PPP.js';import'./chunk-YNDPSWOE.js';import'./chunk-VIG5LSGZ.js';import {a as a$1}from'./chunk-LKAT7IAK.js';import'./chunk-5TAVYPOV.js';import*as a from'fs';import*as ne from'os';import*as d from'path';import e from'chalk';import Se from'ora';import*as h from'js-yaml';import*as C from'fs/promises';var ae=[{path:".paradigm/config.yaml",defaultContent:['version: "2.0"','project: ""','description: ""','initialized: ""'].join(`
2
+ import {a as a$5,d as d$3,b as b$2,e as e$1,f}from'./chunk-Z72SDTBJ.js';import {a as a$4,b as b$1}from'./chunk-GE3GQALR.js';import {b}from'./chunk-JCGCPAHF.js';import'./chunk-6AKNXD22.js';import'./chunk-DLMDHS2X.js';import'./chunk-FYDRENK7.js';import'./chunk-ECLUYHAR.js';import'./chunk-TYWB5IQJ.js';import {d as d$2}from'./chunk-YXLGVOZO.js';import'./chunk-Y4XFVDZC.js';import {a as a$7}from'./chunk-G6DK3ND3.js';import {d as d$1}from'./chunk-S3UVQ5RV.js';import {a as a$8}from'./chunk-ZSWXLFN7.js';import'./chunk-EKZDFEJW.js';import {a as a$2}from'./chunk-QDP4G53M.js';import {b as b$3}from'./chunk-MBSY57RN.js';import'./chunk-4TXOVRWD.js';import'./chunk-VCKKJDLP.js';import'./chunk-WR6D3SC6.js';import {a as a$3}from'./chunk-UIKLE3WD.js';import {a as a$6}from'./chunk-UZ5H7K6Q.js';import'./chunk-LPBCQM5Y.js';import'./chunk-4GC35IFF.js';import'./chunk-JIXHEBGK.js';import'./chunk-ZJQY5PPP.js';import'./chunk-YNDPSWOE.js';import'./chunk-VIG5LSGZ.js';import {a as a$1}from'./chunk-LKAT7IAK.js';import'./chunk-5TAVYPOV.js';import*as a from'fs';import*as ne from'os';import*as d from'path';import e from'chalk';import Se from'ora';import*as h from'js-yaml';import*as C from'fs/promises';var ae=[{path:".paradigm/config.yaml",defaultContent:['version: "2.0"','project: ""','description: ""','initialized: ""'].join(`
3
3
  `)+`
4
4
  `},{path:".paradigm/agents.yaml",defaultContent:['version: "1.0"',"agents: []"].join(`
5
5
  `)+`
@@ -51,7 +51,7 @@ Generated by paradigm shift.
51
51
  `)}async function de(o){let n=d.join(o,".purpose");try{let l=await C.readFile(n,"utf-8");if(l.trim().length<se)return {id:"empty-purpose",priority:1,message:"Edit `.purpose` to define your project's features",command:void 0,type:"action"};if(ce.some(f=>l.includes(f)))return {id:"empty-purpose",priority:1,message:"Edit `.purpose` to define your project's features",command:void 0,type:"action"}}catch{return {id:"empty-purpose",priority:1,message:"Edit `.purpose` to define your project's features",command:void 0,type:"action"}}return null}async function pe(o){let n=["src","packages","apps"];for(let r of n){let f=d.join(o,r);if(!a.existsSync(f))continue;if(await te(f))return null}return n.some(r=>a.existsSync(d.join(o,r)))?{id:"no-sub-purpose",priority:2,message:"Add `.purpose` files to feature directories",command:void 0,type:"action"}:null}async function fe(o){let n=d.join(o,"portal.yaml");try{let l=await C.readFile(n,"utf-8"),r=l.includes("gates:")&&!l.match(/gates:\s*(\[\]|\{\})\s*$/m)&&!l.match(/gates:\s*(\[\]|\{\})\s*\n/),f=l.includes("routes:")&&!l.match(/routes:\s*(\[\]|\{\})\s*$/m)&&!l.match(/routes:\s*(\[\]|\{\})\s*\n/);if(!r&&!f)return {id:"empty-portal",priority:3,message:"Define auth gates in `portal.yaml` if your project has auth",command:void 0,type:"action"}}catch{return {id:"empty-portal",priority:3,message:"Define auth gates in `portal.yaml` if your project has auth",command:void 0,type:"action"}}return null}async function me(o){let n=d.join(o,".paradigm","agents.yaml");try{let l=await C.readFile(n,"utf-8");if(l.includes("agents: []")||l.trim().length<40)return {id:"agents-unconfigured",priority:4,message:"Review agent roles",command:"paradigm agent list",type:"action"}}catch{return null}return null}async function ue(o){let n=d.join(o,".paradigm",".pending-scope-reviews");return a.existsSync(n)?{id:"pending-scope-reviews",priority:2,message:"Review agent scopes",command:"paradigm agent review",type:"action"}:null}async function ge(o){let n=d.join(o,".paradigm","config.yaml");try{let l=await C.readFile(n,"utf-8");if(!l.includes("model-resolution"))return null;let r=l.match(/tier-1:\s*(\S+)/),f=l.match(/tier-2:\s*(\S+)/),m=l.match(/tier-3:\s*(\S+)/);if(!r||!f||!m)return null;let i=[r[1].replace(/['"]/g,""),f[1].replace(/['"]/g,""),m[1].replace(/['"]/g,"")];if(Object.values(le).some(S=>S[0]===i[0]&&S[1]===i[1]&&S[2]===i[2]))return {id:"model-tiers-default",priority:5,message:"Fine-tune model tiers",command:"paradigm team models",type:"action"}}catch{return null}return null}async function ye(o){let n=d.join(o,".paradigm","lore","entries");try{if((await C.readdir(n)).filter(f=>!f.startsWith(".")).length===0)return {id:"no-lore",priority:8,message:"Lore records automatically as you work",command:void 0,type:"info"}}catch{return {id:"no-lore",priority:8,message:"Lore records automatically as you work",command:void 0,type:"info"}}return null}async function he(o){let n=d.join(o,".paradigm","notebooks");try{if((await C.readdir(n)).filter(f=>!f.startsWith(".")).length===0)return {id:"no-notebooks",priority:8,message:"Agent notebooks build over time",command:void 0,type:"info"}}catch{return {id:"no-notebooks",priority:8,message:"Agent notebooks build over time",command:void 0,type:"info"}}return null}async function we(){return {id:"verify-not-run",priority:6,message:"Verify setup health",command:"paradigm doctor --verify",type:"action"}}async function te(o,n=0){if(n>4)return false;try{let l=await C.readdir(o,{withFileTypes:!0});for(let r of l)if(!(r.isDirectory()&&["node_modules","dist",".git",".next",".paradigm","build","out","target",".turbo"].includes(r.name))&&(r.name===".purpose"&&!r.isDirectory()||r.isDirectory()&&await te(d.join(o,r.name),n+1)))return !0}catch{a$1.operation("shift-recommendations").debug("Could not read directory",{dir:o});}return false}var oe=new Set(["architect","builder","reviewer","security","advocate","tester","compliance","documentor"]),I={architect:{nickname:"Arky",role:"System design, specifications"},builder:{nickname:"Kit",role:"Implementation, tests"},reviewer:{nickname:"Judge",role:"Code quality, compliance"},security:{nickname:"Aegis",role:"Auth flows, vulnerability scanning"},advocate:{nickname:"Jinx",role:"Stress testing, edge cases"},tester:{nickname:"Probe",role:"Unit and integration tests"},compliance:{nickname:"Rune",role:"Symbol compliance enforcement"},documentor:{nickname:"Scribe",role:".purpose, portal.yaml maintenance"}};function ke(o){let n=[],l=d.join(ne.homedir(),".paradigm","agents");for(let[r,f]of Object.entries(o.agents)){let m,i=r,b=d.join(l,`${r}.agent`);if(a.existsSync(b))try{let v=a.readFileSync(b,"utf8"),E=h.load(v);E?.nickname&&(m=E.nickname),E?.role&&(i=E.role);}catch{}!m&&I[r]&&(m=I[r].nickname,i=I[r].role);let S=f.source==="core"||f.source==="ecosystem"?f.source:oe.has(r)?"core":"ecosystem";n.push({id:r,nickname:m,role:i,source:S});}return n}async function be(o,n,l){if(!a.existsSync(n))return;let r;try{r=h.load(a.readFileSync(n,"utf8"))??{active:[]};}catch{return}let f=Array.isArray(r.active)?r.active:[];if(f.includes("compliance"))return;let{isCohortC:m}=await import('./migration-notices-MRZ6PVDS.js');if(!m(o))return;let i=d.join(o,".paradigm",".compliance-nomination-skipped");if(a.existsSync(i)&&!l.force)return;if(!process.stdin.isTTY||l.prompt===false){try{a.writeFileSync(i,"","utf8");}catch{}return}console.log(""),console.log(e.cyan("Step 2c-nominate/6: Symbol enforcement")),console.log(""),console.log(" This project defines ~aspects but no compliance-archetype agent"),console.log(" (Rune) is on the roster."),console.log(""),console.log(" Without a claimant, paradigm 6.0.4 no longer enforces aspect"),console.log(" coverage. You can:"),console.log(""),console.log(` ${e.green("[Y]")} Add Rune (compliance) to the roster \u2014 recommended`),console.log(" Authority defaults will be written to .paradigm/authority.yaml."),console.log(" Default mode: advise (Rune surfaces findings, never blocks)."),console.log(""),console.log(` ${e.yellow("[N]")} Skip \u2014 opt out of aspect enforcement for this project`),console.log(" This decision is remembered. Re-run with --force to revisit."),console.log("");let S=(await import('readline/promises')).createInterface({input:process.stdin,output:process.stdout}),v="";try{v=(await S.question(" Add Rune to roster? [Y/n]: ")).trim().toLowerCase();}catch{v="";}finally{S.close();}if(v===""||v==="y"||v==="yes"){r.active=[...f,"compliance"].sort();try{a.writeFileSync(n,h.dump(r,{lineWidth:-1,noRefs:!0}),"utf8"),console.log(e.green(" \u2713 Rune (compliance) added to roster"));}catch(R){a$1.operation("shift").debug("Roster update failed",{error:R.message});return}try{let{writeArchetypeDefaults:R}=await import('./authority-GCMPX7RW.js');await R(o,"archetype-default"),console.log(e.gray(" \u2713 Authority defaults written to .paradigm/authority.yaml"));}catch(R){a$1.operation("shift").debug("Authority defaults write failed",{error:R.message});}if(a.existsSync(i))try{a.unlinkSync(i);}catch{}}else {try{a.writeFileSync(i,"","utf8");}catch{}console.log(e.gray(" Skipped \u2014 opt out of aspect enforcement for this project"));}}async function Le(o={}){let n=process.cwd(),l=d.basename(n),r=d.join(n,".paradigm"),f$1=a.existsSync(r)&&a.statSync(r).isDirectory();console.log(e.blue(`
52
52
  \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510`)),console.log(e.blue("\u2502")+e.white.bold(" paradigm shift ")+e.blue("\u2502")),console.log(e.blue("\u2502")+e.gray(" Full project setup in one command ")+e.blue("\u2502")),console.log(e.blue(`\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518
53
53
  `)),console.log(e.white(` \u{1F4C1} Project: ${e.cyan(l)}`)),console.log(e.white(` \u{1F4CD} Status: ${f$1?e.green("Paradigm detected"):e.yellow("New project")}`)),console.log("");let m=a$1.command("shift").start("Running paradigm shift",{project:l}),i=Se();if(!f$1||o.force){i.start("Step 1/6: Initializing Paradigm...");try{await a$2({force:o.force,quick:!0,name:l,stack:o.stack}),i.succeed(e.green("Paradigm initialized"));}catch(t){i.fail(e.red(`Init failed: ${t.message}`)),m.error("Shift failed at init",{error:t.message});return}}else {i.succeed(e.gray("Step 1/6: Already initialized (use --force to reinit)"));let t=d.join(r,"config.yaml");if(a.existsSync(t))try{let s=a.readFileSync(t,"utf8"),c=h.load(s);if(!c.discipline||c.discipline==="auto"){let p=a$3(n);if(p!=="backend"){let u=s.replace(/^discipline:\s*auto\b.*$/m,`discipline: ${p}`);u!==s&&(a.writeFileSync(t,u,"utf8"),console.log(e.green(` \u2713 Detected discipline: ${e.cyan(p)} (updated config.yaml)`)));}else if(!c.discipline){let u=s.replace(/^(project:\s*.+)$/m,`$1
54
- discipline: ${p}`);u!==s&&(a.writeFileSync(t,u,"utf8"),console.log(e.green(` \u2713 Added discipline: ${e.cyan(p)} to config.yaml`)));}}}catch(s){a$1.operation("shift").debug("Discipline detection failed",{error:s.message});}}if(f$1){i.start("Step 1b/6: Checking for migrations...");try{let{migrateCommand:t}=await import('./migrate-R64OQGSM.js');await t({apply:!0,quiet:!0,noSync:!0}),i.succeed(e.green("Migrations applied"));}catch(t){i.warn(e.yellow(`Migration warning: ${t.message}`));}}{let t=d.join(r,"config.yaml");if(o.workspace&&a.existsSync(t)){let s=o.workspacePath?d.resolve(n,o.workspacePath):d.join(d.dirname(n),".paradigm-workspace");if(a.existsSync(s))try{let c=h.load(a.readFileSync(s,"utf8")),p=d.basename(n),u=d.dirname(s),g="./"+d.relative(u,n);if(c.members.some(j=>d.resolve(u,j.path)===n))console.log(e.green(` \u2713 Already a member of workspace: ${e.cyan(c.name)}`));else {let j=d$1(p,n);c.members.push({name:p,path:g,...j&&{role:j}}),a.writeFileSync(s,h.dump(c,{indent:2,lineWidth:120,noRefs:!0,sortKeys:!1,quotingType:'"'}),"utf8"),console.log(e.green(` \u2713 Joined workspace: ${e.cyan(c.name)} (added as member)`));}}catch(c){console.log(e.yellow(` \u26A0 Failed to join workspace: ${c.message}`));}else try{let c=d.basename(n),p=d.dirname(s),u="./"+d.relative(p,n),g=d$1(c,n),y={version:"1.0",name:o.workspace,members:[{name:c,path:u,...g&&{role:g}}]};a.mkdirSync(d.dirname(s),{recursive:!0}),a.writeFileSync(s,h.dump(y,{indent:2,lineWidth:120,noRefs:!0,sortKeys:!1,quotingType:'"'}),"utf8"),console.log(e.green(` \u2713 Created workspace: ${e.cyan(o.workspace)} at ${e.gray(d.relative(n,s))}`));}catch(c){console.log(e.yellow(` \u26A0 Failed to create workspace: ${c.message}`));}try{let c=a.readFileSync(t,"utf8"),p=h.load(c),u=d.relative(n,s);if(p.workspace!==u){if(p.workspace){let g=c.replace(/^workspace:\s*.*$/m,`workspace: "${u}"`);a.writeFileSync(t,g,"utf8");}else {let g=c.trimEnd()+`
54
+ discipline: ${p}`);u!==s&&(a.writeFileSync(t,u,"utf8"),console.log(e.green(` \u2713 Added discipline: ${e.cyan(p)} to config.yaml`)));}}}catch(s){a$1.operation("shift").debug("Discipline detection failed",{error:s.message});}}if(f$1){i.start("Step 1b/6: Checking for migrations...");try{let{migrateCommand:t}=await import('./migrate-5M4KUQ2L.js');await t({apply:!0,quiet:!0,noSync:!0}),i.succeed(e.green("Migrations applied"));}catch(t){i.warn(e.yellow(`Migration warning: ${t.message}`));}}{let t=d.join(r,"config.yaml");if(o.workspace&&a.existsSync(t)){let s=o.workspacePath?d.resolve(n,o.workspacePath):d.join(d.dirname(n),".paradigm-workspace");if(a.existsSync(s))try{let c=h.load(a.readFileSync(s,"utf8")),p=d.basename(n),u=d.dirname(s),g="./"+d.relative(u,n);if(c.members.some(j=>d.resolve(u,j.path)===n))console.log(e.green(` \u2713 Already a member of workspace: ${e.cyan(c.name)}`));else {let j=d$1(p,n);c.members.push({name:p,path:g,...j&&{role:j}}),a.writeFileSync(s,h.dump(c,{indent:2,lineWidth:120,noRefs:!0,sortKeys:!1,quotingType:'"'}),"utf8"),console.log(e.green(` \u2713 Joined workspace: ${e.cyan(c.name)} (added as member)`));}}catch(c){console.log(e.yellow(` \u26A0 Failed to join workspace: ${c.message}`));}else try{let c=d.basename(n),p=d.dirname(s),u="./"+d.relative(p,n),g=d$1(c,n),y={version:"1.0",name:o.workspace,members:[{name:c,path:u,...g&&{role:g}}]};a.mkdirSync(d.dirname(s),{recursive:!0}),a.writeFileSync(s,h.dump(y,{indent:2,lineWidth:120,noRefs:!0,sortKeys:!1,quotingType:'"'}),"utf8"),console.log(e.green(` \u2713 Created workspace: ${e.cyan(o.workspace)} at ${e.gray(d.relative(n,s))}`));}catch(c){console.log(e.yellow(` \u26A0 Failed to create workspace: ${c.message}`));}try{let c=a.readFileSync(t,"utf8"),p=h.load(c),u=d.relative(n,s);if(p.workspace!==u){if(p.workspace){let g=c.replace(/^workspace:\s*.*$/m,`workspace: "${u}"`);a.writeFileSync(t,g,"utf8");}else {let g=c.trimEnd()+`
55
55
  workspace: "${u}"
56
56
  `;a.writeFileSync(t,g,"utf8");}console.log(e.green(" \u2713 Linked workspace in config.yaml"));}}catch(c){a$1.operation("shift").debug("Workspace config link failed",{error:c.message});}}else if(a.existsSync(t))try{let s=a.readFileSync(t,"utf8");if(!h.load(s).workspace){let p=d.dirname(n);for(let u=0;u<3;u++){let g=d.join(p,".paradigm-workspace");if(a.existsSync(g)){let j=d.relative(n,g),re=s.trimEnd()+`
57
57
  workspace: "${j}"
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ import {a,b}from'./chunk-6HVOZANP.js';import {d,a as a$1,e,b as b$1}from'./chunk-WR6D3SC6.js';import'./chunk-5TAVYPOV.js';import*as t from'fs';import*as n from'path';function h(r,p=[]){let i=process.cwd();if(!t.existsSync(n.join(i,".paradigm"))){d("Not a Paradigm project (no .paradigm/ directory)."),process.exitCode=1;return}if(!a.includes(r)){d(`Invalid reason: "${r}"`),a$1(`Valid reasons: ${a.join(" | ")}`),e(" trivial \u2014 one-liner / mechanical change, team adds no value"),e(" hotfix \u2014 urgent fix where team latency is unacceptable"),e(" user-directed \u2014 the user explicitly asked for solo work"),e(" exploratory \u2014 research/spike, no production code intended"),process.exitCode=1;return}let o=p.join(" ").trim()||void 0,m=n.join(i,".paradigm",".solo-declared");t.writeFileSync(m,JSON.stringify({timestamp:new Date().toISOString(),reason:r,...o?{note:o}:{}})+`
3
+ `,"utf8"),b(i,{type:"solo-declared",source:"cli",reason:r,...o?{note:o}:{}}),b$1(`Solo session declared (${r}${o?`: ${o}`:""}).`),e("Orchestration gates are satisfied for this work window (expires after ~4h; PARADIGM_GATE_TTL_HOURS to adjust)."),e("Recorded to team-funnel telemetry.");}export{h as soloDeclare};
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import {b as b$1}from'./chunk-AMLD7IYC.js';import'./chunk-FYDRENK7.js';import {d}from'./chunk-HXGYVS2N.js';import {e}from'./chunk-TQOT2LBO.js';import {d as d$1}from'./chunk-EKZDFEJW.js';import'./chunk-5TAVYPOV.js';import*as b from'path';import r from'chalk';import x from'ora';async function J(t,m,o){let f=m?b.resolve(m):process.cwd();if(!o.task){o.json?console.log(JSON.stringify({error:'Task is required. Use --task "..."'})):(console.log(r.red(`
2
+ import {b as b$1}from'./chunk-DLMDHS2X.js';import'./chunk-FYDRENK7.js';import {d}from'./chunk-ECLUYHAR.js';import {e}from'./chunk-YXLGVOZO.js';import {d as d$1}from'./chunk-EKZDFEJW.js';import'./chunk-5TAVYPOV.js';import*as b from'path';import r from'chalk';import x from'ora';async function J(t,m,o){let f=m?b.resolve(m):process.cwd();if(!o.task){o.json?console.log(JSON.stringify({error:'Task is required. Use --task "..."'})):(console.log(r.red(`
3
3
  Task is required. Use --task "..."`)),console.log(r.gray(`Example: paradigm team spawn architect --task "Design the payment API"
4
4
  `)));return}let a=e(f);if(!a){o.json?console.log(JSON.stringify({error:"Team not configured"})):console.log(r.yellow("\nTeam not configured. Run `paradigm team init` first.\n"));return}if(!a.agents[t]){o.json?console.log(JSON.stringify({error:`Unknown agent: ${t}`,available:Object.keys(a.agents)})):(console.log(r.red(`
5
5
  Unknown agent: ${t}`)),console.log(r.gray(`Available agents: ${Object.keys(a.agents).join(", ")}
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export{b as assertTransition,g as completeTask,e as createTask,d as loadTask,c as loadTasks,a as normalizeTask,i as rebuildTaskIndex,h as shelveTask,f as updateTask}from'./chunk-3MZ4J2LF.js';import'./chunk-EK4ZRIFJ.js';import'./chunk-5TAVYPOV.js';
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ import {c,d as d$1}from'./chunk-3MZ4J2LF.js';import {b,a}from'./chunk-EK4ZRIFJ.js';import'./chunk-5TAVYPOV.js';import*as d from'fs';import*as g from'path';b();var w=".paradigm/events/settlement-liveness.jsonl",v=30,L=new Set(["done","shelved","crashed"]);function y(t){return L.has(t)}function E(t){return y(t.status)||!!t.crashed_at}function P(t,e){try{let s=g.join(t,w);d.mkdirSync(g.dirname(s),{recursive:!0}),d.appendFileSync(s,JSON.stringify(e)+`
3
+ `,"utf8");}catch(s){a.component("#task-settlement").warn("Failed to append liveness record",{parentTaskId:e.parentTaskId,error:s instanceof Error?s.message:String(s)});}}function _(t){return Object.values(t).every(e=>e==="skipped"||e==="ok")}function T(){let t=process.env.PARADIGM_REAPER_STALE_MINUTES;return (t&&!Number.isNaN(Number(t))?Number(t):v)*60*1e3}async function A(t){let e=Date.now(),s=T(),a$1=[],l;try{l=await c(t,{status:"in-progress",limit:9999});}catch{return a$1}let{updateTask:i}=await import('./task-loader-IGQQ6ZFL.js');for(let o of l){if(o.status!=="in-progress"||o.crashed_at)continue;let u=o.started_at?new Date(o.started_at).getTime():NaN;if(Number.isNaN(u)||e-u<s)continue;let r=new Date().toISOString();await i(t,o.id,{status:"shelved",crashed_at:r,crash_reason:"reaper:stale-in-progress",shelved:r})&&(a$1.push(o.id),a.component("#task-settlement").warn("Reaped stale in-progress task",{taskId:o.id,startedAt:o.started_at,reason:"reaper:stale-in-progress"}));}return a$1}async function R(t,e,s){if(!e)return;try{await A(t);}catch(r){a.component("#task-settlement").warn("Reaper pass failed (non-fatal)",{error:r instanceof Error?r.message:String(r)});}let a$1=await d$1(t,e);if(!a$1){a.component("#task-settlement").warn("Orphan task: parent failed to load",{parentTaskId:e,orphanChildId:s,reason:"orphan:missing-parent"});let r=s?await d$1(t,s):null;if(r&&r.settledAt)return;await S(t,e,"orphan",r??void 0,true);return}if(a$1.settledAt)return;let l=(await c(t,{status:"all",limit:9999})).filter(r=>r.parentTaskId===a$1.id);if(l.length===0||!l.every(E))return;let i=l.some(r=>r.crashed_at),o=l.some(r=>r.status==="shelved"&&!r.crashed_at),u=i?"crashed":o?"shelved":"done";await S(t,a$1.id,u,a$1);}async function S(t,e,s,a$1,l=false){let i={recordWorkLog:"skipped",runPostflightLearning:"skipped",autoPromoteJournalEntries:"skipped"},o=0,u=0,r=a$1?.claimant?.ref??"orchestrator";try{try{let{recordWorkLog:n}=await import('./work-log-loader-DL5GZ2BQ.js');n(t,{agent:r,task_ref:e,summary:`Settlement of task DAG ${e} (${s})`,outcome:s==="done"?"pass":"partial",symbols_touched:[]}),i.recordWorkLog="ok";}catch(n){i.recordWorkLog="threw",a.component("#task-settlement").warn("Settlement stage threw: recordWorkLog",{parentTaskId:e,error:n instanceof Error?n.message:String(n)});}try{let{runPostflightLearning:n}=await import('./ambient-7HBJHJL2.js'),c=await n(t,{claimant:r});o=c.journalsWritten??0,u=c.promoted??0,i.runPostflightLearning="ok";}catch(n){i.runPostflightLearning="threw",a.component("#task-settlement").warn("Settlement stage threw: runPostflightLearning",{parentTaskId:e,error:n instanceof Error?n.message:String(n)});}try{let{autoPromoteJournalEntries:n}=await import('./nomination-engine-AQHU2KBU.js'),c=n(t,r);u+=c.promoted??0,i.autoPromoteJournalEntries="ok";}catch(n){i.autoPromoteJournalEntries="threw",a.component("#task-settlement").warn("Settlement stage threw: autoPromoteJournalEntries",{parentTaskId:e,error:n instanceof Error?n.message:String(n)});}}finally{let n={ts:new Date().toISOString(),parentTaskId:e,settledAs:s,stages:i,journalsWritten:o,promoted:u,chainLive:_(i)};if(P(t,n),a$1)try{let{updateTask:c}=await import('./task-loader-IGQQ6ZFL.js'),p={settledAt:new Date().toISOString()};s==="crashed"&&(p.crash_reason=a$1.crash_reason??"reaper:stale-in-progress"),l&&(p.orphaned=!0),await c(t,a$1.id,p);}catch(c){a.component("#task-settlement").warn("Failed to stamp settledAt",{parentTaskId:e,error:c instanceof Error?c.message:String(c)});}}}export{y as isTerminal,A as reapStaleInProgress,R as settleParentIfComplete};
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- export{e as teamAcceptCommand,f as teamCheckCommand,d as teamHandoffCommand,g as teamHistoryCommand,b as teamInitCommand,a as teamModelsCommand,h as teamResetCommand,c as teamStatusCommand}from'./chunk-XKNJSPB5.js';import'./chunk-MU5YWTNE.js';import'./chunk-TYWB5IQJ.js';import'./chunk-AMLD7IYC.js';import'./chunk-FYDRENK7.js';import'./chunk-HXGYVS2N.js';import'./chunk-TQOT2LBO.js';import'./chunk-Y4XFVDZC.js';import'./chunk-EKZDFEJW.js';import'./chunk-LPBCQM5Y.js';import'./chunk-4GC35IFF.js';import'./chunk-JIXHEBGK.js';import'./chunk-ZJQY5PPP.js';import'./chunk-5TAVYPOV.js';
2
+ export{e as teamAcceptCommand,f as teamCheckCommand,d as teamHandoffCommand,g as teamHistoryCommand,b as teamInitCommand,a as teamModelsCommand,h as teamResetCommand,c as teamStatusCommand}from'./chunk-JCGCPAHF.js';import'./chunk-6AKNXD22.js';import'./chunk-DLMDHS2X.js';import'./chunk-FYDRENK7.js';import'./chunk-ECLUYHAR.js';import'./chunk-TYWB5IQJ.js';import'./chunk-YXLGVOZO.js';import'./chunk-Y4XFVDZC.js';import'./chunk-EKZDFEJW.js';import'./chunk-LPBCQM5Y.js';import'./chunk-4GC35IFF.js';import'./chunk-JIXHEBGK.js';import'./chunk-ZJQY5PPP.js';import'./chunk-5TAVYPOV.js';
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export{a as SOLO_REASONS,b as appendTeamFunnelEvent,c as readTeamFunnelEvents,d as summarizeTeamFunnel}from'./chunk-6HVOZANP.js';import'./chunk-5TAVYPOV.js';
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export{b as registerTools}from'./chunk-47YPID6H.js';import'./chunk-ZUAUFZRJ.js';import'./chunk-S4J337EQ.js';import'./chunk-K54L6CFR.js';import'./chunk-WROJSWAO.js';import'./chunk-QBIQ2FYB.js';import'./chunk-M4UMM6DC.js';import'./chunk-B5KLSBOZ.js';import'./chunk-4UJ4NIEQ.js';import'./chunk-ROU3F2HZ.js';import'./chunk-FRQRREJ6.js';import'./chunk-3KVVC4WV.js';import'./chunk-QEQCPVF5.js';import'./chunk-Q527BPUF.js';import'./chunk-RGSFU2YW.js';import'./chunk-TMDPDIWA.js';import'./chunk-KLBH26PA.js';import'./chunk-XROULIQN.js';import'./chunk-GRZQIKST.js';import'./chunk-KAFQA7HV.js';import'./chunk-ACJWUOMA.js';import'./chunk-33ERV2MW.js';import'./chunk-3MZ4J2LF.js';import'./chunk-EK4ZRIFJ.js';import'./chunk-JNSJVCTU.js';import'./chunk-QGZRM6ZB.js';import'./chunk-5TAVYPOV.js';
@@ -0,0 +1,60 @@
1
+ ---
2
+ id: N-para-801-cid-becomes-real
3
+ title: 'Lesson 5: Cid the Captain Becomes Real'
4
+ type: note
5
+ author: paradigm
6
+ created: '2026-06-13'
7
+ updated: '2026-06-13'
8
+ tags:
9
+ - course
10
+ - para-801
11
+ - close-the-loop
12
+ - captain-board
13
+ - cid
14
+ symbols: []
15
+ difficulty: intermediate
16
+ estimatedMinutes: 7
17
+ prerequisites: []
18
+ category: paradigm-core
19
+ ---
20
+
21
+ ## "The Captain Owns Nothing"
22
+
23
+ Cid is the Captain archetype — responsible for navigation and coverage. But the audit's blunt finding was that *the Captain owned nothing and never did anything.* Session-open showed an anonymous static task dump (`context.ts:723-738`); session-close wrote a `.cid-briefed` marker unconditionally (`captain.ts:645`) regardless of what actually happened. Cid had a role with no artifact and no mutation — a job title with no job.
24
+
25
+ The Spine (Lessons 1-3) gives Cid the thing he was missing: a durable, owned, writable artifact. v7 makes the Captain *real*.
26
+
27
+ ## `paradigm_captain_board` — Cid's Owned Surface
28
+
29
+ A new MCP tool, `paradigm_captain_board`, gives Cid a read+write artifact with three actions (`read | claim | advance`):
30
+
31
+ - **`read`** assembles the **live run-DAG** — epic tasks with their stage children ordered by `dependsOn` — plus a ripple-ranked list of `unclaimed` tasks and a summary. This is exactly what the Conductor task-dashboard renders.
32
+ - **`claim`** and **`advance`** are **Cid's and only Cid's** write path for `claimant`, live status transitions, and run-record `runStatus`.
33
+
34
+ For the first time, the Captain has a board to read and a board to write.
35
+
36
+ ## Session-Open: Propose Claimants
37
+
38
+ At session-open, the anonymous task dump is replaced by a **Cid-attributed board read**. Cid runs the reaper, reads the board, ranks unclaimed tasks by ripple-risk (reusing the brief's ripple machinery), surfaces the top few, and **proposes claimants** — writing `claimant` and advancing `open → claimed` on the proposals.
39
+
40
+ That write is the point. It is the durable proof the Captain did something this session. (Human or peer claims always override an archetype proposal — Cid proposes; people decide.) If the board read fails, Cid falls back safely to the plain task list — instrumentation never blocks the session.
41
+
42
+ ## Session-Close: Check the Loop, Self-Heal, Never Deadlock
43
+
44
+ At session-close, the debrief gains real checks before it clears the Stop hook: did the run-record advance off `pending`? did claimed tasks change status (else release stale claims)? and — reading the `chainLive` liveness probe from Lesson 4 — **did postflight actually run?**
45
+
46
+ Here v7 made a sharp correction. An early design had Cid *refuse to finish the session* if the learning chain hadn't run. The adversarial review flagged this as a **user-facing deadlock**: blocking a human from finishing their work because a *learning* step didn't fire inverts the priorities entirely. The fix:
47
+
48
+ - If the chain didn't run, Cid **self-heals** — he runs postflight *himself* — rather than blocking.
49
+ - If self-heal itself throws, Cid proposes only an **`advise`** block (`paradigm_propose_block({ claimant: 'navigation', severity: 'advise' })`) — **never `guard`.**
50
+
51
+ A learning-loop gap must not deadlock a human. Hard refuse stays reserved for *correctness* gates (a missing `.purpose`), never learning-loop liveness.
52
+
53
+ ## The Cid ↔ Loid Boundary, in Tense
54
+
55
+ The cleanest way to remember who writes what is **tense**:
56
+
57
+ - **Cid writes the present tense** — `status` (live, up to but not including the work-completer's `done`), `claimant`, the DAG edges at emission, run-record `runStatus`. Cid is *what is happening now.*
58
+ - **Loid writes the past tense** — `settledAt` and the learning stores. Loid is *what we learned from what already happened.*
59
+
60
+ They never co-write a field, and the dependency points one way: `status → settlement → learning`. The old fake "→ Loid" prose handoff at session-close becomes a real, enforced boundary that Cid owns the front of and Loid owns the back of.
@@ -0,0 +1,66 @@
1
+ ---
2
+ id: N-para-801-falsifiable-self-improvement
3
+ title: 'Lesson 4: Falsifiable Self-Improvement'
4
+ type: note
5
+ author: paradigm
6
+ created: '2026-06-13'
7
+ updated: '2026-06-13'
8
+ tags:
9
+ - course
10
+ - para-801
11
+ - close-the-loop
12
+ - falsifiability
13
+ - chain-live
14
+ symbols: []
15
+ difficulty: intermediate
16
+ estimatedMinutes: 7
17
+ prerequisites: []
18
+ category: paradigm-core
19
+ ---
20
+
21
+ ## "Self-Improving" Is a Claim — Can You Break It?
22
+
23
+ A system that *asserts* it is self-improving and a system that *is* self-improving can look identical from the outside, right up until you need the improvement and it isn't there. The deepest finding of the v7 audit was that Paradigm's "self-improving" claim was **unfalsifiable**: there was no test you could run that would fail if the learning loop were dead.
24
+
25
+ A claim you cannot break is not a feature — it is marketing. v7's job in this lesson is to make "self-improving" *testable*: there must exist a deliberate action that turns the check red.
26
+
27
+ ## The Metric That Did Not Work: JPS
28
+
29
+ The first attempt was **JPS** — journals-per-settlement: count journal entries written, divided by parent subtrees settled, over a trailing window. The intuition was that a healthy loop writes journals and a dead loop writes zero.
30
+
31
+ The adversarial review killed it as **circular**. A clean run that legitimately produced no new insight ("silence is signal") and a *severed chain* both produce `JPS = 0`. The metric could not distinguish healthy quiet from a corpse. Measuring the **volume of output** can't tell you whether the **pipe** is alive.
32
+
33
+ ## The Probe That Works: `chainLive`
34
+
35
+ The fix is to instrument the *pipe*, not the *output*. Each settlement now appends one record to `.paradigm/events/settlement-liveness.jsonl`:
36
+
37
+ ```jsonc
38
+ {
39
+ "parentTaskId": "T-…",
40
+ "stages": { "recordWorkLog": "ok", "postflight": "ok", "promote": "skipped" },
41
+ "chainLive": true, // every non-skipped stage returned ok
42
+ "journalsWritten": 0, // diagnostic only — NOT the alarm
43
+ "promoted": 0
44
+ }
45
+ ```
46
+
47
+ Each stage of the chain is wrapped in its own try/catch, and the record is written in a `finally` block — so even a mid-chain throw still records *which* stage died. `chainLive` is true only if every non-skipped stage returned ok. The two cases are now distinguishable:
48
+
49
+ - **Clean subtree:** `chainLive: true, journalsWritten: 0` — the pipe ran end-to-end and simply had nothing to promote. Healthy.
50
+ - **Severed chain:** `chainLive: false` — a stage threw. Broken.
51
+
52
+ ## The `paradigm doctor` Check
53
+
54
+ A new learning-loop-liveness check in `paradigm doctor` (and `/paradigm:health`) reads these records and alarms on `chainLive: false`. The alarm is *falsifiable by construction*: comment out `runPostflightLearning`, run a single settlement, and the check flips red, naming the dead stage. A reviewer can sever the chain on purpose and watch it scream.
55
+
56
+ This is the v7 thesis in miniature. The old claim — "the framework improves itself" — was an assertion with no failing test behind it. The new claim is the same sentence, but now wired to a probe that *anyone* can break in thirty seconds and see fail. That is the difference between an asserted check and a true one.
57
+
58
+ ## Why This Pattern Generalizes
59
+
60
+ The `chainLive` probe is a template for honest self-checking anywhere in Paradigm:
61
+
62
+ 1. **Instrument the pipe, not the output.** Liveness of the mechanism is falsifiable; volume of results is not.
63
+ 2. **Record per-stage in a `finally`.** A mid-pipe failure must still tell you *where* it died.
64
+ 3. **Make the red state reachable by a deliberate act.** If you cannot describe the exact change that turns the check red, the check is not really checking anything.
65
+
66
+ A self-improving framework earns the adjective only if you can prove it *isn't* improving when it breaks. v7 makes that proof a one-line edit away.