aiki-cli 0.3.1 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -5
- package/README.md +9 -11
- package/dist/bench/idea-v3-rating.js +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/cli/run.js +1 -1
- package/dist/council/view.js +52 -12
- package/dist/orchestration/context.js +3 -3
- package/dist/orchestration/decision-dossier.js +417 -88
- package/dist/orchestration/decision-graph.js +31 -0
- package/dist/orchestration/legacy-idea-adapter.js +3 -0
- package/dist/orchestration/modes.js +15 -9
- package/dist/orchestration/preflight.js +17 -3
- package/dist/orchestration/quick-analysis.js +21 -4
- package/dist/orchestration/stages/s10-render.js +167 -79
- package/dist/orchestration/stages/s4-analyze.js +3 -1
- package/dist/orchestration/stages/s6-positions.js +18 -0
- package/dist/orchestration/stages/s7-decision-graph.js +3 -0
- package/dist/orchestration/stages/s8-verify.js +26 -9
- package/dist/orchestration/stages/s8b-rebuttal.js +11 -4
- package/dist/orchestration/stages/s9-judge.js +36 -13
- package/dist/orchestration/stages/s9b-plan.js +192 -42
- package/dist/schemas/index.js +67 -3
- package/dist/skills/idea-refinement/analyst.md +5 -5
- package/dist/skills/idea-refinement/chair.md +18 -0
- package/dist/skills/idea-refinement/economics-delivery.md +11 -0
- package/dist/skills/idea-refinement/market-adoption.md +12 -0
- package/dist/skills/idea-refinement/planner.md +25 -19
- package/dist/skills/idea-refinement/rebuttal.md +15 -0
- package/dist/skills/idea-refinement/verifier.md +17 -0
- package/dist/workflows/idea-refinement.js +42 -14
- package/package.json +1 -1
|
@@ -1,25 +1,31 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Answer editor playbook — useful first, honest throughout
|
|
2
2
|
|
|
3
|
-
You
|
|
4
|
-
|
|
3
|
+
You turn the council's work into the answer the user actually asked for. Lead with a clear product
|
|
4
|
+
recommendation, select the strongest ideas from both seats, and make the result practical enough to act on.
|
|
5
5
|
|
|
6
|
-
##
|
|
7
|
-
-
|
|
8
|
-
-
|
|
9
|
-
-
|
|
6
|
+
## Reader answer
|
|
7
|
+
- Answer the original task directly. Do not narrate the council process.
|
|
8
|
+
- Prefer specific product language: what to build, why users care, what makes it memorable, and what to do first.
|
|
9
|
+
- Combine complementary proposals; remove duplicates and cautious filler.
|
|
10
|
+
- Explain the user value or demo payoff of each standout idea, not merely its feature name.
|
|
11
|
+
- Keep facts inside supported findings and sources. Present unevidenced product choices as recommendations,
|
|
12
|
+
never as established market facts.
|
|
13
|
+
- Chair output is decision reasoning, not evidence. Reframe its unsupported certainty as a recommendation,
|
|
14
|
+
risk, or hypothesis unless the proposition also appears in supported findings.
|
|
15
|
+
- Use plain-language caveats only when they could change the recommendation.
|
|
10
16
|
|
|
11
|
-
##
|
|
12
|
-
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
-
|
|
17
|
+
## Requested deliverables
|
|
18
|
+
- When a feature backlog is requested, make MUST the smallest compelling golden path. Use SHOULD and LATER
|
|
19
|
+
for real prioritization; WONT protects the concept from scope creep.
|
|
20
|
+
- When an implementation plan is requested, give an outcome-driven build sequence with observable acceptance tests.
|
|
21
|
+
- The reader brief should summarize these deliverables rather than repeat every field verbatim.
|
|
16
22
|
|
|
17
|
-
##
|
|
18
|
-
-
|
|
19
|
-
-
|
|
20
|
-
|
|
23
|
+
## Validation actions
|
|
24
|
+
- Keep 1–4 actions. Start with the cheapest unresolved risk that could stop or reshape the recommendation.
|
|
25
|
+
- Every action must be concrete enough to run this week and tie to exactly one supplied anchor.
|
|
26
|
+
- A kill signal must be observable: a threshold, refusal pattern, blocker, cost ceiling, or failed behavior.
|
|
21
27
|
|
|
22
28
|
## Do not
|
|
23
|
-
- No
|
|
24
|
-
- No
|
|
25
|
-
- No
|
|
29
|
+
- No graph ids, verification labels, confidence formulas, audit vocabulary, or model-process commentary in reader_brief.
|
|
30
|
+
- No generic "do more research" action.
|
|
31
|
+
- No invented source or unsupported hype.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Rebuttal playbook — answer the strongest opposition
|
|
2
|
+
|
|
3
|
+
Add to your base instructions; the schema and caps are unchanged and always win.
|
|
4
|
+
|
|
5
|
+
## Review in this order
|
|
6
|
+
1. Steelman the opposing position in one line before answering it.
|
|
7
|
+
2. Name its biggest blind spot: the assumption it never checks. Attack that assumption with supplied
|
|
8
|
+
evidence IDs.
|
|
9
|
+
3. Name what both sides missed. Use NARROW or UNRESOLVED instead of pretending it was covered.
|
|
10
|
+
|
|
11
|
+
## Stance discipline
|
|
12
|
+
- CONCEDE when the evidence beats your position. An early concession on a lost point preserves
|
|
13
|
+
credibility for the decision-critical dispute.
|
|
14
|
+
- Never change a stance word without a supplied evidence ID.
|
|
15
|
+
- Prefer a precise unresolved boundary over a broad defensive counterclaim.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Verifier playbook — try to disprove the claim
|
|
2
|
+
|
|
3
|
+
Add to your base instructions; the schema and caps are unchanged and always win.
|
|
4
|
+
|
|
5
|
+
## Refute first
|
|
6
|
+
- Assume each claim is wrong. Hunt for the disconfirming reading of the same supplied evidence.
|
|
7
|
+
- Confirm only after a serious refutation attempt fails.
|
|
8
|
+
- Agreement without attempted refutation is analytically NOT_CHECKED, not SUPPORTED; express that
|
|
9
|
+
uncertainty with the closest allowed schema status rather than returning VERIFIED.
|
|
10
|
+
- Judge the evidence, never its author.
|
|
11
|
+
|
|
12
|
+
## Evidence discipline
|
|
13
|
+
- Treat CONFLICTED as a finding, not an output enum: use the allowed status and record the exact two
|
|
14
|
+
clashing readings in the reasoning.
|
|
15
|
+
- Never verify a value judgment as fact. Numbers, deadlines, and rule text can be checked; taste and
|
|
16
|
+
strategy remain positions for the chair.
|
|
17
|
+
- Include one concise sentence describing the method used for each verification.
|
|
@@ -42,7 +42,7 @@ export function buildIdeaRubric(domainDimensions = []) {
|
|
|
42
42
|
}
|
|
43
43
|
/** Idea S4 analyst template. R6 fills every slot deterministically before the parallel scout calls. */
|
|
44
44
|
export const IDEA_S4_ANALYST_TEMPLATE = `ROLE: Independent analyst on a decision panel. You work ALONE; you will not see
|
|
45
|
-
other analysts' output.
|
|
45
|
+
other analysts' output. Improve the strongest version and pressure-test it honestly within your assigned lane.
|
|
46
46
|
|
|
47
47
|
TASK CONTRACT: {{INTENT_CONTRACT_JSON}}
|
|
48
48
|
INPUT DOCUMENT: read the file at {{INPUT_PATH}}{{SKILL}}
|
|
@@ -54,7 +54,10 @@ Produce ONLY JSON matching {{S4_SCHEMA_REF}} with:
|
|
|
54
54
|
- task_echo: restate the task in ≤2 sentences (drift check).
|
|
55
55
|
- strongest_version: the best honest version of this idea in ≤150 words.
|
|
56
56
|
- positions: explicit claim positions with local_id, proposition, rubric dimension_id, stance
|
|
57
|
-
SUPPORT|OPPOSE|MIXED|UNKNOWN, basis EVIDENCE|INFERENCE|ASSUMPTION,
|
|
57
|
+
SUPPORT|OPPOSE|MIXED|UNKNOWN, basis EVIDENCE|INFERENCE|ASSUMPTION, nature FACTUAL when the position
|
|
58
|
+
asserts something independently checkable about the world (rules, deadlines, prices, observed CLI
|
|
59
|
+
behavior, published numbers) or JUDGMENT for a design choice, recommendation, prioritization, or
|
|
60
|
+
prediction (when unsure use JUDGMENT), load_bearing, if_false
|
|
58
61
|
STOP|PIVOT|CONDITION|MINOR, concise reasoning, evidence_ids, and depends_on position ids.
|
|
59
62
|
- evidence: evidence cards {id, claim_supported, source_kind USER|PRIMARY|SECONDARY|MODEL_KNOWLEDGE,
|
|
60
63
|
support SUPPORTS|CONTRADICTS|CONTEXT_ONLY (exact token, no extra words), freshness CURRENT|DATED|UNKNOWN,
|
|
@@ -66,8 +69,11 @@ Produce ONLY JSON matching {{S4_SCHEMA_REF}} with:
|
|
|
66
69
|
- coverage: one entry per rubric dimension {dimension_id, status COVERED|NOT_APPLICABLE,
|
|
67
70
|
position_ids ([] when none), rationale (required for NOT_APPLICABLE)}.
|
|
68
71
|
- decision_questions: questions {question, claim_ids} whose answers could change the verdict.
|
|
69
|
-
|
|
70
|
-
|
|
72
|
+
- deliverable_proposals: when requested_outputs includes FEATURE_BACKLOG or IMPLEMENTATION_PLAN, propose
|
|
73
|
+
concrete user-facing work as {output,title,detail,user_value,why_distinctive,evidence_ids}; otherwise [].
|
|
74
|
+
Proposals are recommendations, not factual claims. Use evidence_ids only when evidence directly supports them.
|
|
75
|
+
Caps: at most 12 positions, 20 evidence cards, 8 calculations, 8 decision_questions, 8 deliverable_proposals.
|
|
76
|
+
Rules: no unsupported hype, no summaries of your own output, no markdown, JSON only.`;
|
|
71
77
|
/**
|
|
72
78
|
* Resolve the {{SKILL}} slot before deterministic structural fill. An empty skill collapses the slot
|
|
73
79
|
* to the pre-skill baseline.
|
|
@@ -77,11 +83,11 @@ export function buildAnalystTemplate(skill) {
|
|
|
77
83
|
}
|
|
78
84
|
/** R6 deterministic S4 prompt fill. No model-authored prompt generation remains. */
|
|
79
85
|
export function buildAnalystPrompt(contract, inputPath, evidencePack, mode, skill) {
|
|
80
|
-
const modeRules = mode
|
|
81
|
-
? `\n\nMODE:
|
|
86
|
+
const modeRules = mode !== 'quick'
|
|
87
|
+
? `\n\nMODE: full council. Use provider-native read-only source investigation when available. Every current
|
|
82
88
|
fact must have an independently checkable locator and access date. If investigation is unavailable,
|
|
83
89
|
leave the claim unverified; never invent a source.`
|
|
84
|
-
: `\n\nMODE:
|
|
90
|
+
: `\n\nMODE: quick. Analyze independently and keep unsupported claims visibly unverified.`;
|
|
85
91
|
const prompt = buildAnalystTemplate(skill)
|
|
86
92
|
.replace('{{INTENT_CONTRACT_JSON}}', JSON.stringify(contract))
|
|
87
93
|
.replace('{{INPUT_PATH}}', inputPath)
|
|
@@ -107,6 +113,26 @@ export const IDEA_STAGES = [
|
|
|
107
113
|
{ id: 'S9b', label: 'Validation plan', role: 'judge' },
|
|
108
114
|
{ id: 'S10', label: 'Report', role: null },
|
|
109
115
|
];
|
|
116
|
+
/** Record guarantees observed at the surviving typed S4 boundary; never infer them from prompts. */
|
|
117
|
+
export function recordIdeaOutcomeFlags(ctx, contract, seats) {
|
|
118
|
+
if (ctx.mode === 'quick')
|
|
119
|
+
return;
|
|
120
|
+
const requested = (contract.requested_outputs ?? [])
|
|
121
|
+
.filter((output) => output === 'FEATURE_BACKLOG' || output === 'IMPLEMENTATION_PLAN');
|
|
122
|
+
if (requested.some((output) => seats.some((seat) => !seat.output.deliverable_proposals.some((proposal) => proposal.output === output)))) {
|
|
123
|
+
ctx.addFlag('deliverable_gap');
|
|
124
|
+
}
|
|
125
|
+
const grounded = seats.some((seat) => {
|
|
126
|
+
const cited = new Set(seat.output.positions.flatMap((position) => position.evidence_ids));
|
|
127
|
+
return seat.output.evidence.some((card) => cited.has(card.id)
|
|
128
|
+
&& (card.source_kind === 'PRIMARY' || card.source_kind === 'SECONDARY')
|
|
129
|
+
&& card.freshness === 'CURRENT'
|
|
130
|
+
&& Boolean(card.accessed_at && (card.url || card.locator))
|
|
131
|
+
&& card.support !== 'CONTEXT_ONLY');
|
|
132
|
+
});
|
|
133
|
+
if (!grounded)
|
|
134
|
+
ctx.addFlag('research_ungrounded');
|
|
135
|
+
}
|
|
110
136
|
/** Runs the full idea-refinement pipeline S0–S10. Throws on any fatal condition; the engine's
|
|
111
137
|
* `executeRun` wrapper turns that into a graceful failure + meta. Each stage is wrapped in
|
|
112
138
|
* `runStage` so the TUI timeline (T8) gets start/end events; headless, that's a no-op. */
|
|
@@ -116,9 +142,13 @@ export async function runIdeaRefinement(ctx, input) {
|
|
|
116
142
|
const urlSources = await snapshotUrlSources(input);
|
|
117
143
|
await ctx.writer.writeJson('url-sources', urlSources);
|
|
118
144
|
const unreadableSources = urlSources.sources.filter((source) => source.status !== 'FETCHED');
|
|
119
|
-
|
|
145
|
+
const needsSourceFallback = ctx.mode !== 'quick' && unreadableSources.length > 0;
|
|
146
|
+
const hasReadableResearch = Boolean(ctx.evidencePack?.files.length)
|
|
147
|
+
|| urlSources.sources.some((source) => source.status === 'FETCHED');
|
|
148
|
+
const canSearch = ctx.roles.s4.includes('codex');
|
|
149
|
+
if (needsSourceFallback && !canSearch && !hasReadableResearch) {
|
|
120
150
|
const details = unreadableSources.map((source) => `${source.url} (${source.status}: ${source.error})`).join('; ');
|
|
121
|
-
throw new StageError('S0', 'SOURCE_UNREADABLE', `
|
|
151
|
+
throw new StageError('S0', 'SOURCE_UNREADABLE', `source investigation stopped before model calls because no source was readable and Codex search is unavailable${details ? `: ${details}` : ''}. Paste the relevant text, provide a public export, or enable Codex, then rerun.`);
|
|
122
152
|
}
|
|
123
153
|
const { contract, brief } = await runStage(ctx, 'S0', () => preflight(ctx, input, IDEA_RUBRIC.map((item) => item.label), urlSources));
|
|
124
154
|
const grilledInput = renderDecisionInput(input, brief, urlSources);
|
|
@@ -159,19 +189,17 @@ export async function runIdeaRefinement(ctx, input) {
|
|
|
159
189
|
await runStage(ctx, 'S10', () => s10Render(ctx, { contract, seats: kept, graph, verifications, rebuttals, judgeReport, actionPlan, rubric, original: input }));
|
|
160
190
|
return;
|
|
161
191
|
}
|
|
162
|
-
if (ctx.mode === 'research' && !ctx.evidencePack && !ctx.available().includes('codex')) {
|
|
163
|
-
ctx.addFlag('research_ungrounded');
|
|
164
|
-
}
|
|
165
192
|
const analystPrompt = buildAnalystPrompt(contract, inputPath, ctx.evidencePack, ctx.mode, analystSkill);
|
|
166
193
|
await ctx.writer.writePrompt('analyst.md', analystPrompt);
|
|
167
194
|
const lanePrompts = buildLanePrompts(analystPrompt, rubric);
|
|
168
|
-
const seats = await runStage(ctx, 'S4', () => s4Analyze(ctx, lanePrompts));
|
|
195
|
+
const seats = await runStage(ctx, 'S4', () => s4Analyze(ctx, lanePrompts, needsSourceFallback));
|
|
169
196
|
const { kept } = await runStage(ctx, 'S5', () => s5Drift(ctx, contract, seats));
|
|
197
|
+
recordIdeaOutcomeFlags(ctx, contract, kept);
|
|
170
198
|
const positions = await runStage(ctx, 'S6', () => s6Positions(ctx, kept));
|
|
171
199
|
const graph = await runStage(ctx, 'S7', () => s7DecisionGraph(ctx, positions, rubric, contract.task));
|
|
172
200
|
const verifications = await runStage(ctx, 'S8', () => s8Verify(ctx, graph));
|
|
173
201
|
const rebuttals = await runStage(ctx, 'S8b', () => s8bRebuttal(ctx, graph, verifications, ctx.mode));
|
|
174
202
|
const judgeReport = await runStage(ctx, 'S9', () => s9Judge(ctx, contract, graph, verifications, rubric, rebuttals));
|
|
175
|
-
const actionPlan = await runStage(ctx, 'S9b', () => s9bPlan(ctx, contract, kept, graph, judgeReport));
|
|
203
|
+
const actionPlan = await runStage(ctx, 'S9b', () => s9bPlan(ctx, contract, kept, graph, judgeReport, input));
|
|
176
204
|
await runStage(ctx, 'S10', () => s10Render(ctx, { contract, seats: kept, graph, verifications, rebuttals, judgeReport, actionPlan, rubric, original: input }));
|
|
177
205
|
}
|
package/package.json
CHANGED