opencastle 1.6.3 → 1.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (194) hide show
  1. package/README.md +9 -9
  2. package/bin/cli.mjs +6 -4
  3. package/dist/cli/adapters/adapter-contract.test.js +1 -1
  4. package/dist/cli/adapters/single-file-base.d.ts.map +1 -1
  5. package/dist/cli/adapters/single-file-base.js +2 -12
  6. package/dist/cli/adapters/single-file-base.js.map +1 -1
  7. package/dist/cli/bootstrap.d.ts.map +1 -1
  8. package/dist/cli/bootstrap.js +32 -10
  9. package/dist/cli/bootstrap.js.map +1 -1
  10. package/dist/cli/bootstrap.test.js +10 -0
  11. package/dist/cli/bootstrap.test.js.map +1 -1
  12. package/dist/cli/command-namespace.test.js +4 -21
  13. package/dist/cli/command-namespace.test.js.map +1 -1
  14. package/dist/cli/convoy/engine.js +2 -2
  15. package/dist/cli/convoy/engine.js.map +1 -1
  16. package/dist/cli/convoy/read-model.d.ts +8 -15
  17. package/dist/cli/convoy/read-model.d.ts.map +1 -1
  18. package/dist/cli/convoy/read-model.js +9 -68
  19. package/dist/cli/convoy/read-model.js.map +1 -1
  20. package/dist/cli/convoy/read-model.test.js +6 -25
  21. package/dist/cli/convoy/read-model.test.js.map +1 -1
  22. package/dist/cli/convoy/spec-builder.d.ts +2 -2
  23. package/dist/cli/convoy/spec-builder.d.ts.map +1 -1
  24. package/dist/cli/convoy/spec-builder.js +1 -1
  25. package/dist/cli/dashboard.js +1 -1
  26. package/dist/cli/dashboard.test.js +10 -2
  27. package/dist/cli/dashboard.test.js.map +1 -1
  28. package/dist/cli/detect.d.ts.map +1 -1
  29. package/dist/cli/detect.js +32 -0
  30. package/dist/cli/detect.js.map +1 -1
  31. package/dist/cli/detect.test.js +23 -0
  32. package/dist/cli/detect.test.js.map +1 -1
  33. package/dist/cli/dispatcher.test.js +5 -2
  34. package/dist/cli/dispatcher.test.js.map +1 -1
  35. package/dist/cli/docs-accuracy.test.js +5 -1
  36. package/dist/cli/docs-accuracy.test.js.map +1 -1
  37. package/dist/cli/doctor.d.ts.map +1 -1
  38. package/dist/cli/doctor.js +0 -25
  39. package/dist/cli/doctor.js.map +1 -1
  40. package/dist/cli/init.js +3 -3
  41. package/dist/cli/init.js.map +1 -1
  42. package/dist/cli/layers.d.ts.map +1 -1
  43. package/dist/cli/layers.js +3 -1
  44. package/dist/cli/layers.js.map +1 -1
  45. package/dist/cli/pipeline.d.ts +1 -1
  46. package/dist/cli/pipeline.flow.test.js +77 -77
  47. package/dist/cli/pipeline.flow.test.js.map +1 -1
  48. package/dist/cli/pipeline.js +24 -24
  49. package/dist/cli/pipeline.js.map +1 -1
  50. package/dist/cli/plan.d.ts +8 -2
  51. package/dist/cli/plan.d.ts.map +1 -1
  52. package/dist/cli/plan.js +18 -12
  53. package/dist/cli/plan.js.map +1 -1
  54. package/dist/cli/plan.test.js +17 -19
  55. package/dist/cli/plan.test.js.map +1 -1
  56. package/dist/cli/project-facts-lang.d.ts +36 -0
  57. package/dist/cli/project-facts-lang.d.ts.map +1 -0
  58. package/dist/cli/project-facts-lang.js +323 -0
  59. package/dist/cli/project-facts-lang.js.map +1 -0
  60. package/dist/cli/project-facts.d.ts +5 -0
  61. package/dist/cli/project-facts.d.ts.map +1 -1
  62. package/dist/cli/project-facts.js +28 -11
  63. package/dist/cli/project-facts.js.map +1 -1
  64. package/dist/cli/project-facts.test.js +70 -0
  65. package/dist/cli/project-facts.test.js.map +1 -1
  66. package/dist/cli/stack-config-update.test.js +21 -1
  67. package/dist/cli/stack-config-update.test.js.map +1 -1
  68. package/dist/cli/stack-config.d.ts +20 -0
  69. package/dist/cli/stack-config.d.ts.map +1 -1
  70. package/dist/cli/stack-config.js +36 -0
  71. package/dist/cli/stack-config.js.map +1 -1
  72. package/dist/cli/update.d.ts.map +1 -1
  73. package/dist/cli/update.js +4 -61
  74. package/dist/cli/update.js.map +1 -1
  75. package/package.json +1 -1
  76. package/src/cli/adapters/adapter-contract.test.ts +1 -1
  77. package/src/cli/adapters/single-file-base.ts +2 -11
  78. package/src/cli/bootstrap.test.ts +11 -0
  79. package/src/cli/bootstrap.ts +32 -10
  80. package/src/cli/command-namespace.test.ts +5 -22
  81. package/src/cli/convoy/engine.ts +2 -2
  82. package/src/{orchestrator/prompts/assess-complexity.prompt.md → cli/convoy/prompts/convoy-assess.prompt.md} +0 -3
  83. package/src/{orchestrator/prompts/fix-convoy.prompt.md → cli/convoy/prompts/convoy-plan-fix.prompt.md} +0 -3
  84. package/src/{orchestrator/prompts/validate-convoy.prompt.md → cli/convoy/prompts/convoy-plan-review.prompt.md} +0 -3
  85. package/src/{orchestrator/prompts/generate-convoy.prompt.md → cli/convoy/prompts/convoy-plan.prompt.md} +0 -2
  86. package/src/{orchestrator/prompts/fix-prd.prompt.md → cli/convoy/prompts/convoy-prd-fix.prompt.md} +0 -3
  87. package/src/{orchestrator/prompts/validate-prd.prompt.md → cli/convoy/prompts/convoy-prd-review.prompt.md} +0 -3
  88. package/src/{orchestrator/prompts/generate-prd.prompt.md → cli/convoy/prompts/convoy-prd.prompt.md} +0 -3
  89. package/src/cli/convoy/read-model.test.ts +5 -29
  90. package/src/cli/convoy/read-model.ts +11 -71
  91. package/src/cli/convoy/spec-builder.ts +2 -2
  92. package/src/cli/dashboard/dashboard.js +2 -4
  93. package/src/cli/dashboard.test.ts +10 -2
  94. package/src/cli/dashboard.ts +1 -1
  95. package/src/cli/detect.test.ts +27 -0
  96. package/src/cli/detect.ts +29 -0
  97. package/src/cli/dispatcher.test.ts +6 -2
  98. package/src/cli/docs-accuracy.test.ts +5 -1
  99. package/src/cli/doctor.ts +0 -26
  100. package/src/cli/init.ts +3 -3
  101. package/src/cli/layers.ts +2 -1
  102. package/src/cli/pipeline.flow.test.ts +78 -78
  103. package/src/cli/pipeline.ts +25 -25
  104. package/src/cli/plan.test.ts +18 -20
  105. package/src/cli/plan.ts +18 -12
  106. package/src/cli/project-facts-lang.ts +338 -0
  107. package/src/cli/project-facts.test.ts +75 -0
  108. package/src/cli/project-facts.ts +31 -11
  109. package/src/cli/stack-config-update.test.ts +25 -1
  110. package/src/cli/stack-config.ts +36 -0
  111. package/src/cli/update.ts +4 -70
  112. package/src/orchestrator/agent-workflows/README.md +10 -18
  113. package/src/orchestrator/agent-workflows/data-pipeline.md +7 -140
  114. package/src/orchestrator/agent-workflows/database-migration.md +7 -153
  115. package/src/orchestrator/agent-workflows/performance-optimization.md +6 -119
  116. package/src/orchestrator/agent-workflows/refactoring.md +8 -137
  117. package/src/orchestrator/agent-workflows/schema-changes.md +8 -159
  118. package/src/orchestrator/agent-workflows/security-audit.md +7 -142
  119. package/src/orchestrator/agent-workflows/shared-delivery-phase.md +8 -25
  120. package/src/orchestrator/agents/architect.agent.md +2 -14
  121. package/src/orchestrator/agents/content-engineer.agent.md +8 -10
  122. package/src/orchestrator/agents/data-engineer.agent.md +8 -8
  123. package/src/orchestrator/agents/developer.agent.md +3 -10
  124. package/src/orchestrator/agents/devops-expert.agent.md +0 -3
  125. package/src/orchestrator/agents/performance-expert.agent.md +2 -3
  126. package/src/orchestrator/agents/security-expert.agent.md +10 -12
  127. package/src/orchestrator/agents/team-lead.agent.md +31 -75
  128. package/src/orchestrator/agents/testing-expert.agent.md +3 -6
  129. package/src/orchestrator/agents/ui-ux-expert.agent.md +1 -4
  130. package/src/orchestrator/agents/writer.agent.md +0 -3
  131. package/src/orchestrator/customizations/README.md +3 -4
  132. package/src/orchestrator/customizations/agents/agent-registry.md +3 -3
  133. package/src/orchestrator/customizations/agents/skill-matrix.json +6 -42
  134. package/src/orchestrator/instructions/general.instructions.md +10 -37
  135. package/src/orchestrator/prompts/bootstrap-customizations.prompt.md +4 -6
  136. package/src/orchestrator/prompts/brainstorm.prompt.md +7 -12
  137. package/src/orchestrator/prompts/bug-fix.prompt.md +19 -100
  138. package/src/orchestrator/prompts/convoy.prompt.md +20 -0
  139. package/src/orchestrator/prompts/create-skill.prompt.md +1 -5
  140. package/src/orchestrator/prompts/implement-feature.prompt.md +22 -93
  141. package/src/orchestrator/prompts/resolve-pr-comments.prompt.md +1 -5
  142. package/src/orchestrator/skills/api-patterns/SKILL.md +21 -18
  143. package/src/orchestrator/skills/deployment-infrastructure/SKILL.md +1 -1
  144. package/src/orchestrator/skills/fast-review/SKILL.md +28 -65
  145. package/src/orchestrator/skills/frontend-design/REFERENCE.md +0 -1
  146. package/src/orchestrator/skills/frontend-design/SKILL.md +3 -1
  147. package/src/orchestrator/skills/git-workflow/SKILL.md +18 -34
  148. package/src/orchestrator/skills/panel-majority-vote/SKILL.md +16 -46
  149. package/src/orchestrator/skills/security-hardening/SKILL.md +20 -19
  150. package/src/orchestrator/skills/self-improvement/LESSON-CATEGORIES.md +2 -2
  151. package/src/orchestrator/skills/self-improvement/SKILL.md +21 -46
  152. package/src/orchestrator/skills/technical-writing/SKILL.md +3 -1
  153. package/src/orchestrator/skills/technical-writing/TEMPLATES.md +23 -0
  154. package/src/orchestrator/skills/testing-workflow/SKILL.md +21 -23
  155. package/src/orchestrator/skills/validation-gates/REFERENCE.md +2 -14
  156. package/src/orchestrator/skills/validation-gates/SKILL.md +10 -88
  157. package/dist/cli/log.d.ts +0 -44
  158. package/dist/cli/log.d.ts.map +0 -1
  159. package/dist/cli/log.js +0 -336
  160. package/dist/cli/log.js.map +0 -1
  161. package/dist/cli/log.test.d.ts +0 -2
  162. package/dist/cli/log.test.d.ts.map +0 -1
  163. package/dist/cli/log.test.js +0 -208
  164. package/dist/cli/log.test.js.map +0 -1
  165. package/src/cli/log.test.ts +0 -228
  166. package/src/cli/log.ts +0 -374
  167. package/src/orchestrator/agent-workflows/bug-fix.md +0 -130
  168. package/src/orchestrator/agent-workflows/feature-implementation.md +0 -232
  169. package/src/orchestrator/instructions/ai-optimization.instructions.md +0 -17
  170. package/src/orchestrator/prompts/quick-refinement.prompt.md +0 -110
  171. package/src/orchestrator/skills/agent-hooks/HOOKS-REFERENCE.md +0 -44
  172. package/src/orchestrator/skills/agent-hooks/SKILL.md +0 -80
  173. package/src/orchestrator/skills/agent-memory/KNOWLEDGE-GRAPH.md +0 -49
  174. package/src/orchestrator/skills/agent-memory/SKILL.md +0 -50
  175. package/src/orchestrator/skills/code-commenting/SKILL.md +0 -18
  176. package/src/orchestrator/skills/context-map/REFERENCE.md +0 -67
  177. package/src/orchestrator/skills/context-map/SKILL.md +0 -71
  178. package/src/orchestrator/skills/decomposition/SKILL.md +0 -103
  179. package/src/orchestrator/skills/documentation-standards/SKILL.md +0 -33
  180. package/src/orchestrator/skills/fast-review/REFERENCE.md +0 -28
  181. package/src/orchestrator/skills/memory-merger/SKILL.md +0 -77
  182. package/src/orchestrator/skills/observability-logging/LOG-SCHEMA.md +0 -238
  183. package/src/orchestrator/skills/observability-logging/SKILL.md +0 -73
  184. package/src/orchestrator/skills/orchestration-protocols/REFERENCE.md +0 -38
  185. package/src/orchestrator/skills/orchestration-protocols/SKILL.md +0 -120
  186. package/src/orchestrator/skills/panel-majority-vote/REFERENCE.md +0 -49
  187. package/src/orchestrator/skills/panel-majority-vote/panel-report.template.md +0 -38
  188. package/src/orchestrator/skills/performance-optimization/SKILL.md +0 -23
  189. package/src/orchestrator/skills/project-consistency/SKILL.md +0 -80
  190. package/src/orchestrator/skills/project-consistency/TEMPLATES.md +0 -35
  191. package/src/orchestrator/skills/react-development/SKILL.md +0 -24
  192. package/src/orchestrator/skills/session-checkpoints/CHECKPOINT-TEMPLATE.md +0 -56
  193. package/src/orchestrator/skills/session-checkpoints/SKILL.md +0 -40
  194. package/src/orchestrator/skills/team-lead-reference/SKILL.md +0 -126
@@ -24,7 +24,6 @@ import {
24
24
  readRunInsights,
25
25
  readRunSpec,
26
26
  readRuns,
27
- readSessions,
28
27
  } from './read-model.js'
29
28
 
30
29
  let root: string
@@ -108,7 +107,7 @@ describe('with no database', () => {
108
107
  expect(readRun(root, 'x')).toBeNull()
109
108
  expect(readEventsSince(root, 'x', 0)).toEqual([])
110
109
  expect(isRunAlive(root, 'x')).toBe(false)
111
- expect(readSessions(root)).toEqual([])
110
+ expect(readAllSessions(root)).toEqual([])
112
111
  expect(readdirSync(join(root, '.opencastle'))).toEqual([])
113
112
  })
114
113
  })
@@ -388,28 +387,6 @@ describe('isRunAlive', () => {
388
387
  })
389
388
  })
390
389
 
391
- describe('sessions', () => {
392
- it('reads session records newest first and skips everything else', () => {
393
- const logs = join(root, '.opencastle', 'logs')
394
- mkdirSync(logs, { recursive: true })
395
- writeFileSync(
396
- join(logs, 'events.ndjson'),
397
- [
398
- JSON.stringify({ type: 'session', timestamp: T0, agent: 'Developer', task: 'first', outcome: 'success', duration_min: 3 }),
399
- 'not json',
400
- JSON.stringify({ type: 'review', timestamp: T1, agent: 'Developer', verdict: 'pass' }),
401
- JSON.stringify({ type: 'session', timestamp: T2, agent: 'Writer', task: 'second', outcome: 'partial', model: 'm' }),
402
- '',
403
- ].join('\n'),
404
- )
405
- const sessions = readSessions(root)
406
- expect(sessions.map((s) => s.task)).toEqual(['second', 'first'])
407
- expect(sessions[0]).toMatchObject({ agent: 'Writer', outcome: 'partial', model: 'm', duration_min: null })
408
- expect(sessions[1]).toMatchObject({ duration_min: 3, model: null })
409
- expect(readSessions(root, 1)).toHaveLength(1)
410
- })
411
- })
412
-
413
390
  describe('findProjectRoot', () => {
414
391
  it('walks up to the nearest .opencastle directory', () => {
415
392
  const deep = join(root, 'src', 'a', 'b')
@@ -670,16 +647,15 @@ describe('run insights', () => {
670
647
  })
671
648
  })
672
649
 
673
- describe('sessions from both sources', () => {
674
- it('merges `opencastle log` records with the engine’s session events, newest first, each labelled', () => {
650
+ describe('sessions', () => {
651
+ it('are the engine’s session events, newest first — a log written by hand is not read', () => {
675
652
  seedHistory()
676
653
  const logs = join(root, '.opencastle', 'logs')
677
654
  mkdirSync(logs, { recursive: true })
678
655
  writeFileSync(join(logs, 'events.ndjson'), JSON.stringify({ type: 'session', timestamp: at(D1, 45), agent: 'Developer', task: 'by hand', outcome: 'success' }) + '\n')
679
656
  const all = readAllSessions(root)
680
- expect(all.map((s) => [s.source, s.task])).toEqual([['convoy', 'b'], ['log', 'by hand'], ['convoy', 'a']])
681
- expect(all[1]).toMatchObject({ convoy_id: null, agent: 'Developer' })
657
+ expect(all.map((s) => [s.source, s.task])).toEqual([['convoy', 'b'], ['convoy', 'a']])
682
658
  expect(readEngineSessions(root, 'r2')).toEqual([])
683
- expect(readAllSessions(root, 2)).toHaveLength(2)
659
+ expect(readAllSessions(root, 1)).toHaveLength(1)
684
660
  })
685
661
  })
@@ -16,7 +16,7 @@
16
16
  * flag, cache token counts, an adapter column) reads without this file knowing
17
17
  * about every addition first.
18
18
  */
19
- import { closeSync, existsSync, fstatSync, openSync, readSync, statSync } from 'node:fs'
19
+ import { existsSync, statSync } from 'node:fs'
20
20
  import { hostname } from 'node:os'
21
21
  import { dirname, join, resolve } from 'node:path'
22
22
  import { DatabaseSync } from 'node:sqlite'
@@ -133,13 +133,9 @@ export interface EventRow {
133
133
  problem: boolean
134
134
  }
135
135
 
136
- /**
137
- * A session: a `type: "session"` record appended with `opencastle log`
138
- * (`source: 'log'`), or the `session` event the engine writes for each task it
139
- * finishes (`source: 'convoy'`, with the run's id).
140
- */
136
+ /** A session: the `session` event the engine writes for each task a convoy finishes. */
141
137
  export interface SessionRow {
142
- source: 'log' | 'convoy'
138
+ source: 'convoy'
143
139
  convoy_id: string | null
144
140
  timestamp: string | null
145
141
  agent: string | null
@@ -159,9 +155,9 @@ type Row = Record<string, unknown>
159
155
  /**
160
156
  * The nearest directory at or above `start` holding `.opencastle/`.
161
157
  *
162
- * The same walk `opencastle log` does. The dashboard used to read the current
163
- * directory only, so started from `proj/src` it showed nothing while `log`,
164
- * from the same place, was writing to `proj/.opencastle`.
158
+ * The dashboard used to read the current directory only, so started from
159
+ * `proj/src` it showed nothing while a run from the same place was writing to
160
+ * `proj/.opencastle`.
165
161
  */
166
162
  export function findProjectRoot(start: string): string | null {
167
163
  let dir = resolve(start)
@@ -663,71 +659,15 @@ export function isRunAlive(projectRoot: string, convoyId: string): boolean {
663
659
  })
664
660
  }
665
661
 
666
- // ── Agent sessions (`opencastle log`) ─────────────────────────────────────────
667
-
668
- /** Read at most this much of the end of the log; sessions are shown newest first. */
669
- const SESSION_LOG_TAIL_BYTES = 2 * 1024 * 1024
670
-
671
- function readTail(path: string, bytes: number): string {
672
- const fd = openSync(path, 'r')
673
- try {
674
- const size = fstatSync(fd).size
675
- const start = Math.max(0, size - bytes)
676
- const buf = Buffer.alloc(size - start)
677
- readSync(fd, buf, 0, buf.length, start)
678
- const text = buf.toString('utf8')
679
- // Starting mid-file means the first line is a fragment.
680
- return start > 0 ? text.slice(text.indexOf('\n') + 1) : text
681
- } finally {
682
- closeSync(fd)
683
- }
684
- }
685
-
686
- /** Session records from `.opencastle/logs/events.ndjson`, newest first. */
687
- export function readSessions(projectRoot: string, limit = 50): SessionRow[] {
688
- const path = join(projectRoot, '.opencastle', 'logs', 'events.ndjson')
689
- if (!existsSync(path)) return []
690
- const out: SessionRow[] = []
691
- const lines = readTail(path, SESSION_LOG_TAIL_BYTES).split('\n')
692
- for (let i = lines.length - 1; i >= 0 && out.length < limit; i--) {
693
- const line = lines[i].trim()
694
- if (!line) continue
695
- let rec: unknown
696
- try {
697
- rec = JSON.parse(line)
698
- } catch {
699
- continue
700
- }
701
- if (typeof rec !== 'object' || rec === null) continue
702
- const r = rec as Row
703
- if (r.type !== 'session') continue
704
- out.push({
705
- source: 'log',
706
- convoy_id: null,
707
- timestamp: str(r.timestamp),
708
- agent: str(r.agent),
709
- task: str(r.task),
710
- tracker_issue: str(r.tracker_issue),
711
- outcome: str(r.outcome),
712
- model: str(r.model),
713
- duration_min: num(r.duration_min),
714
- files_changed: num(r.files_changed),
715
- retries: num(r.retries),
716
- })
717
- }
718
- return out
719
- }
662
+ // ── Agent sessions ────────────────────────────────────────────────────────────
720
663
 
721
664
  /**
722
- * Agent sessions from both places they are recorded, newest first: what
723
- * `opencastle log` appended (`source: 'log'`) and the engine's `session` event
724
- * for each task it finished (`source: 'convoy'`). Each keeps its source, so a
725
- * page can say which is which.
665
+ * Agent sessions, newest first: the engine's `session` event for each task a
666
+ * convoy finished. Agents outside a convoy no longer log their sessions by
667
+ * hand — it never happened consistently — so this is the only record.
726
668
  */
727
669
  export function readAllSessions(projectRoot: string, limit = 50): SessionRow[] {
728
- const merged = [...readSessions(projectRoot, limit), ...readEngineSessions(projectRoot, null, limit)]
729
- merged.sort((a, b) => String(b.timestamp ?? '').localeCompare(String(a.timestamp ?? '')))
730
- return merged.slice(0, limit)
670
+ return readEngineSessions(projectRoot, null, limit)
731
671
  }
732
672
 
733
673
  /** The engine's `session` events, newest first: of one run, or of every run when `convoyId` is null. */
@@ -35,7 +35,7 @@ export interface TaskPlan {
35
35
  tasks: TaskPlanTask[]
36
36
  }
37
37
 
38
- /** A patch to apply to a task plan — output of the fix-convoy prompt */
38
+ /** A patch to apply to a task plan — output of the convoy-plan-fix prompt */
39
39
  export interface TaskPatch {
40
40
  task_id: string // task ID to patch, or "_plan" for top-level fields
41
41
  field: string // field name (e.g., "prompt", "files", "depends_on")
@@ -431,7 +431,7 @@ export function checkPlan(plan: TaskPlan, settings: SpecSettings): string[] {
431
431
  /**
432
432
  * Make the later of each conflicting pair wait for the earlier.
433
433
  *
434
- * The last resort, after fix-convoy has had its rounds: it costs parallelism,
434
+ * The last resort, after convoy-plan-fix has had its rounds: it costs parallelism,
435
435
  * never correctness, and it cannot create a cycle — an edge is only added
436
436
  * between two tasks that do not yet wait for each other in either direction.
437
437
  */
@@ -842,9 +842,7 @@
842
842
  return `<div class="table-wrap"><table class="sessions-table cards">
843
843
  <thead><tr>${withSource ? '<th scope="col">Source</th>' : ''}<th scope="col">When</th><th scope="col">Task</th><th scope="col">Agent</th><th scope="col">Outcome</th><th scope="col" class="td-num">Minutes</th><th scope="col" class="td-num">Files</th><th scope="col" class="td-num">Retries</th><th scope="col">Model</th></tr></thead>
844
844
  <tbody>${rows.map((s) => {
845
- const src = s.source === 'convoy'
846
- ? `<span class="kind-badge" title="The engine's session event for a finished task">convoy run</span>${s.convoy_id ? `<span class="td-sub"><a href="#run=${encodeURIComponent(s.convoy_id)}" title="${esc(s.convoy_id)}">${esc(runName(s.convoy_id))}</a></span>` : ''}`
847
- : '<span class="kind-badge" title="Appended with opencastle log">opencastle log</span>'
845
+ const src = `<span class="kind-badge" title="The engine's session event for a finished task">convoy run</span>${s.convoy_id ? `<span class="td-sub"><a href="#run=${encodeURIComponent(s.convoy_id)}" title="${esc(s.convoy_id)}">${esc(runName(s.convoy_id))}</a></span>` : ''}`
848
846
  const num = (v) => (v == null ? nr() : esc(v))
849
847
  return `<tr>
850
848
  ${withSource ? `<td data-label="Source">${src}</td>` : ''}
@@ -872,7 +870,7 @@
872
870
  return
873
871
  }
874
872
  if (!state.sessions.length) {
875
- el.innerHTML = `<div style="padding:16px 24px">${empty('table', 'No sessions recorded yet', 'Agents append sessions with <code>opencastle log --type session</code>, and a convoy run records one per task it finishes.')}</div>`
873
+ el.innerHTML = `<div style="padding:16px 24px">${empty('table', 'No sessions recorded yet', 'A convoy run records one per task it finishes.')}</div>`
876
874
  return
877
875
  }
878
876
  el.innerHTML = sessionsTable(state.sessions.slice(0, 20), true)
@@ -123,10 +123,11 @@ describe('startDashboard', () => {
123
123
 
124
124
  it('serves runs with the overview, one run with its insights, events after a cursor, and sessions', async () => {
125
125
  seed()
126
+ // A log an earlier release had agents write by hand: no longer read.
126
127
  mkdirSync(join(root, '.opencastle', 'logs'), { recursive: true })
127
128
  writeFileSync(
128
129
  join(root, '.opencastle', 'logs', 'events.ndjson'),
129
- JSON.stringify({ type: 'session', timestamp: '2026-10-01T10:00:00.000Z', agent: 'Developer', task: 't', outcome: 'success' }) + '\n',
130
+ JSON.stringify({ type: 'session', timestamp: '2026-10-01T11:00:00.000Z', agent: 'Writer', task: 'by hand', outcome: 'success' }) + '\n',
130
131
  )
131
132
  const v = await dashboard()
132
133
 
@@ -155,8 +156,15 @@ describe('startDashboard', () => {
155
156
  expect((rest.body.events as Array<{ type: string }>).map((e) => e.type)).toEqual(['convoy_finished'])
156
157
  expect(rest.body.more).toBe(false)
157
158
 
159
+ // Recorded last, so the event pages above stay the run's own four.
160
+ const store = createConvoyStore(join(root, '.opencastle', 'convoy.db'))
161
+ store.insertEvent({
162
+ convoy_id: 'convoy-1', task_id: 'a', worker_id: null, type: 'session',
163
+ data: JSON.stringify({ agent: 'Developer', task: 'a', outcome: 'success' }), created_at: '2026-10-01T10:00:00.000Z',
164
+ })
165
+ store.close()
158
166
  const sessions = await json(`${v.url}/api/sessions`)
159
- expect(sessions.body.sessions).toMatchObject([{ source: 'log', agent: 'Developer', outcome: 'success' }])
167
+ expect(sessions.body.sessions).toMatchObject([{ source: 'convoy', convoy_id: 'convoy-1', agent: 'Developer', outcome: 'success' }])
160
168
  })
161
169
 
162
170
  it('answers unknown runs and paths with 404, and a bad cursor with 400', async () => {
@@ -12,7 +12,7 @@
12
12
  * GET /api/runs runs, newest first, the event categories, and the overview of every run
13
13
  * GET /api/runs/:id one run with its tasks, and what its events and side tables add
14
14
  * GET /api/runs/:id/events?since=<n> that run's events after cursor n (&limit, at most 2000)
15
- * GET /api/sessions agent sessions: `opencastle log` records and the engine's own
15
+ * GET /api/sessions agent sessions: the engine's, one per task a convoy finished
16
16
  */
17
17
  import { createServer } from 'node:http'
18
18
  import type { IncomingMessage, Server, ServerResponse } from 'node:http'
@@ -299,6 +299,33 @@ describe('detectRepoInfo', () => {
299
299
 
300
300
  // ── buildDetectedToolsSet ──────────────────────────────────────
301
301
 
302
+ describe('detectRepoInfo — Python and Go', () => {
303
+ let dir: string
304
+ beforeEach(async () => { dir = await mkdtemp(join(tmpdir(), 'opencastle-lang-')) })
305
+ afterEach(async () => { await rm(dir, { recursive: true, force: true }) })
306
+
307
+ it('reads a FastAPI service as Python with its framework, and no JavaScript package manager', async () => {
308
+ await writeFile(join(dir, 'pyproject.toml'), '[tool.poetry.dependencies]\npython = "^3.11"\nfastapi = "^0.110"\n')
309
+ const info = await detectRepoInfo(dir)
310
+ expect(info.language).toBe('python')
311
+ expect(info.frameworks).toEqual(['fastapi'])
312
+ expect(info.packageManager).toBeUndefined()
313
+ })
314
+
315
+ it('reads a Go module with Gin', async () => {
316
+ await writeFile(join(dir, 'go.mod'), 'module x\n\ngo 1.22\n\nrequire github.com/gin-gonic/gin v1.10.0\n')
317
+ const info = await detectRepoInfo(dir)
318
+ expect(info.language).toBe('go')
319
+ expect(info.frameworks).toEqual(['gin'])
320
+ })
321
+
322
+ it('keeps TypeScript for a project that has both', async () => {
323
+ await writeFile(join(dir, 'tsconfig.json'), '{}')
324
+ await writeFile(join(dir, 'requirements.txt'), 'flask\n')
325
+ expect((await detectRepoInfo(dir)).language).toBe('typescript')
326
+ })
327
+ })
328
+
302
329
  describe('buildDetectedToolsSet', () => {
303
330
  it('maps detection labels to plugin IDs', () => {
304
331
  const set = buildDetectedToolsSet({
package/src/cli/detect.ts CHANGED
@@ -389,6 +389,11 @@ export async function detectRepoInfo(projectRoot: string): Promise<RepoInfo> {
389
389
  }
390
390
  }
391
391
 
392
+ // ── 6b. Python or Go, when nothing JavaScript said otherwise ──
393
+ // Read for the language and the web framework, which decide what the project
394
+ // is given: a FastAPI service has no use for TypeScript or SEO rules.
395
+ if (!info.language) await detectPythonOrGo(projectRoot, info)
396
+
392
397
  // ── 7. Detect CSS modules via src scan ──────────────────────
393
398
  if (!info.styling.includes('css-modules')) {
394
399
  const hasCssModules = await scanForPattern(projectRoot, /\.module\.(css|scss|sass)$/);
@@ -416,6 +421,30 @@ export async function detectRepoInfo(projectRoot: string): Promise<RepoInfo> {
416
421
 
417
422
  // ── Internal helpers ──────────────────────────────────────────
418
423
 
424
+ /** Framework packages of Python and Go projects, by how their manifest names them. */
425
+ const PYTHON_FRAMEWORKS: Array<[RegExp, string]> = [[/\bfastapi\b/i, 'fastapi'], [/\bdjango\b/i, 'django'], [/\bflask\b/i, 'flask']]
426
+ const GO_FRAMEWORKS: Array<[RegExp, string]> = [
427
+ [/github\.com\/gin-gonic\/gin\b/, 'gin'], [/github\.com\/labstack\/echo\b/, 'echo'],
428
+ [/github\.com\/go-chi\/chi\b/, 'chi'], [/github\.com\/gofiber\/fiber\b/, 'fiber'],
429
+ ]
430
+
431
+ async function detectPythonOrGo(root: string, info: RepoInfoInternal): Promise<void> {
432
+ const read = (rel: string): Promise<string> => readFile(resolve(root, rel), 'utf8').catch(() => '')
433
+ if (await fileExists(resolve(root, 'go.mod'))) {
434
+ info.language = 'go'
435
+ info.configFiles.push('go.mod')
436
+ const mod = await read('go.mod')
437
+ for (const [re, label] of GO_FRAMEWORKS) if (re.test(mod)) addUnique(info.frameworks, label)
438
+ return
439
+ }
440
+ const manifests = (await checkFiles(root, ['pyproject.toml', 'requirements.txt', 'setup.py', 'setup.cfg', 'Pipfile']))
441
+ if (manifests.length === 0) return
442
+ info.language = 'python'
443
+ info.configFiles.push(...manifests)
444
+ const text = (await Promise.all(manifests.map(read))).join('\n')
445
+ for (const [re, label] of PYTHON_FRAMEWORKS) if (re.test(text)) addUnique(info.frameworks, label)
446
+ }
447
+
419
448
  async function checkFiles(root: string, files: string[]): Promise<string[]> {
420
449
  const found: string[] = [];
421
450
  for (const f of files) {
@@ -66,11 +66,15 @@ describe('visible command surface', () => {
66
66
 
67
67
  describe('hidden commands', () => {
68
68
  it('keeps the agent-invoked commands reachable', () => {
69
- // Generated instructions call these; removing them would break installs.
70
- expect(HIDDEN).toContain('log')
69
+ // Generated instructions call it; removing it would break installs.
71
70
  expect(HIDDEN).toContain('lesson')
72
71
  })
73
72
 
73
+ it('answers log, which agents no longer call, as removed', () => {
74
+ expect(HIDDEN).not.toContain('log')
75
+ expect(source).toMatch(/\n log: null,\n/)
76
+ })
77
+
74
78
  it('keeps update working as the previous name for sync', () => {
75
79
  expect(HIDDEN).toContain('update')
76
80
  expect(source).toMatch(/update: \(\) => import\('\.\.\/dist\/cli\/sync\.js'\)/)
@@ -165,7 +165,11 @@ describe('shipped content instructs only commands that exist', () => {
165
165
  // "every opencastle command" is English, not a command called `command`. Keeping
166
166
  // the fuzzy check on the fuzzy-safe corpus is the honest split; widening it would
167
167
  // have meant a whitelist of English words, which is a worse test.
168
- const instructionFiles = load(contentFilesFor(orchestratorRoot, ['.md']))
168
+ const instructionFiles = load([
169
+ ...contentFilesFor(orchestratorRoot, ['.md']),
170
+ // The planner's templates: not compiled, but agents read them all the same.
171
+ ...contentFilesFor(join(repoRoot, 'src', 'cli', 'convoy', 'prompts'), ['.md']),
172
+ ])
169
173
 
170
174
  it('has content to check', () => {
171
175
  expect(files.length).toBeGreaterThan(0)
package/src/cli/doctor.ts CHANGED
@@ -287,31 +287,6 @@ export async function checkSkillMatrix(projectRoot: string): Promise<CheckResult
287
287
  }
288
288
  }
289
289
 
290
- async function checkLogs(projectRoot: string): Promise<CheckResult> {
291
- const dir = resolve(projectRoot, '.opencastle', 'logs');
292
- if (!existsSync(dir)) {
293
- // A local run artefact, not part of the project, so a fresh clone has none —
294
- // and calling that a failure made `doctor` exit 1 on every clone. The first
295
- // `opencastle log` creates it; until then "none yet" is the honest reading,
296
- // and not something to warn about on every new install.
297
- return {
298
- ok: true,
299
- label: 'Observability logs',
300
- detail: 'none yet — created when an agent first logs a session',
301
- };
302
- }
303
- // A diagnostic does not write. This used to create five empty `.ndjson` files
304
- // as a side effect — files nothing on this branch reads, and exactly the ones
305
- // `migrateLegacyLogs` exists to move aside.
306
- const entries = existsSync(dir) ? await readdir(dir) : [];
307
- const events = entries.filter((f) => f.endsWith('.ndjson'));
308
- return {
309
- ok: true,
310
- label: 'Observability logs',
311
- detail: events.length > 0 ? `${events.length} log file(s)` : 'no runs recorded yet',
312
- };
313
- }
314
-
315
290
  async function checkMcpEnvVars(
316
291
  projectRoot: string,
317
292
  manifest: Manifest | null,
@@ -1013,7 +988,6 @@ export async function runSharedChecks(
1013
988
  await checkCustomizations(projectRoot),
1014
989
  await checkProjectContext(projectRoot),
1015
990
  await checkSkillMatrix(projectRoot),
1016
- await checkLogs(projectRoot),
1017
991
  await checkMcpEnvVars(projectRoot, manifest, state),
1018
992
  await checkDotEnv(projectRoot, manifest),
1019
993
  await checkGitignoredOutput(projectRoot, manifest),
package/src/cli/init.ts CHANGED
@@ -6,7 +6,7 @@ import { multiselect, confirm, closePrompts, c } from './prompt.js'
6
6
  import { readManifest, writeManifest, createManifest } from './manifest.js'
7
7
  import { removeDirIfExists, copyDir, getOrchestratorRoot } from './copy.js'
8
8
  import { updateGitignore } from './gitignore.js'
9
- import { getCustomizationsTransform } from './stack-config.js'
9
+ import { getCustomizationsTransform, isPreselected } from './stack-config.js'
10
10
  import { getMcpConfigRelPath, stripManagedMcpServers, retireLegacyMcpConfig } from './mcp.js'
11
11
  import { getPluginsBySubCategory } from '../orchestrator/plugins/index.js'
12
12
  import type { PluginConfig } from '../orchestrator/plugins/types.js'
@@ -98,7 +98,7 @@ export function detectSelection(
98
98
  getPluginsBySubCategory(sc as PluginConfig['subCategory']),
99
99
  )
100
100
  for (const p of plugins) {
101
- if (!p.preselected && !detected.has(p.id) && !kept.has(p.id)) continue
101
+ if (!isPreselected(p, repoInfo) && !detected.has(p.id) && !kept.has(p.id)) continue
102
102
  if (p.category === 'team') teamTools.push(p.id)
103
103
  else techTools.push(p.id)
104
104
  }
@@ -160,7 +160,7 @@ async function promptSelection(
160
160
  label: p.label,
161
161
  hint: p.hint,
162
162
  value: p.id,
163
- ...((p.preselected || detectedTools.has(p.id) || existingTools.has(p.id)) && { selected: true }),
163
+ ...((isPreselected(p, repoInfo) || detectedTools.has(p.id) || existingTools.has(p.id)) && { selected: true }),
164
164
  })),
165
165
  )
166
166
  for (const id of selected) {
package/src/cli/layers.ts CHANGED
@@ -14,7 +14,7 @@ import { join, resolve, relative, dirname, isAbsolute, sep } from 'node:path'
14
14
  import { tmpdir } from 'node:os'
15
15
  import { PLUGINS } from '../orchestrator/plugins/index.js'
16
16
  import { getOrchestratorRoot, getPluginsRoot } from './copy.js'
17
- import { getExcludedSkills, getExcludedAgents, getIncludedPluginIds, getIncludedMcpServers, getRequiredMcpEnvVars } from './stack-config.js'
17
+ import { getExcludedSkills, getExcludedAgents, getIncludedPluginIds, getIncludedMcpServers, getRequiredMcpEnvVars, getExcludedCoreSkills } from './stack-config.js'
18
18
  import { splitFrontmatter, parseFrontmatterString } from './adapters/frontmatter.js'
19
19
  import { packageLaunch, isPinned } from './mcp-audit.js'
20
20
  import { disallowedBy, hostDisallowedBy, findInlineSecret, emptyPolicy, globMatch, hostOfUrl, hostAllowedBy, type EffectivePolicy } from './policy.js'
@@ -713,6 +713,7 @@ export function resolveSources(opts: ResolveOptions): ResolvedSources {
713
713
  // exclusions anyone wrote, so a team layer naming one is not a mistake.
714
714
  const stackOut = new Set<string>()
715
715
  const excludedSkills = stack ? getExcludedSkills(stack) : new Set<string>()
716
+ for (const name of getExcludedCoreSkills(repoInfo)) excludedSkills.add(name)
716
717
  const excludedAgents = stack ? getExcludedAgents(stack) : new Set<string>()
717
718
  for (const item of scanLayer(core, projectRoot).items) {
718
719
  if (item.kind === 'skills' && excludedSkills.has(item.name)) {