deliberate-cli 0.2.0-beta.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/AGENTS.md +40 -0
  2. package/LICENSE +174 -0
  3. package/README.md +89 -0
  4. package/package.json +51 -0
  5. package/roles/analyst/frame/instructions.md +88 -0
  6. package/roles/analyst/frame/output-template.md +52 -0
  7. package/roles/analyst/launch/instructions.md +63 -0
  8. package/roles/analyst/launch/output-template.md +50 -0
  9. package/roles/analyst/one-pager/instructions.md +75 -0
  10. package/roles/analyst/one-pager/output-template.md +38 -0
  11. package/roles/analyst/shape/instructions.md +63 -0
  12. package/roles/analyst/shape/output-template.md +52 -0
  13. package/roles/briefer/brief/instructions.md +77 -0
  14. package/roles/briefer/brief/output-template.md +37 -0
  15. package/roles/config.yaml +130 -0
  16. package/roles/evaluator/score/instructions.md +84 -0
  17. package/roles/evaluator/score/output-template.md +11 -0
  18. package/roles/initiator/init/instructions.md +111 -0
  19. package/roles/initiator/init/output-template-competitors.md +16 -0
  20. package/roles/initiator/init/output-template-ecosystem.md +19 -0
  21. package/roles/initiator/init/output-template-product.md +136 -0
  22. package/roles/prototyper/prototype/instructions.md +146 -0
  23. package/roles/prototyper/prototype/output-template.md +10 -0
  24. package/roles/reporter/readout/instructions.md +54 -0
  25. package/roles/reporter/readout/output-template.md +37 -0
  26. package/roles/scout/matchup/instructions.md +74 -0
  27. package/roles/scout/matchup/output-template.md +115 -0
  28. package/roles/skills/README.md +19 -0
  29. package/roles/skills/critique.md +64 -0
  30. package/roles/skills/head-to-head.md +88 -0
  31. package/roles/skills/jtbd.md +43 -0
  32. package/roles/skills/landscape-scan.md +77 -0
  33. package/roles/skills/metrics.md +58 -0
  34. package/roles/skills/positioning.md +44 -0
  35. package/roles/skills/prioritization.md +101 -0
  36. package/roles/skills/product-readout.md +98 -0
  37. package/roles/skills/tech-constraints.md +27 -0
  38. package/roles/skills/ux-principles.md +24 -0
  39. package/roles/skills/win-conditions.md +68 -0
  40. package/skill/SKILL.md +231 -0
  41. package/skill/scripts/deliberate.mjs +44 -0
  42. package/src/cli/deliberate.mjs +628 -0
  43. package/src/engine/app-boot.mjs +17 -0
  44. package/src/engine/briefs.mjs +101 -0
  45. package/src/engine/cases.mjs +17 -0
  46. package/src/engine/commands.mjs +75 -0
  47. package/src/engine/init.mjs +34 -0
  48. package/src/engine/layout.mjs +37 -0
  49. package/src/engine/log.mjs +22 -0
  50. package/src/engine/matchups.mjs +87 -0
  51. package/src/engine/onepager.mjs +51 -0
  52. package/src/engine/pipeline.mjs +134 -0
  53. package/src/engine/projects.mjs +17 -0
  54. package/src/engine/prompts.mjs +28 -0
  55. package/src/engine/prototype.mjs +86 -0
  56. package/src/engine/readout-charts.mjs +217 -0
  57. package/src/engine/readouts.mjs +132 -0
  58. package/src/engine/roles.mjs +137 -0
  59. package/src/engine/scaffold.mjs +54 -0
  60. package/src/engine/score.mjs +66 -0
  61. package/src/engine/service.mjs +18 -0
@@ -0,0 +1,66 @@
1
+ /**
2
+ * score.mjs — the Score: the decorrelated Evaluator's go/no-go verdict for a case, a
3
+ * recomputable companion to the decision record (analysis.md), NOT a funnel stage.
4
+ *
5
+ * The Evaluator is the ONE isolated, cross-vendor sub-agent (model-decorrelated from the
6
+ * in-session Analyst): it reads the current case record and returns a scored verdict. The
7
+ * score is deliberately decoupled from the funnel — its own `score.md` artifact — so a
8
+ * revised analysis can be re-scored on demand (`deliberate case score`) without rewriting
9
+ * the record. `EVALUATOR_STAGE` is the config key (roles/config.yaml) it resolves under.
10
+ *
11
+ * Like the Briefer/One-pager, the engine here is LLM-free: it assembles the producer
12
+ * prompt (grounding + skills + instructions + the accumulated case record) and
13
+ * deterministically persists what the host produces as
14
+ * `deliberate/cases/<case>/score.md`, beside analysis.md, stamping the go/no-go number
15
+ * onto the record. The decision record links to it (a "## Score" section) once it exists.
16
+ */
17
+ import { EVALUATOR_STAGE } from 'sonorance/plugins/deliberate/stages.mjs';
18
+ import { agentConfig } from './roles.mjs';
19
+ import { read, loadBody, loadSkills } from './prompts.mjs';
20
+ import { projectContext, caseContext, cleanArtifact, scoreOf } from './pipeline.mjs';
21
+ import { unwrapProse } from 'sonorance/plugins/deliberate/markdown.mjs';
22
+
23
+ // The config key (roles/config.yaml) + role folder for the Evaluator's score sub-job.
24
+ // It IS the EVALUATOR_STAGE, but never enters the funnel state machine (STAGES) — the
25
+ // score is a standalone, recomputable artifact (like ONEPAGER_STAGE / BRIEF_STAGE).
26
+ export const SCORE_STAGE = EVALUATOR_STAGE;
27
+
28
+ // The exact producer prompt for a case's Score: grounding + the evaluator skills + the
29
+ // scoring instructions (system) and the accumulated case record it must judge (user).
30
+ // The in-harness skill hands this to an ISOLATED, cross-vendor sub-agent — decorrelated
31
+ // from the Analyst — which returns the scored verdict.
32
+ export async function scorePrompt(store, project, kase) {
33
+ const cfg = agentConfig(SCORE_STAGE);
34
+ const instruction = await loadBody(cfg.instructions);
35
+ const agents = await read('AGENTS.md');
36
+ const template = await read(cfg.templates.default);
37
+ const skillsBlock = (await loadSkills(cfg.skills)) || '(none)';
38
+ const pctx = projectContext(store, project);
39
+ const system = `${agents}\n\n${pctx}\n\n## Skills\n${skillsBlock}\n\n## Stage instructions\n${instruction}`;
40
+ const ctx = caseContext(store, kase);
41
+ const tpl = template
42
+ ? `\n\n----- OUTPUT TEMPLATE -----\n(Fill EVERY section with real, grounded content drawn ONLY from the record below. The italic _..._ lines and parentheticals are guidance for you — replace them; never echo the template's guidance text, and do not add a "grounding"/"notes"/"assumptions" section.)\n${template}`
43
+ : '';
44
+ const user = `Case record to evaluate (score ONLY this — introduce no new claims or evidence):\n${ctx}\nProduce the score.${tpl}`;
45
+ return { system, user, template, model: cfg.model };
46
+ }
47
+
48
+ // Persist a produced Score (LLM-free): clean it, unwrap hard-wrapped prose, extract the
49
+ // go/no-go number, and write it to `score.md` beside the record (the store also stamps the
50
+ // number and evaluator provenance onto the record + refreshes its link). Shared by the
51
+ // engine and `case score save`.
52
+ export async function persistScore(store, project, kase, rawArtifact, provenance) {
53
+ const model = String(provenance?.model || '').trim();
54
+ if (!/^[A-Za-z0-9._:/-]{1,100}$/.test(model)) {
55
+ throw new Error('Score provenance requires a valid evaluator model id');
56
+ }
57
+ if (typeof provenance?.independent !== 'boolean') {
58
+ throw new Error('Score provenance requires an independence status');
59
+ }
60
+ const cfg = agentConfig(SCORE_STAGE);
61
+ const template = await read(cfg.templates.default);
62
+ const body = unwrapProse(cleanArtifact(rawArtifact, template));
63
+ const number = scoreOf(body);
64
+ store.writeScore(kase.id, body, number, { model, independent: provenance.independent });
65
+ return { case: store.getCase(kase.id), score: number, file: store.scoreRef(kase.id) };
66
+ }
@@ -0,0 +1,18 @@
1
+ /**
2
+ * service.mjs — public facade for the engine's high-level operations, used by the
3
+ * CLI. Split across focused modules (projects / cases) plus the pipeline engine;
4
+ * this barrel keeps a single, stable import surface so callers don't depend on the
5
+ * layout. Context derivation is host-driven now (the harness writes deliberate/context/product.md), so
6
+ * there is no engine `computeContext`; titling is likewise the host's job.
7
+ */
8
+ export { setCurrentProject, openProjectVault } from './projects.mjs';
9
+ export { caseDetail } from './cases.mjs';
10
+ export { projectContext, stagePrompt, persistStage } from './pipeline.mjs';
11
+ export { onepagerPrompt, persistOnepager, ONEPAGER_STAGE } from './onepager.mjs';
12
+ export { scorePrompt, persistScore, SCORE_STAGE } from './score.mjs';
13
+ export { prototypePrompt, persistPrototype, PROTO_STAGE } from './prototype.mjs';
14
+ export { briefWindow, briefPrompt, persistBrief, briefPeriodLabel, BRIEF_STAGE } from './briefs.mjs';
15
+ export { readoutPeriod, readoutPrompt, persistReadout, readoutPeriodLabel, READOUT_STAGE } from './readouts.mjs';
16
+ export { normalizeTrendChartSpec, renderTrendChart, renderTrendChartFile, loadReadoutCharts } from './readout-charts.mjs';
17
+ export { matchupPrompt, persistMatchup, matchupAsOfLabel, MATCHUP_STAGE } from './matchups.mjs';
18
+ export { initPrompt, INIT_STAGE } from './init.mjs';