@a-company/paradigm 6.6.0 → 6.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-KGUQPYCF.js → chunk-MTLWAWHE.js} +2 -2
- package/dist/index.js +1 -1
- package/dist/mcp.js +1 -1
- package/dist/{shift-6Y3KQP62.js → shift-QY3EXVF4.js} +1 -1
- package/dist/{tools-SKDKBLDK.js → tools-XKI47YFC.js} +1 -1
- package/package.json +1 -1
- package/templates/agents/architect.agent +1 -1
- package/templates/agents/cartographer.agent +100 -0
|
@@ -59,7 +59,7 @@ payloads:
|
|
|
59
59
|
title: "New Task"
|
|
60
60
|
description: "Task description"
|
|
61
61
|
`},null,2)};if(!n){let c=Gs(r);return {handled:true,text:JSON.stringify({available:c,usage:{getAllUsers:'paradigm_test_fixtures({ category: "users" })',getSpecificUser:'paradigm_test_fixtures({ category: "users", name: "admin" })',getAllPayloads:'paradigm_test_fixtures({ category: "payloads" })',getEverything:'paradigm_test_fixtures({ category: "all" })'}},null,2)}}if(i&&n!=="all"){let c=ia(r,n,i);if(!c){let d=Gs(r);return {handled:true,text:JSON.stringify({error:`Fixture "${i}" not found in category "${n}"`,availableInCategory:d[n]||[]},null,2)}}return {handled:true,text:JSON.stringify(c,null,2)}}let o=Ws(r,n);return {handled:true,text:JSON.stringify(o,null,2)}}default:return {handled:false,text:""}}}z();function Dn(t,e,s={}){let{maxResults:n=20}=s,i=[],r=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),o=[`rg -n --no-heading "${r}" "${t}" --glob "!node_modules" --glob "!.git" --glob "!dist" --glob "!build" --glob "!coverage" --max-count 50 2>/dev/null`,`grep -rn "${r}" "${t}" --exclude-dir=node_modules --exclude-dir=.git --exclude-dir=dist --exclude-dir=build --exclude-dir=coverage 2>/dev/null | head -50`],a="";for(let l of o)try{if(a=execSync(l,{encoding:"utf8",maxBuffer:1024*1024}),a.trim())break}catch{continue}if(!a.trim())return i;let c=a.trim().split(`
|
|
62
|
-
`);for(let l of c.slice(0,n)){let d=l.match(/^(.+?):(\d+):(.*)$/);if(d){let[,p,u,g]=d,m=H.relative(t,p),y="unknown";m.includes(".purpose")||m.includes("portal.yaml")?y="purpose":g.includes("//")||g.includes("#")||g.includes("*")?y="comment":y="code",i.push({filePath:m,line:parseInt(u,10),content:g.trim().slice(0,200),context:y});}}return i}function ca(){return [{name:"paradigm_ripple",description:"IMPORTANT: Call BEFORE modifying any symbol to understand impact. Shows what depends on it directly and indirectly, helping you avoid breaking changes. Returns direct and indirect dependents with file paths and dependency depth. ~300 tokens.",inputSchema:{type:"object",properties:{symbol:{type:"string",description:'Symbol to analyze (e.g., "#checkout", "$payment-flow", "^authenticated")'},depth:{type:"number",description:"How many hops to traverse (default: 3, max: 5)"},includeWorkspace:{type:"boolean",description:"Also check sibling workspace projects for cross-project impact (default: false). Requires workspace configured in config.yaml."},response_format:{type:"string",enum:["concise","detailed"],description:'Response detail level. "concise" returns minimal fields to save tokens (default: "detailed")'}},required:["symbol"]},annotations:{readOnlyHint:true,destructiveHint:false},aliases:["dependencies","impact","blast radius","what would break","dependents","affects"]}]}async function On(t,e,s){if(t!=="paradigm_ripple")return {handled:false,text:""};let{symbol:n,depth:i=3,includeWorkspace:r$1=false,response_format:o$1}=e,a=k(s.index,n);if(!a){let C=_d(s.rootDir,n);return a$2(C.length,t),{handled:true,text:C}}let c=Math.min(Math.max(i||3,1),5),l$1=n$1(s.index,n),d=new Set([n]),p=new Map;function u(C,_){if(_>=c)return;let P=[];for(let $ of C){if(d.has($))continue;d.add($);let R=n$1(s.index,$);for(let A of R)d.has(A.symbol)||P.push(A.symbol);}P.length>0&&(p.set(_+1,P),u(P,_+1));}u(l$1.map(C=>C.symbol),1);let g=new Set;for(let[,C]of p)for(let _ of C)_!==n&&!l$1.find(P=>P.symbol===_)&&g.add(_);let m=o(s.index,n),y=l$1.length+g.size,f="low";y>10?f="high":y>3&&(f="medium");let b=await Pn(s.rootDir),h=null;if(b){let C=jn(b,n);C.totalFlows>0&&(C.impactLevel==="high"&&f==="low"?f="medium":C.impactLevel==="high"&&(f="high"),h={totalFlows:C.totalFlows,affectedFlows:C.affectedFlows.map(_=>({flowId:_.flowId,impactLevel:_.downstreamSteps.length>2?"high":"medium",reason:`Symbol is in step ${_.stepAffected.position}, affects ${_.downstreamSteps.length} downstream steps`})),validationSuggestion:C.validationCommands.length>0?`Run: ${C.validationCommands[0]}`:void 0});}let w=new Set([n,...l$1.map(C=>C.symbol),...g]),S=[];try{let C=l(s.index,"gate");for(let _ of C)w.has(_.symbol)&&S.push({gate:_.symbol,description:_.description});for(let _ of l$1)_.type==="gate"&&!S.find(P=>P.gate===_.symbol)&&S.push({gate:_.symbol,description:_.description});}catch{}let k$1={symbol:a.symbol,type:a.type,description:a.description,depth:c,impact:f,analysis:{directlyAffected:l$1.map(C=>({symbol:C.symbol,type:C.type,description:C.description})),indirectlyAffected:Array.from(g),indirectByLevel:Object.fromEntries(p),dependsOn:m.map(C=>({symbol:C.symbol,type:C.type}))},summary:{directCount:l$1.length,indirectCount:g.size,totalAffected:y,dependsOnCount:m.length,levelsAnalyzed:c},recommendation:xd(f)};h&&(k$1.affectedFlows=h),S.length>0&&(k$1.affectedGates=S),k$1.suggestedReviewScope=Cd(f,l$1.length,g.size,S.length,h?.totalFlows??0);try{let C=await r(s.rootDir,n);C.length>0&&(k$1.personas_affected=C,C.length>2&&f==="low"&&(k$1.impact="medium"));}catch{}try{let C=J(s.rootDir,n);C.length>0&&(k$1.university_content_affected=C.map(_=>({id:_.id,title:_.title,type:_.type,stale:_.stale})));}catch{}if(r$1&&s.workspace){let C=No(s.workspace,n);if(C.length>0){k$1.workspaceImpact={siblings:C.map(P=>({project:P.project,references:P.references.map($=>({symbol:$.symbol,type:$.type,description:$.description}))}))};let _=C.reduce((P,$)=>P+$.references.length,0);_>0&&f==="low"&&(k$1.impact="medium"),_>5&&(k$1.impact="high");}}let v=o$1==="concise"?{symbol:k$1.symbol,impact:k$1.impact,summary:k$1.summary}:k$1,x=JSON.stringify(v,null,2);return a$2(x.length,t),{handled:true,text:x}}function _d(t,e){let s=Dn(t,e,{maxResults:20});if(s.length===0)return JSON.stringify({error:"Symbol not found in index",symbol:e,fallback:"searched",referencesFound:0,suggestion:"Run `paradigm scan` to build the index, or check that .purpose files contain this symbol"},null,2);let n=[...new Set(s.map(o=>o.filePath))],i={};for(let o of s)i[o.context]=(i[o.context]||0)+1;let r="low";return n.length>10||s.length>20?r="high":(n.length>3||s.length>5)&&(r="medium"),JSON.stringify({symbol:e,status:"not-indexed",fallback:"grep-search",estimatedImpact:r,analysis:{filesAffected:n.slice(0,10),totalFilesAffected:n.length,totalReferences:s.length,contextBreakdown:i,sampleReferences:s.slice(0,5).map(o=>({file:o.filePath,line:o.line,preview:o.content.slice(0,100)}))},note:"This is a fallback grep search. For accurate dependency analysis, run `paradigm scan` to index your project.",suggestion:"Run `paradigm scan` to enable full ripple analysis with dependency tracking"},null,2)}function xd(t){switch(t){case "high":return "High impact change - review all affected symbols carefully before modifying";case "medium":return "Moderate impact - check direct dependencies for breaking changes";case "low":return "Low impact - safe to modify with standard review"}}function Cd(t,e,s,n,i){let r=[];return e>0&&r.push(`Review ${e} direct dependent(s) for breaking changes`),s>0&&r.push(`Scan ${s} indirect dependent(s) for cascading effects`),n>0&&r.push(`Verify ${n} affected gate(s) still enforce correct auth/access`),i>0&&r.push(`Validate ${i} affected flow(s) end-to-end`),t==="high"?r.push("Consider running full test suite before merging"):t==="medium"&&r.push("Run targeted tests for affected components"),r.length===0&&r.push("No downstream dependents detected - safe to proceed"),r}function la(){return [{name:"paradigm_protocol_search",description:"Search for protocols matching a task description. Call BEFORE exploring the codebase \u2014 if a matching protocol exists, follow its steps instead of discovering the pattern from scratch. Returns top matches with steps, exemplar, and freshness info. ~200 tokens.",inputSchema:{type:"object",properties:{task:{type:"string",description:'Task description to search for (e.g., "add a new page", "add API route")'},limit:{type:"number",description:"Maximum results (default: 3)"}},required:["task"]},annotations:{readOnlyHint:true,destructiveHint:false}},{name:"paradigm_protocol_get",description:"Get a specific protocol by ID with full details and freshness check. ~300 tokens.",inputSchema:{type:"object",properties:{id:{type:"string",description:'Protocol ID (e.g., "P-add-view")'}},required:["id"]},annotations:{readOnlyHint:true,destructiveHint:false}},{name:"paradigm_protocol_record",description:"Record a new protocol after completing repeatable work. Captures the steps you followed so future agents can skip exploration. ~100 tokens.",inputSchema:{type:"object",properties:{name:{type:"string",description:'Protocol name (e.g., "Add a new view")'},description:{type:"string",description:"What this protocol accomplishes"},trigger:{type:"array",items:{type:"string"},description:'Phrases that should match this protocol (e.g., ["add view", "new page"])'},tags:{type:"array",items:{type:"string"},description:'Classification tags (e.g., ["ui", "frontend"])'},symbols:{type:"array",items:{type:"string"},description:'Paradigm symbols involved (e.g., ["#logs-view"])'},exemplar:{type:"string",description:'Canonical file to study for this pattern (e.g., "ui/src/views/LogsView.tsx")'},steps:{type:"array",items:{type:"object",properties:{action:{type:"string",enum:["create","modify","run","verify"],description:"Step action type"},target:{type:"string",description:"File path (supports {Name}/{name} placeholders)"},template_from:{type:"string",description:"File to use as template (for create actions)"},reference:{type:"string",description:"Where in the file to make changes (for modify actions)"},command:{type:"string",description:"Command to execute (for run actions)"},notes:{type:"string",description:"Additional guidance for this step"}},required:["action"]},description:"Ordered steps to follow"},recorded_from:{type:"string",description:'Lore entry ID this protocol was learned from (e.g., "L-2026-03-01-001")'}},required:["name","description","trigger","tags","steps"]},annotations:{readOnlyHint:false,destructiveHint:false}},{name:"paradigm_protocol_update",description:"Update an existing protocol. Use refresh:true after successfully following a protocol to bump last_verified. ~100 tokens.",inputSchema:{type:"object",properties:{id:{type:"string",description:'Protocol ID to update (e.g., "P-add-view")'},refresh:{type:"boolean",description:"Set true to bump last_verified to now (use after successfully following the protocol)"},name:{type:"string",description:"Updated name"},description:{type:"string",description:"Updated description"},trigger:{type:"array",items:{type:"string"},description:"Updated trigger phrases"},tags:{type:"array",items:{type:"string"},description:"Updated tags"},symbols:{type:"array",items:{type:"string"},description:"Updated symbols"},exemplar:{type:"string",description:"Updated exemplar path"},steps:{type:"array",items:{type:"object",properties:{action:{type:"string",enum:["create","modify","run","verify"]},target:{type:"string"},template_from:{type:"string"},reference:{type:"string"},command:{type:"string"},notes:{type:"string"}},required:["action"]},description:"Updated steps"}},required:["id"]},annotations:{readOnlyHint:false,destructiveHint:false}},{name:"paradigm_protocol_validate",description:"Validate protocol references \u2014 check that referenced files exist, exemplars haven't drifted. Validates all protocols if no ID given. ~200 tokens.",inputSchema:{type:"object",properties:{id:{type:"string",description:"Protocol ID to validate (omit to validate all)"}}},annotations:{readOnlyHint:true,destructiveHint:false}}]}async function In(t,e,s){switch(t){case "paradigm_protocol_search":{let n=e.task,i=e.limit||3,r=await O(s.rootDir,n,i);return r.length===0?{handled:true,text:JSON.stringify({count:0,task:n,message:"No matching protocol found. Consider recording one after completing this task."})}:{handled:true,text:JSON.stringify({count:r.length,task:n,matches:r.map(o=>({id:o.protocol.id,name:o.protocol.name,description:o.protocol.description,score:o.score,status:o.protocol.status,exemplar:o.protocol.exemplar,last_verified:o.protocol.last_verified,steps:o.protocol.steps.map(Rd)}))},null,2)}}case "paradigm_protocol_get":{let n=e.id,i=await M$1(s.rootDir,n);if(!i)return {handled:true,text:JSON.stringify({error:`Protocol not found: ${n}`})};let r=R(s.rootDir,i);return {handled:true,text:JSON.stringify({...i,freshness:{status:r.status,issues:r.issues}},null,2)}}case "paradigm_protocol_record":{let n=e.steps||[],i=await P(s.rootDir,{name:e.name,description:e.description,trigger:e.trigger||[],tags:e.tags||[],symbols:e.symbols||[],exemplar:e.exemplar,steps:n,recorded_from:e.recorded_from,verified_by:"claude-opus-4-6"});return {handled:true,text:JSON.stringify({success:true,id:i,name:e.name,message:"Protocol recorded successfully"})}}case "paradigm_protocol_update":{let n=e.id,i=e.refresh,r={};e.name!==void 0&&(r.name=e.name),e.description!==void 0&&(r.description=e.description),e.trigger!==void 0&&(r.trigger=e.trigger),e.tags!==void 0&&(r.tags=e.tags),e.symbols!==void 0&&(r.symbols=e.symbols),e.exemplar!==void 0&&(r.exemplar=e.exemplar),e.steps!==void 0&&(r.steps=e.steps);let o=await Q(s.rootDir,n,r,i===true);return {handled:true,text:JSON.stringify({success:o,id:n,refreshed:i===true,message:o?i?"Protocol updated and verified":"Protocol updated":`Protocol not found: ${n}`})}}case "paradigm_protocol_validate":{let n=e.id;if(n){let a=await M$1(s.rootDir,n);if(!a)return {handled:true,text:JSON.stringify({error:`Protocol not found: ${n}`})};let c=R(s.rootDir,a);return {handled:true,text:JSON.stringify({id:a.id,name:a.name,status:c.status,issues:c.issues,last_verified:a.last_verified},null,2)}}let r=(await L(s.rootDir)).map(a=>{let c=R(s.rootDir,a);return {id:a.id,name:a.name,status:c.status,issues:c.issues,last_verified:a.last_verified}}),o={total:r.length,current:r.filter(a=>a.status==="current").length,stale:r.filter(a=>a.status==="stale").length,broken:r.filter(a=>a.status==="broken").length};return {handled:true,text:JSON.stringify({protocols:r,health:o},null,2)}}default:return {handled:false,text:""}}}function Rd(t){let e={action:t.action};return t.target&&(e.target=t.target),t.template_from&&(e.template_from=t.template_from),t.reference&&(e.reference=t.reference),t.command&&(e.command=t.command),t.notes&&(e.notes=t.notes),e}j();var Tt=null,Js=false;async function Us(t){if(Tt)Js||(await Tt.ensureReady(),Js=true);else {let e=H.join(t,".paradigm","sentinel","sentinel.db");Tt=new f$5(e),await Tt.ensureReady(),Js=true;}return Tt}async function Pd(t,e){return (await Us(t)).recordPracticeEvent(e)}async function pa(t,e){return (await Us(t)).getPracticeEvents(e)}async function le(t,e){return (await Us(t)).getComplianceRate(e)}async function At(t,e){let s=["discovery","verification","testing","documentation","collaboration","security"],n=[];for(let i of s){let r=await le(t,{...e,habitCategory:i});r.total>0&&n.push({category:i,...r});}return n}async function ua(t,e,s){let n=[];for(let i of e){let r=await Pd(t,{habitId:i.habitId,habitCategory:i.habitCategory,result:i.result,engineer:s.engineer,sessionId:s.sessionId,loreEntryId:s.loreEntryId,taskDescription:s.taskDescription,symbolsTouched:s.symbolsTouched,filesModified:s.filesModified,notes:i.notes});n.push(r);}return n}b$1();function ga(t){return {handled:true,text:JSON.stringify({error:t},null,2)}}var $n={code:"lore_type_decision_removed",message:"lore type 'decision' was removed in v6.0. Use paradigm_decision_record instead. The decision will be stored in .paradigm/decisions/ and a companion lore insight entry (type:'insight' with references.decision_id) will be written automatically so the timeline stays complete. For narrative-only references, use paradigm_lore_record({type:'insight', references:{decision_id}}).",successor_tool:"paradigm_decision_record",doc:"docs/private/plans/v6.0-decisions-locked.md",removed_in:"6.0.0"};function ma(){let t=process.env.PARADIGM_AUTHOR;if(t)return Bs(t);try{let e=execSync("git config user.name",{encoding:"utf-8",timeout:3e3}).trim();if(e)return Bs(e)}catch{}try{let e=ya.userInfo().username;if(e)return Bs(e)}catch{}return "unknown"}function Bs(t){return t.toLowerCase().replace(/[^a-z0-9-]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"").slice(0,20)||"unknown"}function ha(){return [{name:"paradigm_lore_search",description:"Search lore entries by symbol, author, date range, type, or tags. Returns project history records. Returns matching entries with titles, dates, and symbol references. ~200 tokens.",inputSchema:{type:"object",properties:{symbol:{type:"string",description:'Filter by symbol (e.g., "#sentinel-sdk", "^authenticated")'},author:{type:"string",description:'Filter by author (human user name, e.g., "ascend")'},hasAgent:{type:"boolean",description:"Filter by AI assistance: true = AI-assisted entries, false = human-only"},authorType:{type:"string",enum:["human","agent"],description:"(Deprecated, use hasAgent) Filter by old author type"},type:{type:"string",enum:["agent-session","human-note","review","incident","milestone","retro","insight"],description:"Filter by entry type"},tag:{type:"string",description:'Filter by tag prefix (e.g., "arc:lore-evolution" for arc entries)'},hasBody:{type:"boolean",description:"Filter for entries with/without long-form body content"},dateFrom:{type:"string",description:'Filter from date (ISO 8601, e.g., "2026-02-20")'},dateTo:{type:"string",description:"Filter to date (ISO 8601)"},tags:{type:"array",items:{type:"string"},description:"Filter by tags (OR logic)"},hasReview:{type:"boolean",description:"Filter for entries with/without reviews"},hasConfidence:{type:"boolean",description:"Filter for entries with/without confidence scores"},hasAssessment:{type:"boolean",description:"Filter for entries with/without assessment verdicts"},limit:{type:"number",description:"Maximum results (default: 20)"},offset:{type:"number",description:"Offset for pagination"}}},annotations:{readOnlyHint:true,destructiveHint:false},aliases:["history","what happened","past work","project history","previous sessions","lore"]},{name:"paradigm_lore_record",description:"Record a new lore entry (agent session, milestone, retro, insight, etc.). Call after completing significant work. Returns the created entry ID and file path. For decisions, use paradigm_decision_record (a companion lore insight is auto-written). ~100 tokens.",inputSchema:{type:"object",properties:{type:{type:"string",enum:["agent-session","human-note","review","incident","milestone","retro","insight"],description:"Entry type"},title:{type:"string",description:'Short title (e.g., "Built Sentinel Phase 1")'},summary:{type:"string",description:"2-3 sentence narrative summary"},symbols_touched:{type:"array",items:{type:"string"},description:'Symbols affected (e.g., ["#sentinel-sdk", "^authenticated"])'},symbols_created:{type:"array",items:{type:"string"},description:"New symbols introduced"},files_created:{type:"array",items:{type:"string"},description:"Files created"},files_modified:{type:"array",items:{type:"string"},description:"Files modified"},lines_added:{type:"number",description:"Lines of code added"},lines_removed:{type:"number",description:"Lines of code removed"},commit:{type:"string",description:"Git commit hash"},duration_minutes:{type:"number",description:"Duration in minutes"},decisions:{type:"array",items:{type:"object",properties:{id:{type:"string"},decision:{type:"string"},rationale:{type:"string"}},required:["id","decision","rationale"]},description:"Decisions made during this work"},errors_encountered:{type:"array",items:{type:"object",properties:{description:{type:"string"},resolution:{type:"string"},time_to_fix:{type:"string"}},required:["description","resolution"]}},learnings:{type:"array",items:{type:"string"},description:"Key learnings from this work"},verification:{type:"object",properties:{status:{type:"string",enum:["pass","fail","partial","untested"]},details:{type:"object",description:'Per-check results (e.g., { "build": "pass", "tests": "fail" })'}}},tags:{type:"array",items:{type:"string"},description:"Tags for categorization"},meta:{type:"object",description:'Project-defined metadata (open-ended key-value pairs, e.g., { meeting_type: "design-review", sprint: 12 })'},body:{type:"string",description:"Long-form content (detailed retrospective notes, decision rationale, etc.)"},linked_lore:{type:"array",items:{type:"string"},description:"Cross-references to other lore entry IDs"},linked_tasks:{type:"array",items:{type:"string"},description:"References to paradigm task IDs"},linked_commits:{type:"array",items:{type:"string"},description:"Git commit SHAs related to this entry"},confidence:{type:"number",description:"Agent confidence in correctness of this work (0.0 to 1.0)"},stream:{type:"string",enum:["work-log","journal","decision","auto"],description:'Knowledge stream classification. "auto" classifies based on content. Default: stores in lore (backward compatible).'}},required:["title","summary","symbols_touched"]},annotations:{readOnlyHint:false,destructiveHint:false}},{name:"paradigm_lore_timeline",description:"Get lore timeline overview: recent entries, active authors, hot symbols. Call for project history orientation. ~200 tokens.",inputSchema:{type:"object",properties:{limit:{type:"number",description:"Number of recent entries to include (default: 10)"}}},annotations:{readOnlyHint:true,destructiveHint:false}},{name:"paradigm_lore_get",description:"Fetch a single lore entry by ID. Returns the full entry with all fields. ~150 tokens.",inputSchema:{type:"object",properties:{id:{type:"string",description:'Lore entry ID (e.g., "L-2026-02-23-001" or "L-2026-03-02-ascend-143025-001")'}},required:["id"]},annotations:{readOnlyHint:true,destructiveHint:false}},{name:"paradigm_lore_update",description:"Update an existing lore entry. Merges provided fields into the existing entry. Returns updated entry confirmation. ~100 tokens.",inputSchema:{type:"object",properties:{id:{type:"string",description:"Lore entry ID to update"},title:{type:"string",description:"New title"},summary:{type:"string",description:"New summary"},type:{type:"string",enum:["agent-session","human-note","review","incident","milestone","retro","insight"],description:"New entry type"},symbols_touched:{type:"array",items:{type:"string"},description:"Updated symbols list"},symbols_created:{type:"array",items:{type:"string"},description:"Updated created symbols"},files_created:{type:"array",items:{type:"string"}},files_modified:{type:"array",items:{type:"string"}},lines_added:{type:"number"},lines_removed:{type:"number"},commit:{type:"string"},duration_minutes:{type:"number"},learnings:{type:"array",items:{type:"string"},description:"Updated learnings"},verification:{type:"object",properties:{status:{type:"string",enum:["pass","fail","partial","untested"]},details:{type:"object"}}},tags:{type:"array",items:{type:"string"}},confidence:{type:"number",description:"Agent confidence in correctness (0.0 to 1.0)"}},required:["id"]},annotations:{readOnlyHint:false,destructiveHint:false}},{name:"paradigm_lore_assess",description:"Record a human assessment verdict on a lore entry (correct/partial/incorrect). Computes calibration delta if confidence was recorded. ~100 tokens.",inputSchema:{type:"object",properties:{id:{type:"string",description:"Lore entry ID to assess"},verdict:{type:"string",enum:["correct","partial","incorrect"],description:"Assessment verdict on the decisions/changes made"},notes:{type:"string",description:"Optional assessment notes"}},required:["id","verdict"]},annotations:{readOnlyHint:false,destructiveHint:false}},{name:"paradigm_lore_calibration",description:"Query calibration statistics across assessed lore entries. Returns accuracy rate, average confidence, calibration score, and verdict breakdown. Supports groupBy for domain-specific reliability maps. ~200 tokens.",inputSchema:{type:"object",properties:{symbol:{type:"string",description:'Filter by symbol (e.g., "#auth-middleware")'},tag:{type:"string",description:"Filter by tag prefix"},author:{type:"string",description:"Filter by author"},dateFrom:{type:"string",description:"Filter from date (ISO 8601)"},dateTo:{type:"string",description:"Filter to date (ISO 8601)"},groupBy:{type:"string",enum:["symbol","tag","type"],description:"Group calibration stats by dimension"}}},annotations:{readOnlyHint:true,destructiveHint:false}},{name:"paradigm_lore_delete",description:"Delete a lore entry. Requires explicit confirmation to prevent accidental deletion. ~100 tokens.",inputSchema:{type:"object",properties:{id:{type:"string",description:"Lore entry ID to delete"},confirm:{type:"boolean",description:"Must be true to proceed with deletion"}},required:["id","confirm"]},annotations:{readOnlyHint:false,destructiveHint:true}}]}async function Dt(t,e,s){switch(t){case "paradigm_lore_search":{let n={author:e.author,hasAgent:e.hasAgent,authorType:e.authorType,symbol:e.symbol,dateFrom:e.dateFrom,dateTo:e.dateTo,type:e.type,tag:e.tag,hasBody:e.hasBody,tags:e.tags,hasReview:e.hasReview,hasConfidence:e.hasConfidence,hasAssessment:e.hasAssessment,limit:e.limit||20,offset:e.offset},i=await a$5(s.rootDir,n);return {handled:true,text:JSON.stringify({count:i.length,filter:Object.fromEntries(Object.entries(n).filter(([,r])=>r!==void 0)),entries:i.map(fa)},null,2)}}case "paradigm_lore_record":{let{type:n,title:i,summary:r,symbols_touched:o,symbols_created:a$1,files_created:c,files_modified:l,lines_added:d,lines_removed:p,commit:u,duration_minutes:g,decisions:m,errors_encountered:y,learnings:f,verification:b,tags:h,meta:w,body:S$1,linked_lore:k,linked_tasks:v,linked_commits:x,confidence:C}=e;if(n==="decision")return a.component("#lore").warn("rejected paradigm_lore_record({type:'decision'}) \u2014 removed in v6.0",{removed_in:$n.removed_in,successor_tool:$n.successor_tool}),ga($n);let _;try{let j=new Date(Date.now()-2592e6).toISOString(),T=await le(s.rootDir,{dateFrom:j});if(T.total>0){let I=(await At(s.rootDir,{dateFrom:j})).filter(F=>F.rate<60).map(F=>F.category);_={rate:T.rate,followed:T.followed,skipped:T.skipped,partial:T.partial,weakAreas:I.length>0?I:void 0};}}catch{}let P={id:"",type:n||"agent-session",timestamp:new Date().toISOString(),duration_minutes:g,author:ma(),agent:{provider:"anthropic",model:"claude-opus-4-6"},title:i,summary:r,symbols_touched:o,symbols_created:a$1,files_created:c,files_modified:l,lines_added:d,lines_removed:p,commit:u,decisions:m,errors_encountered:y,learnings:f,verification:b,tags:h,meta:w||void 0,habit_compliance:_,body:S$1,linked_lore:k,linked_tasks:v,linked_commits:x,confidence:C!=null&&C>=0&&C<=1?C:void 0},$=await d$3(s.rootDir,P);j$2().setLastLoreEntryId($);try{let j=process.env.PARADIGM_AGENT_ID;if(j&&o&&o.length>0){let{updateExpertiseFromLore:T}=await import('./agent-loader-W3RQJVW7.js');T(s.rootDir,j,{symbols_touched:o,confidence:C!=null&&C>=0&&C<=1?C:void 0});}}catch{}let R=null;try{c&&c.length>=2&&(R=S(s.rootDir,c,l||[]));}catch{}let A;if(e.stream){let j=e.stream,T=j==="auto"?Td(e):j;try{if(T==="work-log"){let{recordWorkLog:O}=await import('./work-log-loader-DL5GZ2BQ.js');O(s.rootDir,{agent:P.agent?.model||"unknown",summary:P.summary,outcome:P.verification?.status==="pass"?"pass":P.verification?.status==="fail"?"fail":"partial",files_modified:P.files_modified,symbols_touched:P.symbols_touched,commit:P.commit,linked_lore:P.id||$}),A="work-log";}else if(T==="journal"&&P.learnings?.length){let{recordJournalEntry:O}=await import('./journal-loader-GLH7XFTK.js');for(let I of P.learnings)O(P.agent?.model||"unknown",{trigger:"self_reflection",insight:I,project:s.projectName||"unknown",transferable:!1,linked_work_log:P.id||$});A="journal";}else if(T==="decision"&&P.decisions?.length){let{recordDecision:O}=await import('./decision-loader-HELL2AMX.js');for(let I of P.decisions)O(s.rootDir,{title:I.decision.slice(0,100),decision:I.decision,rationale:I.rationale,participants:[{id:`agent/${P.agent?.model||"unknown"}`,role:"agent",stance:"proposed"}],symbols_affected:P.symbols_touched,status:"active",linked_lore:P.id||$});A="decision";}}catch{}}return {handled:true,text:JSON.stringify({success:true,id:$,type:n,title:i,message:"Lore entry recorded successfully",...A?{stream:A}:{},...R?{protocol_suggestion:R}:{}})}}case "paradigm_lore_timeline":{let n=e.limit||10,i=await c$2(s.rootDir),r=await a$5(s.rootDir,{limit:n}),o={};for(let l of r)for(let d of l.symbols_touched)o[d]=(o[d]||0)+1;let a=Object.entries(o).sort(([,l],[,d])=>d-l).slice(0,10).map(([l,d])=>({symbol:l,count:d})),c={};for(let l of r){let d=l.author;c[d]||(c[d]={count:0,lastActive:l.timestamp,hasAgent:l.agent!=null}),c[d].count++,l.agent&&(c[d].hasAgent=true),l.timestamp>c[d].lastActive&&(c[d].lastActive=l.timestamp);}return {handled:true,text:JSON.stringify({timeline:i||{version:"1.0",project:"unknown",entries:0,last_updated:"",authors:[]},recentEntries:r.map(fa),hotSymbols:a,authors:Object.entries(c).map(([l,d])=>({id:l,hasAgent:d.hasAgent,entries:d.count,lastActive:d.lastActive}))},null,2)}}case "paradigm_lore_get":{let n=e.id,i=await b$4(s.rootDir,n);return i?{handled:true,text:JSON.stringify(i,null,2)}:{handled:true,text:JSON.stringify({error:`Lore entry not found: ${n}`})}}case "paradigm_lore_update":{let n=e.id,{id:i,...r}=e,o={};for(let[c,l]of Object.entries(r))l!==void 0&&(o[c]=l);let a=await g$4(s.rootDir,n,o);return {handled:true,text:JSON.stringify({success:a,id:n,message:a?"Lore entry updated":`Lore entry not found: ${n}`})}}case "paradigm_lore_assess":{let n=e.id,i=e.verdict,r=e.notes,o=await b$4(s.rootDir,n);if(!o)return {handled:true,text:JSON.stringify({error:`Lore entry not found: ${n}`})};let a={verdict:i,assessed_by:ma(),assessed_at:new Date().toISOString(),notes:r},c=await h$3(s.rootDir,n,a);try{let u=process.env.PARADIGM_AGENT_ID;if(u&&c&&o.symbols_touched?.length){let{updateExpertiseFromAssessment:g}=await import('./agent-loader-W3RQJVW7.js');g(s.rootDir,u,{symbols_touched:o.symbols_touched,verdict:i});}}catch{}let l=i==="correct"?1:i==="partial"?.5:0,d=o.confidence!=null?l-o.confidence:null,p=d!=null?d>.1?"Under-confident (actual outcome better than predicted)":d<-0.1?"Over-confident (actual outcome worse than predicted)":"Well-calibrated":"No confidence recorded \u2014 delta not computed";return {handled:true,text:JSON.stringify({success:c,id:n,verdict:i,confidence:o.confidence??null,delta:d,deltaDescription:p,message:c?`Assessment recorded: ${i}${d!=null?` (delta: ${d>0?"+":""}${d.toFixed(2)})`:""}`:`Failed to assess: ${n}`})}}case "paradigm_lore_calibration":{let n={symbol:e.symbol,tag:e.tag,author:e.author,dateFrom:e.dateFrom,dateTo:e.dateTo,hasAssessment:true},i=await a$5(s.rootDir,n),r=i.filter(S=>S.confidence!=null),o=i.length,a=r.length,c={correct:0,partial:0,incorrect:0},l=0,d=0,p=0;for(let S of i){let k=S.assessment.verdict;c[k]++;let v=k==="correct"?1:k==="partial"?.5:0;l+=v,S.confidence!=null&&(d+=S.confidence,p+=Math.abs(v-S.confidence));}let u=o>0?l/o:0,g=a>0?d/a:null,m=a>0?l/o-d/a:null,y=a>0?1-p/a:null,f=e.groupBy,b;if(f&&o>0){let S=new Map;for(let k of i){let v=[];f==="symbol"?v=k.symbols_touched||[]:f==="tag"?v=k.tags||[]:f==="type"&&(v=[k.type||"agent-session"]);for(let x of v)S.has(x)||S.set(x,[]),S.get(x).push(k);}b=Array.from(S.entries()).map(([k,v])=>{let x=v.filter(R=>R.confidence!=null),C={correct:0,partial:0,incorrect:0},_=0,P=0,$=0;for(let R of v){let A=R.assessment.verdict;C[A]++;let j=A==="correct"?1:A==="partial"?.5:0;_+=j,R.confidence!=null&&(P+=R.confidence,$+=Math.abs(j-R.confidence));}return {key:k,total:v.length,accuracyRate:_/v.length,avgConfidence:x.length>0?P/x.length:null,calibrationScore:x.length>0?1-$/x.length:null,verdictBreakdown:C}}).sort((k,v)=>v.total-k.total);}let h=[],w=o<5?`Low sample size (N=${o}). Stats may not be representative.`:o<15?`Moderate sample (N=${o}). Trends are directional, not conclusive.`:null;return w&&h.push(w),y!=null&&(y>=.9?h.push("Excellent calibration \u2014 confidence predictions closely match outcomes."):y>=.7?h.push("Good calibration \u2014 some room for improvement in confidence estimates."):y>=.5?h.push("Fair calibration \u2014 significant gap between predicted confidence and outcomes."):h.push("Poor calibration \u2014 confidence predictions diverge substantially from outcomes.")),m!=null&&(m>.15?h.push("Tendency toward under-confidence \u2014 outcomes are better than predicted."):m<-0.15&&h.push("Tendency toward over-confidence \u2014 outcomes are worse than predicted.")),c.incorrect>o*.3&&o>=5&&h.push(`High error rate: ${c.incorrect}/${o} entries assessed as incorrect.`),{handled:true,text:JSON.stringify({totalAssessed:o,totalWithConfidence:a,accuracyRate:Math.round(u*1e3)/1e3,avgConfidence:g!=null?Math.round(g*1e3)/1e3:null,avgDelta:m!=null?Math.round(m*1e3)/1e3:null,calibrationScore:y!=null?Math.round(y*1e3)/1e3:null,verdictBreakdown:c,...b?{groups:b}:{},insights:h},null,2)}}case "paradigm_lore_delete":{let n=e.id;if(!e.confirm)return {handled:true,text:JSON.stringify({success:false,message:"Deletion requires confirm: true"})};let r=await i$1(s.rootDir,n);return {handled:true,text:JSON.stringify({success:r,id:n,message:r?"Lore entry deleted":`Lore entry not found: ${n}`})}}default:return {handled:false,text:""}}}function Td(t){return t.task_ref||t.files_modified||t.commit?"work-log":t.learnings||t.confidence!==void 0?"journal":t.decisions?.some(s=>s.rationale)?"decision":"work-log"}function fa(t){return {id:t.id,type:t.type,title:t.title,summary:t.summary,author:t.author,agent:t.agent,timestamp:t.timestamp,duration_minutes:t.duration_minutes,symbols_touched:t.symbols_touched,verification:t.verification?.status,review:t.review?{completeness:t.review.completeness,quality:t.review.quality}:null,confidence:t.confidence??null,assessment:t.assessment?t.assessment.verdict:null,assessment_delta:t.assessment_delta??null,tags:t.tags}}function wa(){return [{name:"paradigm_captain_brief",description:"Cid's pre-task context discovery pipeline. Searches symbols, maps blast radius, checks gates, finds protocols, surfaces warnings, and produces a Context Brief injected into every subsequent agent. Call before starting any multi-file task. ~400 tokens.",inputSchema:{type:"object",properties:{taskDescription:{type:"string",description:"The task to produce a context brief for"},symbols:{type:"array",items:{type:"string"},description:'Optional pre-known symbols to anchor the search (e.g., ["#auth", "^authenticated"])'},depth:{type:"string",enum:["quick","standard","deep"],description:"Brief depth. quick=search+navigate only (<800 tokens). standard=+ripple top 3+wisdom. deep=+ripple top 5+full lore scan. Default: standard"}},required:["taskDescription"]},annotations:{readOnlyHint:true,destructiveHint:false}},{name:"paradigm_captain_debrief",description:"Cid's post-task maintenance pass. Audits .purpose coverage for touched directories, creates stubs for gaps, queues rich doc areas to Documentor, records lore, and writes the .cid-briefed marker that clears the stop hook. Call after all agents complete. ~200 tokens.",inputSchema:{type:"object",properties:{orchestrationId:{type:"string",description:"The orchestration run ID (from paradigm_orchestrate_inline)"},sessionSummary:{type:"string",description:"What was accomplished in this session"},touchedFiles:{type:"array",items:{type:"string"},description:"Files modified during this session"},newSymbols:{type:"array",items:{type:"string"},description:"New symbols registered during this session"},notes:{type:"string",description:"Optional additional notes from the orchestrating session"}},required:["orchestrationId","sessionSummary","touchedFiles"]},annotations:{readOnlyHint:false,destructiveHint:false}}]}async function Ot(t,e,s){return t==="paradigm_captain_brief"?Ad(e,s):t==="paradigm_captain_debrief"?Dd(e,s):{handled:false,text:""}}async function Ad(t,e){let s=t.taskDescription,n=t.symbols||[],i=t.depth||"standard",r=H.join(e.rootDir,".paradigm"),o=H.join(r,".cid-session"),a=H.join(r,".cid-briefed");try{E.existsSync(a)&&E.unlinkSync(a);let j={timestamp:new Date().toISOString(),taskDescription:s.slice(0,200),depth:i};E.mkdirSync(r,{recursive:!0}),E.writeFileSync(o,JSON.stringify(j,null,2),"utf8");}catch{}let c=Od(s),l=[],d=new Set;for(let j of n)if(!d.has(j)){d.add(j);let T=ba(j);l.push({id:j,type:T,description:"Provided as anchor symbol"});}let p=[];try{for(let j of c.slice(0,3)){let O=m(e.index,j).slice(0,5);for(let I of O)if(!d.has(I.symbol)){d.add(I.symbol);let F=$d(I.type);l.push({id:I.symbol,type:F,description:I.description||"",file:I.file}),p.push(I.symbol);}}}catch{}let u={directories:[],files:[]};try{let j=await _n("paradigm_navigate",{intent:"context",task:s,response_format:"concise"},e);if(j.handled){let T=JSON.parse(j.text);if(T.files)for(let O of T.files){let I=typeof O=="string"?O:O.path||O.file||"";I&&u.files.push(I);}if(T.directories)for(let O of T.directories){let I=typeof O=="string"?O:O.path||O.directory||"";I&&u.directories.push(I);}if(T.symbols)for(let O of T.symbols){let I=typeof O=="string"?O:O.id;I&&!d.has(I)&&(d.add(I),l.push({id:I,type:ba(I),description:typeof O=="object"&&O.description||""}));}}}catch{}let g=new Set(u.directories);for(let j of u.files){let T=H.dirname(j);T&&T!=="."&&g.add(T);}let m$1=l.slice(0,i==="deep"?5:3),y={affectedFiles:[],affectedSymbols:[],affectedFlows:[],affectedGates:[],fragileSymbols:[]};if(i!=="quick"&&m$1.length>0)for(let j of m$1)try{let T=await On("paradigm_ripple",{symbol:j.id,depth:2,response_format:"concise"},e);if(T.handled){let O=JSON.parse(T.text);if(O.analysis){for(let I of O.analysis.directlyAffected||[]){let F=I.symbol||I;F&&!y.affectedSymbols.includes(F)&&y.affectedSymbols.push(F);}for(let I of O.analysis.indirectlyAffected||[])I&&!y.affectedSymbols.includes(I)&&y.affectedSymbols.push(I);}if(O.affectedFlows?.affectedFlows)for(let I of O.affectedFlows.affectedFlows){let F=I.flowId||I;F&&!y.affectedFlows.includes(F)&&y.affectedFlows.push(F);}if(O.affectedGates)for(let I of O.affectedGates){let F=I.gate||I;F&&!y.affectedGates.includes(F)&&y.affectedGates.push(F);}O.impact==="high"&&(y.fragileSymbols.includes(j.id)||y.fragileSymbols.push(j.id));}}catch{}let f=[],b=Id(s);if(b.length>0)try{let{handleGatesForRoute:j}=await import('./tools-SKDKBLDK.js').catch(()=>({handleGatesForRoute:null})),T=H.join(e.rootDir,"portal.yaml");if(E.existsSync(T)){let O=E.readFileSync(T,"utf8");for(let I of b){let F=O.includes(I);f.push({route:I,gate:"^authenticated",declared:F});}}else for(let O of b)f.push({route:O,gate:"(unknown \u2014 no portal.yaml)",declared:!1});}catch{}let h=[];if(i!=="quick"&&l.length>0)try{let j=l.slice(0,5).map(O=>O.id),T=await kn("paradigm_wisdom_context",{symbols:j,include_global:!0},e);if(T.handled){let O=JSON.parse(T.text);if(O.antipatterns)for(let I of O.antipatterns.slice(0,3)){let F=I.pattern||I.description||I.text||String(I);F&&!h.includes(F)&&h.push(F);}if(O.wisdom?.antipatterns)for(let I of O.wisdom.antipatterns.slice(0,3)){let F=I.pattern||I.description||String(I);F&&!h.includes(F)&&h.push(F);}}}catch{}let w={matched:false};try{let j=await In("paradigm_protocol_search",{task:s,limit:1},e);if(j.handled){let T=JSON.parse(j.text),O=T.matches||T.protocols||T.results||[];if(O.length>0){let I=O[0];w={matched:!0,id:I.id,name:I.name||I.title,steps:(I.steps||[]).slice(0,5).map(F=>typeof F=="string"?F:F.description||String(F))};}}}catch{}let S=[];if(i!=="quick")try{let j=l[0]?.id,T={limit:i==="deep"?5:3};j&&(T.symbol=j);let O=await Dt("paradigm_lore_search",T,e);if(O.handled){let F=JSON.parse(O.text).entries||[];for(let q of F.slice(0,3))S.push({id:q.id,summary:(q.summary||q.title||"").slice(0,100),relevance:j?`Related to ${j}`:"Recent project history"});}}catch{}let k=Array.from(g),v=0;for(let j of k){let T=H.join(e.rootDir,j,".purpose");if(E.existsSync(T))try{E.readFileSync(T,"utf8").trim().length>50&&v++;}catch{}}let x=k.length>0?v/k.length:.5,C=Fd(x),_=Nd(x,C,k.length),P=y.affectedSymbols.length+u.files.length,$=P>20?"large":P>8?"medium":P>2?"small":"tiny",R={territory:{directories:k.slice(0,10),files:u.files.slice(0,10),estimatedScope:$},symbols:l.slice(0,10),blastRadius:y,gates:f,protocol:w,warnings:h,coverage:{score:x,label:C,note:_},loreRefs:S,archMap:b$a(e.rootDir),renderedBrief:""};R.renderedBrief=Ed(R);try{let j={timestamp:new Date().toISOString(),taskDescription:s.slice(0,200),depth:i,coverageScore:x};E.writeFileSync(o,JSON.stringify(j,null,2),"utf8");}catch{}let A=JSON.stringify(R,null,2);return a$2(A.length,"paradigm_captain_brief"),{handled:true,text:A}}async function Dd(t,e){let s=t.orchestrationId,n=t.sessionSummary,i=t.touchedFiles||[],r=t.newSymbols||[],o=t.notes,a=H.join(e.rootDir,".paradigm"),c=H.join(a,".cid-briefed"),l=H.join(a,".pending-review"),d=new Set;for(let _ of i){let P=H.dirname(_);P&&P!=="."&&d.add(P);}let p=0,u=d.size;for(let _ of d){let P=H.join(e.rootDir,_,".purpose");if(E.existsSync(P))try{E.readFileSync(P,"utf8").trim().length>50&&p++;}catch{}}let g=u>0?p/u:1,m=[],y=[];for(let _ of d){let P=H.join(e.rootDir,_,".purpose"),$=H.join(e.rootDir,_),R=false;if(E.existsSync(P))try{R=E.readFileSync(P,"utf8").trim().length>50;}catch{}if(R){if(i.some(j=>H.dirname(j)===_&&r.length>0)){y.push(_);try{let j=JSON.stringify({path:_,reason:"captain-debrief-new-symbols",priority:"medium",context:`New symbols added during orchestration ${s}: ${r.join(", ")}`,timestamp:new Date().toISOString()});E.appendFileSync(l,j+`
|
|
62
|
+
`);for(let l of c.slice(0,n)){let d=l.match(/^(.+?):(\d+):(.*)$/);if(d){let[,p,u,g]=d,m=H.relative(t,p),y="unknown";m.includes(".purpose")||m.includes("portal.yaml")?y="purpose":g.includes("//")||g.includes("#")||g.includes("*")?y="comment":y="code",i.push({filePath:m,line:parseInt(u,10),content:g.trim().slice(0,200),context:y});}}return i}function ca(){return [{name:"paradigm_ripple",description:"IMPORTANT: Call BEFORE modifying any symbol to understand impact. Shows what depends on it directly and indirectly, helping you avoid breaking changes. Returns direct and indirect dependents with file paths and dependency depth. ~300 tokens.",inputSchema:{type:"object",properties:{symbol:{type:"string",description:'Symbol to analyze (e.g., "#checkout", "$payment-flow", "^authenticated")'},depth:{type:"number",description:"How many hops to traverse (default: 3, max: 5)"},includeWorkspace:{type:"boolean",description:"Also check sibling workspace projects for cross-project impact (default: false). Requires workspace configured in config.yaml."},response_format:{type:"string",enum:["concise","detailed"],description:'Response detail level. "concise" returns minimal fields to save tokens (default: "detailed")'}},required:["symbol"]},annotations:{readOnlyHint:true,destructiveHint:false},aliases:["dependencies","impact","blast radius","what would break","dependents","affects"]}]}async function On(t,e,s){if(t!=="paradigm_ripple")return {handled:false,text:""};let{symbol:n,depth:i=3,includeWorkspace:r$1=false,response_format:o$1}=e,a=k(s.index,n);if(!a){let C=_d(s.rootDir,n);return a$2(C.length,t),{handled:true,text:C}}let c=Math.min(Math.max(i||3,1),5),l$1=n$1(s.index,n),d=new Set([n]),p=new Map;function u(C,_){if(_>=c)return;let P=[];for(let $ of C){if(d.has($))continue;d.add($);let R=n$1(s.index,$);for(let A of R)d.has(A.symbol)||P.push(A.symbol);}P.length>0&&(p.set(_+1,P),u(P,_+1));}u(l$1.map(C=>C.symbol),1);let g=new Set;for(let[,C]of p)for(let _ of C)_!==n&&!l$1.find(P=>P.symbol===_)&&g.add(_);let m=o(s.index,n),y=l$1.length+g.size,f="low";y>10?f="high":y>3&&(f="medium");let b=await Pn(s.rootDir),h=null;if(b){let C=jn(b,n);C.totalFlows>0&&(C.impactLevel==="high"&&f==="low"?f="medium":C.impactLevel==="high"&&(f="high"),h={totalFlows:C.totalFlows,affectedFlows:C.affectedFlows.map(_=>({flowId:_.flowId,impactLevel:_.downstreamSteps.length>2?"high":"medium",reason:`Symbol is in step ${_.stepAffected.position}, affects ${_.downstreamSteps.length} downstream steps`})),validationSuggestion:C.validationCommands.length>0?`Run: ${C.validationCommands[0]}`:void 0});}let w=new Set([n,...l$1.map(C=>C.symbol),...g]),S=[];try{let C=l(s.index,"gate");for(let _ of C)w.has(_.symbol)&&S.push({gate:_.symbol,description:_.description});for(let _ of l$1)_.type==="gate"&&!S.find(P=>P.gate===_.symbol)&&S.push({gate:_.symbol,description:_.description});}catch{}let k$1={symbol:a.symbol,type:a.type,description:a.description,depth:c,impact:f,analysis:{directlyAffected:l$1.map(C=>({symbol:C.symbol,type:C.type,description:C.description})),indirectlyAffected:Array.from(g),indirectByLevel:Object.fromEntries(p),dependsOn:m.map(C=>({symbol:C.symbol,type:C.type}))},summary:{directCount:l$1.length,indirectCount:g.size,totalAffected:y,dependsOnCount:m.length,levelsAnalyzed:c},recommendation:xd(f)};h&&(k$1.affectedFlows=h),S.length>0&&(k$1.affectedGates=S),k$1.suggestedReviewScope=Cd(f,l$1.length,g.size,S.length,h?.totalFlows??0);try{let C=await r(s.rootDir,n);C.length>0&&(k$1.personas_affected=C,C.length>2&&f==="low"&&(k$1.impact="medium"));}catch{}try{let C=J(s.rootDir,n);C.length>0&&(k$1.university_content_affected=C.map(_=>({id:_.id,title:_.title,type:_.type,stale:_.stale})));}catch{}if(r$1&&s.workspace){let C=No(s.workspace,n);if(C.length>0){k$1.workspaceImpact={siblings:C.map(P=>({project:P.project,references:P.references.map($=>({symbol:$.symbol,type:$.type,description:$.description}))}))};let _=C.reduce((P,$)=>P+$.references.length,0);_>0&&f==="low"&&(k$1.impact="medium"),_>5&&(k$1.impact="high");}}let v=o$1==="concise"?{symbol:k$1.symbol,impact:k$1.impact,summary:k$1.summary}:k$1,x=JSON.stringify(v,null,2);return a$2(x.length,t),{handled:true,text:x}}function _d(t,e){let s=Dn(t,e,{maxResults:20});if(s.length===0)return JSON.stringify({error:"Symbol not found in index",symbol:e,fallback:"searched",referencesFound:0,suggestion:"Run `paradigm scan` to build the index, or check that .purpose files contain this symbol"},null,2);let n=[...new Set(s.map(o=>o.filePath))],i={};for(let o of s)i[o.context]=(i[o.context]||0)+1;let r="low";return n.length>10||s.length>20?r="high":(n.length>3||s.length>5)&&(r="medium"),JSON.stringify({symbol:e,status:"not-indexed",fallback:"grep-search",estimatedImpact:r,analysis:{filesAffected:n.slice(0,10),totalFilesAffected:n.length,totalReferences:s.length,contextBreakdown:i,sampleReferences:s.slice(0,5).map(o=>({file:o.filePath,line:o.line,preview:o.content.slice(0,100)}))},note:"This is a fallback grep search. For accurate dependency analysis, run `paradigm scan` to index your project.",suggestion:"Run `paradigm scan` to enable full ripple analysis with dependency tracking"},null,2)}function xd(t){switch(t){case "high":return "High impact change - review all affected symbols carefully before modifying";case "medium":return "Moderate impact - check direct dependencies for breaking changes";case "low":return "Low impact - safe to modify with standard review"}}function Cd(t,e,s,n,i){let r=[];return e>0&&r.push(`Review ${e} direct dependent(s) for breaking changes`),s>0&&r.push(`Scan ${s} indirect dependent(s) for cascading effects`),n>0&&r.push(`Verify ${n} affected gate(s) still enforce correct auth/access`),i>0&&r.push(`Validate ${i} affected flow(s) end-to-end`),t==="high"?r.push("Consider running full test suite before merging"):t==="medium"&&r.push("Run targeted tests for affected components"),r.length===0&&r.push("No downstream dependents detected - safe to proceed"),r}function la(){return [{name:"paradigm_protocol_search",description:"Search for protocols matching a task description. Call BEFORE exploring the codebase \u2014 if a matching protocol exists, follow its steps instead of discovering the pattern from scratch. Returns top matches with steps, exemplar, and freshness info. ~200 tokens.",inputSchema:{type:"object",properties:{task:{type:"string",description:'Task description to search for (e.g., "add a new page", "add API route")'},limit:{type:"number",description:"Maximum results (default: 3)"}},required:["task"]},annotations:{readOnlyHint:true,destructiveHint:false}},{name:"paradigm_protocol_get",description:"Get a specific protocol by ID with full details and freshness check. ~300 tokens.",inputSchema:{type:"object",properties:{id:{type:"string",description:'Protocol ID (e.g., "P-add-view")'}},required:["id"]},annotations:{readOnlyHint:true,destructiveHint:false}},{name:"paradigm_protocol_record",description:"Record a new protocol after completing repeatable work. Captures the steps you followed so future agents can skip exploration. ~100 tokens.",inputSchema:{type:"object",properties:{name:{type:"string",description:'Protocol name (e.g., "Add a new view")'},description:{type:"string",description:"What this protocol accomplishes"},trigger:{type:"array",items:{type:"string"},description:'Phrases that should match this protocol (e.g., ["add view", "new page"])'},tags:{type:"array",items:{type:"string"},description:'Classification tags (e.g., ["ui", "frontend"])'},symbols:{type:"array",items:{type:"string"},description:'Paradigm symbols involved (e.g., ["#logs-view"])'},exemplar:{type:"string",description:'Canonical file to study for this pattern (e.g., "ui/src/views/LogsView.tsx")'},steps:{type:"array",items:{type:"object",properties:{action:{type:"string",enum:["create","modify","run","verify"],description:"Step action type"},target:{type:"string",description:"File path (supports {Name}/{name} placeholders)"},template_from:{type:"string",description:"File to use as template (for create actions)"},reference:{type:"string",description:"Where in the file to make changes (for modify actions)"},command:{type:"string",description:"Command to execute (for run actions)"},notes:{type:"string",description:"Additional guidance for this step"}},required:["action"]},description:"Ordered steps to follow"},recorded_from:{type:"string",description:'Lore entry ID this protocol was learned from (e.g., "L-2026-03-01-001")'}},required:["name","description","trigger","tags","steps"]},annotations:{readOnlyHint:false,destructiveHint:false}},{name:"paradigm_protocol_update",description:"Update an existing protocol. Use refresh:true after successfully following a protocol to bump last_verified. ~100 tokens.",inputSchema:{type:"object",properties:{id:{type:"string",description:'Protocol ID to update (e.g., "P-add-view")'},refresh:{type:"boolean",description:"Set true to bump last_verified to now (use after successfully following the protocol)"},name:{type:"string",description:"Updated name"},description:{type:"string",description:"Updated description"},trigger:{type:"array",items:{type:"string"},description:"Updated trigger phrases"},tags:{type:"array",items:{type:"string"},description:"Updated tags"},symbols:{type:"array",items:{type:"string"},description:"Updated symbols"},exemplar:{type:"string",description:"Updated exemplar path"},steps:{type:"array",items:{type:"object",properties:{action:{type:"string",enum:["create","modify","run","verify"]},target:{type:"string"},template_from:{type:"string"},reference:{type:"string"},command:{type:"string"},notes:{type:"string"}},required:["action"]},description:"Updated steps"}},required:["id"]},annotations:{readOnlyHint:false,destructiveHint:false}},{name:"paradigm_protocol_validate",description:"Validate protocol references \u2014 check that referenced files exist, exemplars haven't drifted. Validates all protocols if no ID given. ~200 tokens.",inputSchema:{type:"object",properties:{id:{type:"string",description:"Protocol ID to validate (omit to validate all)"}}},annotations:{readOnlyHint:true,destructiveHint:false}}]}async function In(t,e,s){switch(t){case "paradigm_protocol_search":{let n=e.task,i=e.limit||3,r=await O(s.rootDir,n,i);return r.length===0?{handled:true,text:JSON.stringify({count:0,task:n,message:"No matching protocol found. Consider recording one after completing this task."})}:{handled:true,text:JSON.stringify({count:r.length,task:n,matches:r.map(o=>({id:o.protocol.id,name:o.protocol.name,description:o.protocol.description,score:o.score,status:o.protocol.status,exemplar:o.protocol.exemplar,last_verified:o.protocol.last_verified,steps:o.protocol.steps.map(Rd)}))},null,2)}}case "paradigm_protocol_get":{let n=e.id,i=await M$1(s.rootDir,n);if(!i)return {handled:true,text:JSON.stringify({error:`Protocol not found: ${n}`})};let r=R(s.rootDir,i);return {handled:true,text:JSON.stringify({...i,freshness:{status:r.status,issues:r.issues}},null,2)}}case "paradigm_protocol_record":{let n=e.steps||[],i=await P(s.rootDir,{name:e.name,description:e.description,trigger:e.trigger||[],tags:e.tags||[],symbols:e.symbols||[],exemplar:e.exemplar,steps:n,recorded_from:e.recorded_from,verified_by:"claude-opus-4-6"});return {handled:true,text:JSON.stringify({success:true,id:i,name:e.name,message:"Protocol recorded successfully"})}}case "paradigm_protocol_update":{let n=e.id,i=e.refresh,r={};e.name!==void 0&&(r.name=e.name),e.description!==void 0&&(r.description=e.description),e.trigger!==void 0&&(r.trigger=e.trigger),e.tags!==void 0&&(r.tags=e.tags),e.symbols!==void 0&&(r.symbols=e.symbols),e.exemplar!==void 0&&(r.exemplar=e.exemplar),e.steps!==void 0&&(r.steps=e.steps);let o=await Q(s.rootDir,n,r,i===true);return {handled:true,text:JSON.stringify({success:o,id:n,refreshed:i===true,message:o?i?"Protocol updated and verified":"Protocol updated":`Protocol not found: ${n}`})}}case "paradigm_protocol_validate":{let n=e.id;if(n){let a=await M$1(s.rootDir,n);if(!a)return {handled:true,text:JSON.stringify({error:`Protocol not found: ${n}`})};let c=R(s.rootDir,a);return {handled:true,text:JSON.stringify({id:a.id,name:a.name,status:c.status,issues:c.issues,last_verified:a.last_verified},null,2)}}let r=(await L(s.rootDir)).map(a=>{let c=R(s.rootDir,a);return {id:a.id,name:a.name,status:c.status,issues:c.issues,last_verified:a.last_verified}}),o={total:r.length,current:r.filter(a=>a.status==="current").length,stale:r.filter(a=>a.status==="stale").length,broken:r.filter(a=>a.status==="broken").length};return {handled:true,text:JSON.stringify({protocols:r,health:o},null,2)}}default:return {handled:false,text:""}}}function Rd(t){let e={action:t.action};return t.target&&(e.target=t.target),t.template_from&&(e.template_from=t.template_from),t.reference&&(e.reference=t.reference),t.command&&(e.command=t.command),t.notes&&(e.notes=t.notes),e}j();var Tt=null,Js=false;async function Us(t){if(Tt)Js||(await Tt.ensureReady(),Js=true);else {let e=H.join(t,".paradigm","sentinel","sentinel.db");Tt=new f$5(e),await Tt.ensureReady(),Js=true;}return Tt}async function Pd(t,e){return (await Us(t)).recordPracticeEvent(e)}async function pa(t,e){return (await Us(t)).getPracticeEvents(e)}async function le(t,e){return (await Us(t)).getComplianceRate(e)}async function At(t,e){let s=["discovery","verification","testing","documentation","collaboration","security"],n=[];for(let i of s){let r=await le(t,{...e,habitCategory:i});r.total>0&&n.push({category:i,...r});}return n}async function ua(t,e,s){let n=[];for(let i of e){let r=await Pd(t,{habitId:i.habitId,habitCategory:i.habitCategory,result:i.result,engineer:s.engineer,sessionId:s.sessionId,loreEntryId:s.loreEntryId,taskDescription:s.taskDescription,symbolsTouched:s.symbolsTouched,filesModified:s.filesModified,notes:i.notes});n.push(r);}return n}b$1();function ga(t){return {handled:true,text:JSON.stringify({error:t},null,2)}}var $n={code:"lore_type_decision_removed",message:"lore type 'decision' was removed in v6.0. Use paradigm_decision_record instead. The decision will be stored in .paradigm/decisions/ and a companion lore insight entry (type:'insight' with references.decision_id) will be written automatically so the timeline stays complete. For narrative-only references, use paradigm_lore_record({type:'insight', references:{decision_id}}).",successor_tool:"paradigm_decision_record",doc:"docs/private/plans/v6.0-decisions-locked.md",removed_in:"6.0.0"};function ma(){let t=process.env.PARADIGM_AUTHOR;if(t)return Bs(t);try{let e=execSync("git config user.name",{encoding:"utf-8",timeout:3e3}).trim();if(e)return Bs(e)}catch{}try{let e=ya.userInfo().username;if(e)return Bs(e)}catch{}return "unknown"}function Bs(t){return t.toLowerCase().replace(/[^a-z0-9-]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"").slice(0,20)||"unknown"}function ha(){return [{name:"paradigm_lore_search",description:"Search lore entries by symbol, author, date range, type, or tags. Returns project history records. Returns matching entries with titles, dates, and symbol references. ~200 tokens.",inputSchema:{type:"object",properties:{symbol:{type:"string",description:'Filter by symbol (e.g., "#sentinel-sdk", "^authenticated")'},author:{type:"string",description:'Filter by author (human user name, e.g., "ascend")'},hasAgent:{type:"boolean",description:"Filter by AI assistance: true = AI-assisted entries, false = human-only"},authorType:{type:"string",enum:["human","agent"],description:"(Deprecated, use hasAgent) Filter by old author type"},type:{type:"string",enum:["agent-session","human-note","review","incident","milestone","retro","insight"],description:"Filter by entry type"},tag:{type:"string",description:'Filter by tag prefix (e.g., "arc:lore-evolution" for arc entries)'},hasBody:{type:"boolean",description:"Filter for entries with/without long-form body content"},dateFrom:{type:"string",description:'Filter from date (ISO 8601, e.g., "2026-02-20")'},dateTo:{type:"string",description:"Filter to date (ISO 8601)"},tags:{type:"array",items:{type:"string"},description:"Filter by tags (OR logic)"},hasReview:{type:"boolean",description:"Filter for entries with/without reviews"},hasConfidence:{type:"boolean",description:"Filter for entries with/without confidence scores"},hasAssessment:{type:"boolean",description:"Filter for entries with/without assessment verdicts"},limit:{type:"number",description:"Maximum results (default: 20)"},offset:{type:"number",description:"Offset for pagination"}}},annotations:{readOnlyHint:true,destructiveHint:false},aliases:["history","what happened","past work","project history","previous sessions","lore"]},{name:"paradigm_lore_record",description:"Record a new lore entry (agent session, milestone, retro, insight, etc.). Call after completing significant work. Returns the created entry ID and file path. For decisions, use paradigm_decision_record (a companion lore insight is auto-written). ~100 tokens.",inputSchema:{type:"object",properties:{type:{type:"string",enum:["agent-session","human-note","review","incident","milestone","retro","insight"],description:"Entry type"},title:{type:"string",description:'Short title (e.g., "Built Sentinel Phase 1")'},summary:{type:"string",description:"2-3 sentence narrative summary"},symbols_touched:{type:"array",items:{type:"string"},description:'Symbols affected (e.g., ["#sentinel-sdk", "^authenticated"])'},symbols_created:{type:"array",items:{type:"string"},description:"New symbols introduced"},files_created:{type:"array",items:{type:"string"},description:"Files created"},files_modified:{type:"array",items:{type:"string"},description:"Files modified"},lines_added:{type:"number",description:"Lines of code added"},lines_removed:{type:"number",description:"Lines of code removed"},commit:{type:"string",description:"Git commit hash"},duration_minutes:{type:"number",description:"Duration in minutes"},decisions:{type:"array",items:{type:"object",properties:{id:{type:"string"},decision:{type:"string"},rationale:{type:"string"}},required:["id","decision","rationale"]},description:"Decisions made during this work"},errors_encountered:{type:"array",items:{type:"object",properties:{description:{type:"string"},resolution:{type:"string"},time_to_fix:{type:"string"}},required:["description","resolution"]}},learnings:{type:"array",items:{type:"string"},description:"Key learnings from this work"},verification:{type:"object",properties:{status:{type:"string",enum:["pass","fail","partial","untested"]},details:{type:"object",description:'Per-check results (e.g., { "build": "pass", "tests": "fail" })'}}},tags:{type:"array",items:{type:"string"},description:"Tags for categorization"},meta:{type:"object",description:'Project-defined metadata (open-ended key-value pairs, e.g., { meeting_type: "design-review", sprint: 12 })'},body:{type:"string",description:"Long-form content (detailed retrospective notes, decision rationale, etc.)"},linked_lore:{type:"array",items:{type:"string"},description:"Cross-references to other lore entry IDs"},linked_tasks:{type:"array",items:{type:"string"},description:"References to paradigm task IDs"},linked_commits:{type:"array",items:{type:"string"},description:"Git commit SHAs related to this entry"},confidence:{type:"number",description:"Agent confidence in correctness of this work (0.0 to 1.0)"},stream:{type:"string",enum:["work-log","journal","decision","auto"],description:'Knowledge stream classification. "auto" classifies based on content. Default: stores in lore (backward compatible).'}},required:["title","summary","symbols_touched"]},annotations:{readOnlyHint:false,destructiveHint:false}},{name:"paradigm_lore_timeline",description:"Get lore timeline overview: recent entries, active authors, hot symbols. Call for project history orientation. ~200 tokens.",inputSchema:{type:"object",properties:{limit:{type:"number",description:"Number of recent entries to include (default: 10)"}}},annotations:{readOnlyHint:true,destructiveHint:false}},{name:"paradigm_lore_get",description:"Fetch a single lore entry by ID. Returns the full entry with all fields. ~150 tokens.",inputSchema:{type:"object",properties:{id:{type:"string",description:'Lore entry ID (e.g., "L-2026-02-23-001" or "L-2026-03-02-ascend-143025-001")'}},required:["id"]},annotations:{readOnlyHint:true,destructiveHint:false}},{name:"paradigm_lore_update",description:"Update an existing lore entry. Merges provided fields into the existing entry. Returns updated entry confirmation. ~100 tokens.",inputSchema:{type:"object",properties:{id:{type:"string",description:"Lore entry ID to update"},title:{type:"string",description:"New title"},summary:{type:"string",description:"New summary"},type:{type:"string",enum:["agent-session","human-note","review","incident","milestone","retro","insight"],description:"New entry type"},symbols_touched:{type:"array",items:{type:"string"},description:"Updated symbols list"},symbols_created:{type:"array",items:{type:"string"},description:"Updated created symbols"},files_created:{type:"array",items:{type:"string"}},files_modified:{type:"array",items:{type:"string"}},lines_added:{type:"number"},lines_removed:{type:"number"},commit:{type:"string"},duration_minutes:{type:"number"},learnings:{type:"array",items:{type:"string"},description:"Updated learnings"},verification:{type:"object",properties:{status:{type:"string",enum:["pass","fail","partial","untested"]},details:{type:"object"}}},tags:{type:"array",items:{type:"string"}},confidence:{type:"number",description:"Agent confidence in correctness (0.0 to 1.0)"}},required:["id"]},annotations:{readOnlyHint:false,destructiveHint:false}},{name:"paradigm_lore_assess",description:"Record a human assessment verdict on a lore entry (correct/partial/incorrect). Computes calibration delta if confidence was recorded. ~100 tokens.",inputSchema:{type:"object",properties:{id:{type:"string",description:"Lore entry ID to assess"},verdict:{type:"string",enum:["correct","partial","incorrect"],description:"Assessment verdict on the decisions/changes made"},notes:{type:"string",description:"Optional assessment notes"}},required:["id","verdict"]},annotations:{readOnlyHint:false,destructiveHint:false}},{name:"paradigm_lore_calibration",description:"Query calibration statistics across assessed lore entries. Returns accuracy rate, average confidence, calibration score, and verdict breakdown. Supports groupBy for domain-specific reliability maps. ~200 tokens.",inputSchema:{type:"object",properties:{symbol:{type:"string",description:'Filter by symbol (e.g., "#auth-middleware")'},tag:{type:"string",description:"Filter by tag prefix"},author:{type:"string",description:"Filter by author"},dateFrom:{type:"string",description:"Filter from date (ISO 8601)"},dateTo:{type:"string",description:"Filter to date (ISO 8601)"},groupBy:{type:"string",enum:["symbol","tag","type"],description:"Group calibration stats by dimension"}}},annotations:{readOnlyHint:true,destructiveHint:false}},{name:"paradigm_lore_delete",description:"Delete a lore entry. Requires explicit confirmation to prevent accidental deletion. ~100 tokens.",inputSchema:{type:"object",properties:{id:{type:"string",description:"Lore entry ID to delete"},confirm:{type:"boolean",description:"Must be true to proceed with deletion"}},required:["id","confirm"]},annotations:{readOnlyHint:false,destructiveHint:true}}]}async function Dt(t,e,s){switch(t){case "paradigm_lore_search":{let n={author:e.author,hasAgent:e.hasAgent,authorType:e.authorType,symbol:e.symbol,dateFrom:e.dateFrom,dateTo:e.dateTo,type:e.type,tag:e.tag,hasBody:e.hasBody,tags:e.tags,hasReview:e.hasReview,hasConfidence:e.hasConfidence,hasAssessment:e.hasAssessment,limit:e.limit||20,offset:e.offset},i=await a$5(s.rootDir,n);return {handled:true,text:JSON.stringify({count:i.length,filter:Object.fromEntries(Object.entries(n).filter(([,r])=>r!==void 0)),entries:i.map(fa)},null,2)}}case "paradigm_lore_record":{let{type:n,title:i,summary:r,symbols_touched:o,symbols_created:a$1,files_created:c,files_modified:l,lines_added:d,lines_removed:p,commit:u,duration_minutes:g,decisions:m,errors_encountered:y,learnings:f,verification:b,tags:h,meta:w,body:S$1,linked_lore:k,linked_tasks:v,linked_commits:x,confidence:C}=e;if(n==="decision")return a.component("#lore").warn("rejected paradigm_lore_record({type:'decision'}) \u2014 removed in v6.0",{removed_in:$n.removed_in,successor_tool:$n.successor_tool}),ga($n);let _;try{let j=new Date(Date.now()-2592e6).toISOString(),T=await le(s.rootDir,{dateFrom:j});if(T.total>0){let I=(await At(s.rootDir,{dateFrom:j})).filter(F=>F.rate<60).map(F=>F.category);_={rate:T.rate,followed:T.followed,skipped:T.skipped,partial:T.partial,weakAreas:I.length>0?I:void 0};}}catch{}let P={id:"",type:n||"agent-session",timestamp:new Date().toISOString(),duration_minutes:g,author:ma(),agent:{provider:"anthropic",model:"claude-opus-4-6"},title:i,summary:r,symbols_touched:o,symbols_created:a$1,files_created:c,files_modified:l,lines_added:d,lines_removed:p,commit:u,decisions:m,errors_encountered:y,learnings:f,verification:b,tags:h,meta:w||void 0,habit_compliance:_,body:S$1,linked_lore:k,linked_tasks:v,linked_commits:x,confidence:C!=null&&C>=0&&C<=1?C:void 0},$=await d$3(s.rootDir,P);j$2().setLastLoreEntryId($);try{let j=process.env.PARADIGM_AGENT_ID;if(j&&o&&o.length>0){let{updateExpertiseFromLore:T}=await import('./agent-loader-W3RQJVW7.js');T(s.rootDir,j,{symbols_touched:o,confidence:C!=null&&C>=0&&C<=1?C:void 0});}}catch{}let R=null;try{c&&c.length>=2&&(R=S(s.rootDir,c,l||[]));}catch{}let A;if(e.stream){let j=e.stream,T=j==="auto"?Td(e):j;try{if(T==="work-log"){let{recordWorkLog:O}=await import('./work-log-loader-DL5GZ2BQ.js');O(s.rootDir,{agent:P.agent?.model||"unknown",summary:P.summary,outcome:P.verification?.status==="pass"?"pass":P.verification?.status==="fail"?"fail":"partial",files_modified:P.files_modified,symbols_touched:P.symbols_touched,commit:P.commit,linked_lore:P.id||$}),A="work-log";}else if(T==="journal"&&P.learnings?.length){let{recordJournalEntry:O}=await import('./journal-loader-GLH7XFTK.js');for(let I of P.learnings)O(P.agent?.model||"unknown",{trigger:"self_reflection",insight:I,project:s.projectName||"unknown",transferable:!1,linked_work_log:P.id||$});A="journal";}else if(T==="decision"&&P.decisions?.length){let{recordDecision:O}=await import('./decision-loader-HELL2AMX.js');for(let I of P.decisions)O(s.rootDir,{title:I.decision.slice(0,100),decision:I.decision,rationale:I.rationale,participants:[{id:`agent/${P.agent?.model||"unknown"}`,role:"agent",stance:"proposed"}],symbols_affected:P.symbols_touched,status:"active",linked_lore:P.id||$});A="decision";}}catch{}}return {handled:true,text:JSON.stringify({success:true,id:$,type:n,title:i,message:"Lore entry recorded successfully",...A?{stream:A}:{},...R?{protocol_suggestion:R}:{}})}}case "paradigm_lore_timeline":{let n=e.limit||10,i=await c$2(s.rootDir),r=await a$5(s.rootDir,{limit:n}),o={};for(let l of r)for(let d of l.symbols_touched)o[d]=(o[d]||0)+1;let a=Object.entries(o).sort(([,l],[,d])=>d-l).slice(0,10).map(([l,d])=>({symbol:l,count:d})),c={};for(let l of r){let d=l.author;c[d]||(c[d]={count:0,lastActive:l.timestamp,hasAgent:l.agent!=null}),c[d].count++,l.agent&&(c[d].hasAgent=true),l.timestamp>c[d].lastActive&&(c[d].lastActive=l.timestamp);}return {handled:true,text:JSON.stringify({timeline:i||{version:"1.0",project:"unknown",entries:0,last_updated:"",authors:[]},recentEntries:r.map(fa),hotSymbols:a,authors:Object.entries(c).map(([l,d])=>({id:l,hasAgent:d.hasAgent,entries:d.count,lastActive:d.lastActive}))},null,2)}}case "paradigm_lore_get":{let n=e.id,i=await b$4(s.rootDir,n);return i?{handled:true,text:JSON.stringify(i,null,2)}:{handled:true,text:JSON.stringify({error:`Lore entry not found: ${n}`})}}case "paradigm_lore_update":{let n=e.id,{id:i,...r}=e,o={};for(let[c,l]of Object.entries(r))l!==void 0&&(o[c]=l);let a=await g$4(s.rootDir,n,o);return {handled:true,text:JSON.stringify({success:a,id:n,message:a?"Lore entry updated":`Lore entry not found: ${n}`})}}case "paradigm_lore_assess":{let n=e.id,i=e.verdict,r=e.notes,o=await b$4(s.rootDir,n);if(!o)return {handled:true,text:JSON.stringify({error:`Lore entry not found: ${n}`})};let a={verdict:i,assessed_by:ma(),assessed_at:new Date().toISOString(),notes:r},c=await h$3(s.rootDir,n,a);try{let u=process.env.PARADIGM_AGENT_ID;if(u&&c&&o.symbols_touched?.length){let{updateExpertiseFromAssessment:g}=await import('./agent-loader-W3RQJVW7.js');g(s.rootDir,u,{symbols_touched:o.symbols_touched,verdict:i});}}catch{}let l=i==="correct"?1:i==="partial"?.5:0,d=o.confidence!=null?l-o.confidence:null,p=d!=null?d>.1?"Under-confident (actual outcome better than predicted)":d<-0.1?"Over-confident (actual outcome worse than predicted)":"Well-calibrated":"No confidence recorded \u2014 delta not computed";return {handled:true,text:JSON.stringify({success:c,id:n,verdict:i,confidence:o.confidence??null,delta:d,deltaDescription:p,message:c?`Assessment recorded: ${i}${d!=null?` (delta: ${d>0?"+":""}${d.toFixed(2)})`:""}`:`Failed to assess: ${n}`})}}case "paradigm_lore_calibration":{let n={symbol:e.symbol,tag:e.tag,author:e.author,dateFrom:e.dateFrom,dateTo:e.dateTo,hasAssessment:true},i=await a$5(s.rootDir,n),r=i.filter(S=>S.confidence!=null),o=i.length,a=r.length,c={correct:0,partial:0,incorrect:0},l=0,d=0,p=0;for(let S of i){let k=S.assessment.verdict;c[k]++;let v=k==="correct"?1:k==="partial"?.5:0;l+=v,S.confidence!=null&&(d+=S.confidence,p+=Math.abs(v-S.confidence));}let u=o>0?l/o:0,g=a>0?d/a:null,m=a>0?l/o-d/a:null,y=a>0?1-p/a:null,f=e.groupBy,b;if(f&&o>0){let S=new Map;for(let k of i){let v=[];f==="symbol"?v=k.symbols_touched||[]:f==="tag"?v=k.tags||[]:f==="type"&&(v=[k.type||"agent-session"]);for(let x of v)S.has(x)||S.set(x,[]),S.get(x).push(k);}b=Array.from(S.entries()).map(([k,v])=>{let x=v.filter(R=>R.confidence!=null),C={correct:0,partial:0,incorrect:0},_=0,P=0,$=0;for(let R of v){let A=R.assessment.verdict;C[A]++;let j=A==="correct"?1:A==="partial"?.5:0;_+=j,R.confidence!=null&&(P+=R.confidence,$+=Math.abs(j-R.confidence));}return {key:k,total:v.length,accuracyRate:_/v.length,avgConfidence:x.length>0?P/x.length:null,calibrationScore:x.length>0?1-$/x.length:null,verdictBreakdown:C}}).sort((k,v)=>v.total-k.total);}let h=[],w=o<5?`Low sample size (N=${o}). Stats may not be representative.`:o<15?`Moderate sample (N=${o}). Trends are directional, not conclusive.`:null;return w&&h.push(w),y!=null&&(y>=.9?h.push("Excellent calibration \u2014 confidence predictions closely match outcomes."):y>=.7?h.push("Good calibration \u2014 some room for improvement in confidence estimates."):y>=.5?h.push("Fair calibration \u2014 significant gap between predicted confidence and outcomes."):h.push("Poor calibration \u2014 confidence predictions diverge substantially from outcomes.")),m!=null&&(m>.15?h.push("Tendency toward under-confidence \u2014 outcomes are better than predicted."):m<-0.15&&h.push("Tendency toward over-confidence \u2014 outcomes are worse than predicted.")),c.incorrect>o*.3&&o>=5&&h.push(`High error rate: ${c.incorrect}/${o} entries assessed as incorrect.`),{handled:true,text:JSON.stringify({totalAssessed:o,totalWithConfidence:a,accuracyRate:Math.round(u*1e3)/1e3,avgConfidence:g!=null?Math.round(g*1e3)/1e3:null,avgDelta:m!=null?Math.round(m*1e3)/1e3:null,calibrationScore:y!=null?Math.round(y*1e3)/1e3:null,verdictBreakdown:c,...b?{groups:b}:{},insights:h},null,2)}}case "paradigm_lore_delete":{let n=e.id;if(!e.confirm)return {handled:true,text:JSON.stringify({success:false,message:"Deletion requires confirm: true"})};let r=await i$1(s.rootDir,n);return {handled:true,text:JSON.stringify({success:r,id:n,message:r?"Lore entry deleted":`Lore entry not found: ${n}`})}}default:return {handled:false,text:""}}}function Td(t){return t.task_ref||t.files_modified||t.commit?"work-log":t.learnings||t.confidence!==void 0?"journal":t.decisions?.some(s=>s.rationale)?"decision":"work-log"}function fa(t){return {id:t.id,type:t.type,title:t.title,summary:t.summary,author:t.author,agent:t.agent,timestamp:t.timestamp,duration_minutes:t.duration_minutes,symbols_touched:t.symbols_touched,verification:t.verification?.status,review:t.review?{completeness:t.review.completeness,quality:t.review.quality}:null,confidence:t.confidence??null,assessment:t.assessment?t.assessment.verdict:null,assessment_delta:t.assessment_delta??null,tags:t.tags}}function wa(){return [{name:"paradigm_captain_brief",description:"Cid's pre-task context discovery pipeline. Searches symbols, maps blast radius, checks gates, finds protocols, surfaces warnings, and produces a Context Brief injected into every subsequent agent. Call before starting any multi-file task. ~400 tokens.",inputSchema:{type:"object",properties:{taskDescription:{type:"string",description:"The task to produce a context brief for"},symbols:{type:"array",items:{type:"string"},description:'Optional pre-known symbols to anchor the search (e.g., ["#auth", "^authenticated"])'},depth:{type:"string",enum:["quick","standard","deep"],description:"Brief depth. quick=search+navigate only (<800 tokens). standard=+ripple top 3+wisdom. deep=+ripple top 5+full lore scan. Default: standard"}},required:["taskDescription"]},annotations:{readOnlyHint:true,destructiveHint:false}},{name:"paradigm_captain_debrief",description:"Cid's post-task maintenance pass. Audits .purpose coverage for touched directories, creates stubs for gaps, queues rich doc areas to Documentor, records lore, and writes the .cid-briefed marker that clears the stop hook. Call after all agents complete. ~200 tokens.",inputSchema:{type:"object",properties:{orchestrationId:{type:"string",description:"The orchestration run ID (from paradigm_orchestrate_inline)"},sessionSummary:{type:"string",description:"What was accomplished in this session"},touchedFiles:{type:"array",items:{type:"string"},description:"Files modified during this session"},newSymbols:{type:"array",items:{type:"string"},description:"New symbols registered during this session"},notes:{type:"string",description:"Optional additional notes from the orchestrating session"}},required:["orchestrationId","sessionSummary","touchedFiles"]},annotations:{readOnlyHint:false,destructiveHint:false}}]}async function Ot(t,e,s){return t==="paradigm_captain_brief"?Ad(e,s):t==="paradigm_captain_debrief"?Dd(e,s):{handled:false,text:""}}async function Ad(t,e){let s=t.taskDescription,n=t.symbols||[],i=t.depth||"standard",r=H.join(e.rootDir,".paradigm"),o=H.join(r,".cid-session"),a=H.join(r,".cid-briefed");try{E.existsSync(a)&&E.unlinkSync(a);let j={timestamp:new Date().toISOString(),taskDescription:s.slice(0,200),depth:i};E.mkdirSync(r,{recursive:!0}),E.writeFileSync(o,JSON.stringify(j,null,2),"utf8");}catch{}let c=Od(s),l=[],d=new Set;for(let j of n)if(!d.has(j)){d.add(j);let T=ba(j);l.push({id:j,type:T,description:"Provided as anchor symbol"});}let p=[];try{for(let j of c.slice(0,3)){let O=m(e.index,j).slice(0,5);for(let I of O)if(!d.has(I.symbol)){d.add(I.symbol);let F=$d(I.type);l.push({id:I.symbol,type:F,description:I.description||"",file:I.file}),p.push(I.symbol);}}}catch{}let u={directories:[],files:[]};try{let j=await _n("paradigm_navigate",{intent:"context",task:s,response_format:"concise"},e);if(j.handled){let T=JSON.parse(j.text);if(T.files)for(let O of T.files){let I=typeof O=="string"?O:O.path||O.file||"";I&&u.files.push(I);}if(T.directories)for(let O of T.directories){let I=typeof O=="string"?O:O.path||O.directory||"";I&&u.directories.push(I);}if(T.symbols)for(let O of T.symbols){let I=typeof O=="string"?O:O.id;I&&!d.has(I)&&(d.add(I),l.push({id:I,type:ba(I),description:typeof O=="object"&&O.description||""}));}}}catch{}let g=new Set(u.directories);for(let j of u.files){let T=H.dirname(j);T&&T!=="."&&g.add(T);}let m$1=l.slice(0,i==="deep"?5:3),y={affectedFiles:[],affectedSymbols:[],affectedFlows:[],affectedGates:[],fragileSymbols:[]};if(i!=="quick"&&m$1.length>0)for(let j of m$1)try{let T=await On("paradigm_ripple",{symbol:j.id,depth:2,response_format:"concise"},e);if(T.handled){let O=JSON.parse(T.text);if(O.analysis){for(let I of O.analysis.directlyAffected||[]){let F=I.symbol||I;F&&!y.affectedSymbols.includes(F)&&y.affectedSymbols.push(F);}for(let I of O.analysis.indirectlyAffected||[])I&&!y.affectedSymbols.includes(I)&&y.affectedSymbols.push(I);}if(O.affectedFlows?.affectedFlows)for(let I of O.affectedFlows.affectedFlows){let F=I.flowId||I;F&&!y.affectedFlows.includes(F)&&y.affectedFlows.push(F);}if(O.affectedGates)for(let I of O.affectedGates){let F=I.gate||I;F&&!y.affectedGates.includes(F)&&y.affectedGates.push(F);}O.impact==="high"&&(y.fragileSymbols.includes(j.id)||y.fragileSymbols.push(j.id));}}catch{}let f=[],b=Id(s);if(b.length>0)try{let{handleGatesForRoute:j}=await import('./tools-XKI47YFC.js').catch(()=>({handleGatesForRoute:null})),T=H.join(e.rootDir,"portal.yaml");if(E.existsSync(T)){let O=E.readFileSync(T,"utf8");for(let I of b){let F=O.includes(I);f.push({route:I,gate:"^authenticated",declared:F});}}else for(let O of b)f.push({route:O,gate:"(unknown \u2014 no portal.yaml)",declared:!1});}catch{}let h=[];if(i!=="quick"&&l.length>0)try{let j=l.slice(0,5).map(O=>O.id),T=await kn("paradigm_wisdom_context",{symbols:j,include_global:!0},e);if(T.handled){let O=JSON.parse(T.text);if(O.antipatterns)for(let I of O.antipatterns.slice(0,3)){let F=I.pattern||I.description||I.text||String(I);F&&!h.includes(F)&&h.push(F);}if(O.wisdom?.antipatterns)for(let I of O.wisdom.antipatterns.slice(0,3)){let F=I.pattern||I.description||String(I);F&&!h.includes(F)&&h.push(F);}}}catch{}let w={matched:false};try{let j=await In("paradigm_protocol_search",{task:s,limit:1},e);if(j.handled){let T=JSON.parse(j.text),O=T.matches||T.protocols||T.results||[];if(O.length>0){let I=O[0];w={matched:!0,id:I.id,name:I.name||I.title,steps:(I.steps||[]).slice(0,5).map(F=>typeof F=="string"?F:F.description||String(F))};}}}catch{}let S=[];if(i!=="quick")try{let j=l[0]?.id,T={limit:i==="deep"?5:3};j&&(T.symbol=j);let O=await Dt("paradigm_lore_search",T,e);if(O.handled){let F=JSON.parse(O.text).entries||[];for(let q of F.slice(0,3))S.push({id:q.id,summary:(q.summary||q.title||"").slice(0,100),relevance:j?`Related to ${j}`:"Recent project history"});}}catch{}let k=Array.from(g),v=0;for(let j of k){let T=H.join(e.rootDir,j,".purpose");if(E.existsSync(T))try{E.readFileSync(T,"utf8").trim().length>50&&v++;}catch{}}let x=k.length>0?v/k.length:.5,C=Fd(x),_=Nd(x,C,k.length),P=y.affectedSymbols.length+u.files.length,$=P>20?"large":P>8?"medium":P>2?"small":"tiny",R={territory:{directories:k.slice(0,10),files:u.files.slice(0,10),estimatedScope:$},symbols:l.slice(0,10),blastRadius:y,gates:f,protocol:w,warnings:h,coverage:{score:x,label:C,note:_},loreRefs:S,archMap:b$a(e.rootDir),renderedBrief:""};R.renderedBrief=Ed(R);try{let j={timestamp:new Date().toISOString(),taskDescription:s.slice(0,200),depth:i,coverageScore:x};E.writeFileSync(o,JSON.stringify(j,null,2),"utf8");}catch{}let A=JSON.stringify(R,null,2);return a$2(A.length,"paradigm_captain_brief"),{handled:true,text:A}}async function Dd(t,e){let s=t.orchestrationId,n=t.sessionSummary,i=t.touchedFiles||[],r=t.newSymbols||[],o=t.notes,a=H.join(e.rootDir,".paradigm"),c=H.join(a,".cid-briefed"),l=H.join(a,".pending-review"),d=new Set;for(let _ of i){let P=H.dirname(_);P&&P!=="."&&d.add(P);}let p=0,u=d.size;for(let _ of d){let P=H.join(e.rootDir,_,".purpose");if(E.existsSync(P))try{E.readFileSync(P,"utf8").trim().length>50&&p++;}catch{}}let g=u>0?p/u:1,m=[],y=[];for(let _ of d){let P=H.join(e.rootDir,_,".purpose"),$=H.join(e.rootDir,_),R=false;if(E.existsSync(P))try{R=E.readFileSync(P,"utf8").trim().length>50;}catch{}if(R){if(i.some(j=>H.dirname(j)===_&&r.length>0)){y.push(_);try{let j=JSON.stringify({path:_,reason:"captain-debrief-new-symbols",priority:"medium",context:`New symbols added during orchestration ${s}: ${r.join(", ")}`,timestamp:new Date().toISOString()});E.appendFileSync(l,j+`
|
|
63
63
|
`,"utf8");}catch{}}}else try{if(!E.existsSync($))continue;let A=H.basename(_),j=Hd(A,_,i);E.writeFileSync(P,j,"utf8"),m.push(_),y.push(_);try{let T=JSON.stringify({path:_,reason:"captain-debrief",priority:"high",context:`Touched during orchestration ${s}. Files: ${i.filter(O=>H.dirname(O)===_).join(", ")}`,timestamp:new Date().toISOString()});E.appendFileSync(l,T+`
|
|
64
64
|
`,"utf8");}catch{}}catch{}}let f=0;for(let _ of d){let P=H.join(e.rootDir,_,".purpose");if(E.existsSync(P))try{E.readFileSync(P,"utf8").trim().length>50&&f++;}catch{}}let b=u>0?f/u:1,h="";try{let _=await Dt("paradigm_lore_record",{type:"agent-session",title:`Cid Debrief: ${n.slice(0,80)}`,summary:n,symbols_touched:r,files_modified:i,tags:["arc:cid-debrief",`orch:${s}`],meta:{orchestrationId:s,coverageScore:{before:g,after:b},coverageAdded:m,...o?{notes:o}:{}}},e);if(_.handled){let P=JSON.parse(_.text);h=P.id||P.entry?.id||"";}}catch{}let w=false;try{let _={timestamp:new Date().toISOString(),sessionId:s,touchedFiles:i,coverageScore:b};E.mkdirSync(a,{recursive:!0}),E.writeFileSync(c,JSON.stringify(_,null,2),"utf8"),w=!0;}catch{}let S={taskDescription:n,orchestrationId:s,agentContributions:[],coverageDelta:{before:g,after:b},newSymbols:r,touchedFiles:i,notes:o||""};try{let _=H.join(a,"events","session-log.jsonl");if(E.existsSync(_)){let R=E.readFileSync(_,"utf8").split(`
|
|
65
65
|
`).filter(j=>j.trim().length>0).slice(-50),A=new Map;for(let j of R)try{let T=JSON.parse(j),O=T.agentId||T.agent||T.role||"";if(!O)continue;A.has(O)||A.set(O,{contributions:[],symbolsTouched:new Set,patternsObserved:[]});let I=A.get(O),F=T.action||T.event||T.message||"";if(F&&I.contributions.push(String(F).slice(0,120)),Array.isArray(T.symbols))for(let Te of T.symbols)I.symbolsTouched.add(String(Te));let q=T.symbol||"";if(q&&I.symbolsTouched.add(q),Array.isArray(T.patterns))for(let Te of T.patterns)I.patternsObserved.includes(String(Te))||I.patternsObserved.push(String(Te));}catch{}for(let[j,T]of A.entries())S.agentContributions.push({agentId:j,contribution:T.contributions.slice(-3).join(" | "),symbolsTouched:Array.from(T.symbolsTouched).slice(0,10),patternsObserved:T.patternsObserved.slice(0,5)});}}catch{}S.agentContributions.length===0&&S.agentContributions.push({agentId:"session",contribution:n.slice(0,200),symbolsTouched:r.slice(0,10),patternsObserved:[]});let k={coverageAdded:m,delegatedToDocumentor:y,loreEntryId:h,coverageScore:{before:g,after:b,delta:b-g},stopHookCleared:w,sessionInsights:S},v=["","\u2501\u2501\u2501 LEARNING HANDOFF (\u2192 Loid) \u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501","","Cid has prepared session insights for Loid's learning pass.","Call paradigm_ambient_learn_postflight with the sessionInsights","from this debrief to complete the session.","","sessionInsights available in: debrief.sessionInsights"].join(`
|
|
@@ -496,7 +496,7 @@ to break plans before code breaks in production.
|
|
|
496
496
|
- Write implementation code
|
|
497
497
|
- Block progress without justification \u2014 you challenge, not obstruct
|
|
498
498
|
- Repeat concerns already addressed in the task description
|
|
499
|
-
- Produce lengthy analysis \u2014 be sharp and concise`,cartographer:`You are
|
|
499
|
+
- Produce lengthy analysis \u2014 be sharp and concise`,cartographer:`You are TOPO, the CARTOGRAPHER agent.
|
|
500
500
|
|
|
501
501
|
## Your Role
|
|
502
502
|
You maintain and audit the project's architectural layer map (.paradigm/arch.yaml).
|
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import {a}from'./chunk-LKAT7IAK.js';import'./chunk-5TAVYPOV.js';import {Command}
|
|
|
3
3
|
${y.magenta("\u2554\u2550\u2557")}${y.cyan("\u250C\u2500\u2510\u252C\u2500\u2510\u250C\u2500\u2510\u250C\u252C\u2510\u252C \u250C\u2500\u2510\u250C\u252C\u2510")}
|
|
4
4
|
${y.magenta("\u2560\u2550\u255D")}${y.cyan("\u251C\u2500\u2524\u251C\u252C\u2518\u251C\u2500\u2524 \u2502\u2502\u2502 \u251C\u2500\u2510\u2502\u2502\u2502")}
|
|
5
5
|
${y.magenta("\u2569 ")}${y.cyan("\u2534 \u2534\u2534\u2514\u2500\u2534 \u2534\u2500\u2534\u2518\u2534 \u2514\u2500\u2518\u2534 \u2534")} ${y.gray(`v${z}`)}
|
|
6
|
-
`;i.name("paradigm").description("Unified developer tools ecosystem").version(z).addHelpText("before",_);i.hook("preAction",async()=>{try{let{checkAndEmitMigrationNotices:t}=await import('./migration-notices-MRZ6PVDS.js');await t(process.cwd());}catch{}});i.command("init").description("Initialize Paradigm in the current project").option("-f, --force","Overwrite existing files").option("--name <name>","Project name").option("--ide <ide>","Target IDE: cursor, copilot, windsurf, claude").option("--stack <stack>","Stack preset (e.g., nextjs, fastapi, swift-ios). Auto-detected if omitted.").option("--migrate","Output migration prompt for existing IDE files").option("--quick","Non-interactive mode with smart defaults").option("--dry-run","Show what would be created without creating").action(async t=>{let{initCommand:o}=await import('./init-V4KSEKPK.js');await o(t);});i.command("shift").description("Full project setup in one command (init + team init + scan + sync all IDEs + doctor)").option("-f, --force","Reinitialize even if already setup").option("-q, --quick","Skip slow operations (scan)").option("--verify","Run health checks after setup").option("--ide <ide>","Target specific IDE instead of all").option("--configure-models","Force model configuration prompts for team agents").option("--stack <stack>","Stack preset (e.g., nextjs, fastapi, swift-ios). Auto-detected if omitted.").option("--workspace <name>","Create or join a multi-project workspace with this name (creates ../.paradigm-workspace)").option("--workspace-path <path>","Custom workspace file location (default: ../.paradigm-workspace)").option("--no-prompt","Skip interactive prompts (e.g., compliance-archetype nomination)").action(async t=>{let{shiftCommand:o}=await import('./shift-
|
|
6
|
+
`;i.name("paradigm").description("Unified developer tools ecosystem").version(z).addHelpText("before",_);i.hook("preAction",async()=>{try{let{checkAndEmitMigrationNotices:t}=await import('./migration-notices-MRZ6PVDS.js');await t(process.cwd());}catch{}});i.command("init").description("Initialize Paradigm in the current project").option("-f, --force","Overwrite existing files").option("--name <name>","Project name").option("--ide <ide>","Target IDE: cursor, copilot, windsurf, claude").option("--stack <stack>","Stack preset (e.g., nextjs, fastapi, swift-ios). Auto-detected if omitted.").option("--migrate","Output migration prompt for existing IDE files").option("--quick","Non-interactive mode with smart defaults").option("--dry-run","Show what would be created without creating").action(async t=>{let{initCommand:o}=await import('./init-V4KSEKPK.js');await o(t);});i.command("shift").description("Full project setup in one command (init + team init + scan + sync all IDEs + doctor)").option("-f, --force","Reinitialize even if already setup").option("-q, --quick","Skip slow operations (scan)").option("--verify","Run health checks after setup").option("--ide <ide>","Target specific IDE instead of all").option("--configure-models","Force model configuration prompts for team agents").option("--stack <stack>","Stack preset (e.g., nextjs, fastapi, swift-ios). Auto-detected if omitted.").option("--workspace <name>","Create or join a multi-project workspace with this name (creates ../.paradigm-workspace)").option("--workspace-path <path>","Custom workspace file location (default: ../.paradigm-workspace)").option("--no-prompt","Skip interactive prompts (e.g., compliance-archetype nomination)").action(async t=>{let{shiftCommand:o}=await import('./shift-QY3EXVF4.js');await o(t);});i.command("presets").description("List available stack presets for paradigm init/shift").option("-d, --discipline <discipline>","Filter by discipline (e.g., fullstack, api, mobile)").action(async t=>{let{listStackPresets:o}=await import('./discipline-H7LDI6NT.js'),a=(await import('chalk')).default,e=o(t.discipline);if(e.length===0){console.log(a.yellow(`
|
|
7
7
|
No presets found${t.discipline?` for discipline: ${t.discipline}`:""}
|
|
8
8
|
`));return}console.log(a.blue(`
|
|
9
9
|
Available Stack Presets
|
package/dist/mcp.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {d,g,h,e,a as a$1,b as b$2,f,c}from'./chunk-KGUQPYCF.js';import {b as b$1,ga}from'./chunk-5NAF6CKU.js';import'./chunk-4UJ4NIEQ.js';import'./chunk-4N56FRNE.js';import'./chunk-Q527BPUF.js';import'./chunk-KLBH26PA.js';import'./chunk-ARLB6YYW.js';import {p,q as q$1,k,l as l$1}from'./chunk-SU5F5D4I.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 m from'path';function se(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 L(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,{...se(o),source:"portal.yaml"});return Array.from(t.values())}function F(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 z(){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 U(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 $(){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 G(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 q(){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 H(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 {d,g,h,e,a as a$1,b as b$2,f,c}from'./chunk-MTLWAWHE.js';import {b as b$1,ga}from'./chunk-5NAF6CKU.js';import'./chunk-4UJ4NIEQ.js';import'./chunk-4N56FRNE.js';import'./chunk-Q527BPUF.js';import'./chunk-KLBH26PA.js';import'./chunk-ARLB6YYW.js';import {p,q as q$1,k,l as l$1}from'./chunk-SU5F5D4I.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 m from'path';function se(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 L(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,{...se(o),source:"portal.yaml"});return Array.from(t.values())}function F(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 z(){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 U(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 $(){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 G(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 q(){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 H(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 @@ Generated by paradigm shift.
|
|
|
48
48
|
|
|
49
49
|
Generated by paradigm shift.
|
|
50
50
|
`},{path:".cursor/rules/",defaultContent:"",isDir:true},{path:".claude/hooks/",defaultContent:"",isDir:true}];async function Q(o){let n=[],l=[];for(let r of ae){let f=d.join(o,r.path);if(r.isDir)await X(f)?l.push(r.path):(await C.mkdir(f,{recursive:true}),n.push(r.path));else if(await X(f))l.push(r.path);else {let i=d.dirname(f);await C.mkdir(i,{recursive:true}),await C.writeFile(f,r.defaultContent,"utf-8"),n.push(r.path);}}return {created:n,existed:l}}async function X(o){try{return await C.access(o),!0}catch{return false}}var ie=4,se=50,ce=['description: ""',"components: []","description: ''"],le={"claude-code":["opus","sonnet","haiku"],cursor:["sonnet","sonnet","haiku"],fallback:["sonnet","sonnet","sonnet"]};async function Z(o){let n=await Promise.allSettled([de(o),pe(o),fe(o),me(o),ue(o),ge(o),ye(o),he(o),we()]),l=[];for(let i of n)i.status==="fulfilled"&&i.value&&l.push(i.value);l.sort((i,b)=>i.priority-b.priority);let r=l.filter(i=>i.type==="action"),f=l.filter(i=>i.type==="info");return [...r.slice(0,ie),...f]}function ee(o){if(o.length===0)return "";let n=o.filter(m=>m.type==="action"),l=o.filter(m=>m.type==="info"),r=[];r.push(""),r.push(e.bold(" Recommendations")),r.push(e.gray(" "+"\u2500".repeat(49)));for(let m=0;m<n.length;m++){let i=n[m],b=e.white(` ${m+1}. `),S=e.white(i.message);i.command?(r.push(b+S),r.push(" "+e.cyan(i.command))):r.push(b+S);}if(l.length>0){r.push("");for(let m of l)r.push(e.dim(" "+m.message));}let f=n.length;if(f>0){r.push("");let m=f===1?"item needs":"items need";r.push(e.dim(` ${f} ${m} attention.`));}return r.push(""),r.join(`
|
|
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:"
|
|
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
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()+`
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
export{h as registerTools}from'./chunk-
|
|
2
|
+
export{h as registerTools}from'./chunk-MTLWAWHE.js';import'./chunk-5NAF6CKU.js';import'./chunk-4UJ4NIEQ.js';import'./chunk-4N56FRNE.js';import'./chunk-Q527BPUF.js';import'./chunk-KLBH26PA.js';import'./chunk-ARLB6YYW.js';import'./chunk-SU5F5D4I.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'./chunk-6QXBXZF6.js';import'./chunk-EK4ZRIFJ.js';import'./chunk-LAYBUKMB.js';import'./chunk-DVZWCXB6.js';import'./chunk-QGZRM6ZB.js';import'./chunk-K7X3Z3GL.js';import'./chunk-5TAVYPOV.js';
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
id: architect
|
|
2
|
-
nickname:
|
|
2
|
+
nickname: Arky
|
|
3
3
|
role: System architect specializing in paradigm hooks, lore systems, and distributed architecture. Deliberate and precise.
|
|
4
4
|
description: System architect specializing in paradigm hooks, lore systems, and distributed architecture. Deliberate and precise.
|
|
5
5
|
version: 0.1.0
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
id: cartographer
|
|
2
|
+
nickname: Topo
|
|
3
|
+
role: Architecture cartographer — maps system topology, tier structure, and drift between declared architecture and live code.
|
|
4
|
+
description: |-
|
|
5
|
+
Topo maintains and audits the project's architectural layer map at
|
|
6
|
+
.paradigm/arch.yaml. He reads the map, computes drift between the
|
|
7
|
+
declared architecture and the live symbol graph, and renders
|
|
8
|
+
architecture diagrams on request. Topo is advisory-only — he never
|
|
9
|
+
blocks progress, never writes source code, and never modifies
|
|
10
|
+
.purpose files, portal.yaml, or arch.yaml directly. His value is
|
|
11
|
+
legibility: turning the project's structure into a picture the team
|
|
12
|
+
can hold in its head.
|
|
13
|
+
|
|
14
|
+
Topo's outputs are sharp and short. Tier summaries name component
|
|
15
|
+
counts and tech stacks per tier. Drift reports name unassigned
|
|
16
|
+
symbols (in the index but not in any tier) and stale map entries
|
|
17
|
+
(in arch.yaml but not indexed). Mermaid diagrams render the current
|
|
18
|
+
topology ready for copy-paste. Recommendations are concrete — which
|
|
19
|
+
tier a drifting component belongs in, which stale entry to remove —
|
|
20
|
+
not abstract architectural musing.
|
|
21
|
+
|
|
22
|
+
He runs after the Builder stage when arch.yaml exists, or on
|
|
23
|
+
demand when the user asks for an architecture overview. He hands
|
|
24
|
+
off to the architect when drift suggests a structural change, and
|
|
25
|
+
to the documentor when stale entries need to be reconciled in
|
|
26
|
+
.purpose files. He pairs naturally with Cid (Captain), who knows
|
|
27
|
+
where the team is heading; Topo knows what the terrain looks like.
|
|
28
|
+
|
|
29
|
+
version: 1.0.0
|
|
30
|
+
created: '2026-05-26'
|
|
31
|
+
updated: '2026-05-26'
|
|
32
|
+
|
|
33
|
+
personality:
|
|
34
|
+
style: precise
|
|
35
|
+
risk: conservative
|
|
36
|
+
verbosity: concise
|
|
37
|
+
|
|
38
|
+
expertise:
|
|
39
|
+
- symbol: "#arch"
|
|
40
|
+
confidence: 0.92
|
|
41
|
+
rationale: Owns arch.yaml read/write semantics and tier drift computation.
|
|
42
|
+
- symbol: "#symbol-graph"
|
|
43
|
+
confidence: 0.85
|
|
44
|
+
rationale: Reads the symbol index to compute drift against declared architecture.
|
|
45
|
+
|
|
46
|
+
attention:
|
|
47
|
+
symbols:
|
|
48
|
+
- "#arch"
|
|
49
|
+
- "#arch-*"
|
|
50
|
+
- "$architecture-*"
|
|
51
|
+
- "~architectural-drift"
|
|
52
|
+
paths:
|
|
53
|
+
- ".paradigm/arch.yaml"
|
|
54
|
+
- ".paradigm/symbol-index.json"
|
|
55
|
+
- "packages/paradigm-mcp/src/utils/arch-loader.ts"
|
|
56
|
+
- "packages/paradigm-mcp/src/tools/arch.ts"
|
|
57
|
+
- "packages/paradigm/src/commands/arch.ts"
|
|
58
|
+
concepts:
|
|
59
|
+
- architecture map
|
|
60
|
+
- tier structure
|
|
61
|
+
- architectural drift
|
|
62
|
+
- component assignment
|
|
63
|
+
- mermaid diagram
|
|
64
|
+
- dependency topology
|
|
65
|
+
- layer map
|
|
66
|
+
- missing purpose
|
|
67
|
+
- unassigned symbol
|
|
68
|
+
threshold: 0.45
|
|
69
|
+
|
|
70
|
+
behaviors:
|
|
71
|
+
- Read .paradigm/arch.yaml and summarize tier structure for the team
|
|
72
|
+
- Compute drift between declared architecture and live symbols
|
|
73
|
+
- Render Mermaid diagrams of architecture on request
|
|
74
|
+
- Surface drift as advisory findings, never as blocking errors
|
|
75
|
+
- Recommend concrete resolutions for drift without implementing them
|
|
76
|
+
- Hand off structural changes to the architect, stale entries to the documentor
|
|
77
|
+
|
|
78
|
+
transferable: []
|
|
79
|
+
contexts: {}
|
|
80
|
+
|
|
81
|
+
scopes:
|
|
82
|
+
read:
|
|
83
|
+
- ".paradigm/arch.yaml"
|
|
84
|
+
- ".paradigm/symbol-index.json"
|
|
85
|
+
- "**/.purpose"
|
|
86
|
+
write: []
|
|
87
|
+
tools:
|
|
88
|
+
allow:
|
|
89
|
+
- "paradigm_arch_status"
|
|
90
|
+
- "paradigm_arch_diagram"
|
|
91
|
+
deny:
|
|
92
|
+
- "paradigm_purpose_*"
|
|
93
|
+
- "paradigm_portal_*"
|
|
94
|
+
|
|
95
|
+
tags:
|
|
96
|
+
- architecture
|
|
97
|
+
- cartography
|
|
98
|
+
- drift
|
|
99
|
+
- advisory
|
|
100
|
+
- mermaid
|