takomi 2.1.36 → 2.1.38
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/.pi/README.md +6 -3
- package/.pi/agents/orchestrator.md +9 -5
- package/.pi/extensions/oauth-router/commands.ts +36 -35
- package/.pi/extensions/oauth-router/index.ts +8 -8
- package/.pi/extensions/takomi-context-manager/diagnostics-tools.ts +40 -7
- package/.pi/extensions/takomi-context-manager/diagnostics.ts +534 -55
- package/.pi/extensions/takomi-context-manager/index.ts +14 -2
- package/.pi/extensions/takomi-context-manager/model-policy-gate.ts +16 -4
- package/.pi/extensions/takomi-context-manager/policy-tools.ts +7 -0
- package/.pi/extensions/takomi-context-manager/prerequisite-gates.ts +2 -0
- package/.pi/extensions/takomi-context-manager/session-state.ts +160 -0
- package/.pi/extensions/takomi-context-manager/skill-registry.ts +120 -0
- package/.pi/extensions/takomi-context-manager/skill-tools.ts +26 -3
- package/.pi/extensions/takomi-context-manager/state.ts +11 -1
- package/.pi/extensions/takomi-context-manager/types.ts +9 -1
- package/.pi/extensions/takomi-runtime/command-text.ts +2 -1
- package/.pi/extensions/takomi-runtime/commands.ts +13 -1
- package/.pi/extensions/takomi-subagents/index.ts +30 -3
- package/.pi/extensions/takomi-subagents/native-render.ts +3 -1
- package/.pi/extensions/takomi-subagents/pi-subagents-engine.ts +18 -3
- package/.pi/extensions/takomi-subagents/tool-runner.ts +38 -3
- package/.pi/prompts/takomi-prompt.md +6 -4
- package/.pi/takomi/policies/subagent-routing.md +9 -1
- package/.pi/takomi/policies/takomi-lifecycle-routing.md +3 -1
- package/README.md +22 -11
- package/assets/.agent/skills/exam-creator-skill/SKILL.md +182 -0
- package/assets/.agent/skills/exam-creator-skill/references/model-routing-policy.md +48 -0
- package/assets/.agent/skills/exam-creator-skill/references/workflow-rulebook.md +115 -0
- package/package.json +2 -2
- package/src/cli.js +38 -1
- package/src/doctor.js +7 -1
- package/src/pi-harness.js +96 -0
|
@@ -54,7 +54,8 @@ function createState(): SubagentState {
|
|
|
54
54
|
};
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
function resolveMode(params: TakomiSubagentToolParams): "single" | "parallel" | "chain" | undefined {
|
|
57
|
+
function resolveMode(params: TakomiSubagentToolParams): "single" | "parallel" | "chain" | "action" | undefined {
|
|
58
|
+
if (params.action) return "action";
|
|
58
59
|
const hasChain = Boolean(params.chain?.length);
|
|
59
60
|
const hasParallel = Boolean(params.tasks?.length);
|
|
60
61
|
const hasSingle = Boolean(params.agent && params.task);
|
|
@@ -205,13 +206,27 @@ function toSubagentParams(params: TakomiSubagentToolParams, rootCwd: string, dis
|
|
|
205
206
|
const base = {
|
|
206
207
|
agentScope: params.agentScope ?? "both",
|
|
207
208
|
cwd: rootCwd,
|
|
208
|
-
context:
|
|
209
|
-
async:
|
|
209
|
+
...(params.context ? { context: params.context } : {}),
|
|
210
|
+
...(params.async !== undefined ? { async: params.async } : {}),
|
|
211
|
+
...(params.concurrency !== undefined ? { concurrency: params.concurrency } : {}),
|
|
212
|
+
...(params.worktree !== undefined ? { worktree: params.worktree } : {}),
|
|
210
213
|
clarify: params.clarify === true,
|
|
211
214
|
includeProgress: true,
|
|
212
215
|
sessionDir: stableConversationSessionDir(rootCwd, tasks),
|
|
213
216
|
};
|
|
214
217
|
|
|
218
|
+
if (mode === "action") {
|
|
219
|
+
return {
|
|
220
|
+
...base,
|
|
221
|
+
action: params.action,
|
|
222
|
+
agent: params.agent,
|
|
223
|
+
chainName: params.chainName,
|
|
224
|
+
id: params.id,
|
|
225
|
+
message: params.message,
|
|
226
|
+
index: params.index,
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
|
|
215
230
|
if (mode === "single") {
|
|
216
231
|
const task = tasks[0]!;
|
|
217
232
|
const mapped = mapSingleTask(task, names, rootCwd);
|
|
@@ -25,11 +25,20 @@ export type TakomiSubagentToolTask = {
|
|
|
25
25
|
};
|
|
26
26
|
|
|
27
27
|
export type TakomiSubagentToolParams = Partial<TakomiSubagentToolTask> & {
|
|
28
|
+
action?: "list" | "get" | "models" | "status" | "interrupt" | "resume" | "doctor";
|
|
28
29
|
tasks?: TakomiSubagentToolTask[];
|
|
29
30
|
chain?: TakomiSubagentToolTask[];
|
|
30
31
|
confirmLaunch?: boolean;
|
|
31
32
|
previewOnly?: boolean;
|
|
32
33
|
clarify?: boolean;
|
|
34
|
+
context?: "fresh" | "fork";
|
|
35
|
+
async?: boolean;
|
|
36
|
+
concurrency?: number;
|
|
37
|
+
worktree?: boolean;
|
|
38
|
+
id?: string;
|
|
39
|
+
message?: string;
|
|
40
|
+
index?: number;
|
|
41
|
+
chainName?: string;
|
|
33
42
|
agentScope?: TakomiAgentScope;
|
|
34
43
|
};
|
|
35
44
|
|
|
@@ -247,6 +256,32 @@ export async function executeTakomiSubagentTool(
|
|
|
247
256
|
const profile = await loadTakomiProfile(rootCwd);
|
|
248
257
|
const runtimeLaunchMode = readRuntimeLaunchMode(ctx);
|
|
249
258
|
const agentScope = params.agentScope ?? "both";
|
|
259
|
+
|
|
260
|
+
if (params.action) {
|
|
261
|
+
try {
|
|
262
|
+
const nativeResult: any = await engine.execute(
|
|
263
|
+
"takomi-tool",
|
|
264
|
+
{ ...params, cwd: rootCwd, agentScope },
|
|
265
|
+
signal,
|
|
266
|
+
onUpdate as any,
|
|
267
|
+
ctx,
|
|
268
|
+
);
|
|
269
|
+
return {
|
|
270
|
+
...nativeResult,
|
|
271
|
+
details: {
|
|
272
|
+
...(nativeResult?.details ?? {}),
|
|
273
|
+
takomi: {
|
|
274
|
+
action: params.action,
|
|
275
|
+
agentScope,
|
|
276
|
+
},
|
|
277
|
+
},
|
|
278
|
+
};
|
|
279
|
+
} catch (error) {
|
|
280
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
281
|
+
return textResult(message, { results: [], action: params.action, agentScope }, true);
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
|
|
250
285
|
const agents = discoverTakomiAgents(rootCwd, agentScope);
|
|
251
286
|
const byName = new Map<string, TakomiAgentConfig>(agents.map((agent) => [agent.name, agent]));
|
|
252
287
|
const mode = resolveMode(params);
|
|
@@ -328,10 +363,10 @@ export async function executeTakomiSubagentTool(
|
|
|
328
363
|
}
|
|
329
364
|
try {
|
|
330
365
|
const nativeParams: TakomiSubagentToolParams = mode === "single"
|
|
331
|
-
? { ...params, ...tasks[0]!, agentScope }
|
|
366
|
+
? { ...params, ...tasks[0]!, cwd: rootCwd, agentScope }
|
|
332
367
|
: mode === "parallel"
|
|
333
|
-
? { ...params, tasks, agentScope }
|
|
334
|
-
: { ...params, chain: tasks, agentScope };
|
|
368
|
+
? { ...params, cwd: rootCwd, tasks, agentScope }
|
|
369
|
+
: { ...params, cwd: rootCwd, chain: tasks, agentScope };
|
|
335
370
|
|
|
336
371
|
const nativeResult: any = await engine.execute(
|
|
337
372
|
"takomi-tool",
|
|
@@ -16,9 +16,11 @@ Always-on Takomi behavior.
|
|
|
16
16
|
- Do not blend architecture, design, and implementation sloppily.
|
|
17
17
|
- When the right path is clear, make a recommendation instead of hedging.
|
|
18
18
|
- For broad work, Genesis may create the orchestration session that carries work into later stages.
|
|
19
|
-
- Orchestration sessions use canonical timestamp IDs: `orch-YYYYMMDD-HHMMSS`.
|
|
20
|
-
- Orchestration sessions are markdown-first: author `master_plan.md` and task packets first, then call `takomi_board` with the same `sessionId`, `masterPlanMarkdown`, task `taskMarkdown`, and matching task statuses. Do not create a second board session for already-authored session docs.
|
|
21
|
-
- `takomi_board` never runs subagents. Use `takomi_subagent` for execution, then come back to `takomi_board update_task` to record results.
|
|
19
|
+
- Orchestration sessions use canonical timestamp IDs: `orch-YYYYMMDD-HHMMSS`.
|
|
20
|
+
- Orchestration sessions are markdown-first: author `master_plan.md` and task packets first, then call `takomi_board` with the same `sessionId`, `masterPlanMarkdown`, task `taskMarkdown`, and matching task statuses. Do not create a second board session for already-authored session docs.
|
|
21
|
+
- `takomi_board` never runs subagents. Use `takomi_subagent` for execution, then come back to `takomi_board update_task` to record results.
|
|
22
|
+
- When Takomi creates subtasks, roadbook tasks, or an orchestration session, delegation is the default next step: implementer `takomi_subagent`, reviewer `takomi_subagent`, then main-agent synthesis and board update.
|
|
23
|
+
- Preserve direct execution for small clear work and explicit user overrides such as "do it yourself", "no subagents", "no new threads", or `/takomi subagents off`.
|
|
22
24
|
|
|
23
25
|
## Shared Mode Pattern
|
|
24
26
|
- Load context before acting.
|
|
@@ -57,5 +59,5 @@ Before using `takomi_subagent`, setting a model override, or naming a provider/m
|
|
|
57
59
|
- Design for sitemap, design system, mockups, and visual direction
|
|
58
60
|
- Build for implementation, verification, and handoff
|
|
59
61
|
- Review for audits, QA, or high-risk changes
|
|
60
|
-
- Orchestration for broad, multi-step, or delegated work
|
|
62
|
+
- Orchestration for broad, multi-step, or delegated work
|
|
61
63
|
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
# Subagent Routing Policy
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Once Takomi decomposes work into subtasks, roadbook tasks, or an orchestration session, use subagents by default. The main agent should coordinate, synthesize, update the board, and hand off to the user rather than acting as the primary implementer.
|
|
4
|
+
|
|
5
|
+
Do not delegate small direct tasks just because the tool exists. Direct execution is also allowed when the user says "do it yourself", "no subagents", "no new threads", disables subagents with `/takomi subagents off`, or the required delegation tooling is unavailable.
|
|
6
|
+
|
|
7
|
+
Default decomposed-work loop:
|
|
8
|
+
|
|
9
|
+
1. Send implementation to an implementer `takomi_subagent`.
|
|
10
|
+
2. Send the result to a separate reviewer `takomi_subagent`.
|
|
11
|
+
3. Let the main orchestrator synthesize, update the roadbook/board, and accept or redispatch.
|
|
4
12
|
|
|
5
13
|
Before calling `takomi_subagent`:
|
|
6
14
|
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Default to direct execution for small, clear tasks. Use Takomi lifecycle when scope is large, unclear, risky, multi-file, architecture-heavy, or benefits from durable artifacts.
|
|
4
4
|
|
|
5
|
+
When lifecycle routing creates subtasks, roadbook tasks, or an orchestration session, execution becomes delegation-first by default. The main agent remains responsible for context, sequencing, synthesis, board updates, acceptance, redispatch, and final user handoff.
|
|
6
|
+
|
|
5
7
|
Lifecycle:
|
|
6
8
|
|
|
7
9
|
1. Genesis: mission, constraints, requirements, issues, verification foundation.
|
|
@@ -9,4 +11,4 @@ Lifecycle:
|
|
|
9
11
|
3. Build: focused implementation tasks with verification.
|
|
10
12
|
4. Review/Finalize: regression, quality, docs, handoff.
|
|
11
13
|
|
|
12
|
-
Broad/meta-system projects must be decomposed into meaningful tasks. A single-task Genesis requires explicit justification.
|
|
14
|
+
Broad/meta-system projects must be decomposed into meaningful tasks. Decomposed broad work should not be executed primarily by the parent agent unless the user explicitly says "do it yourself", "no subagents", "no new threads", or otherwise opts out. A single-task Genesis requires explicit justification.
|
package/README.md
CHANGED
|
@@ -50,6 +50,8 @@ Legacy commands like `takomi install pi`, `takomi sync pi`, `takomi upgrade`, an
|
|
|
50
50
|
|
|
51
51
|
During `takomi setup pi` or `takomi setup pi-features`, Takomi offers optional Pi feature packs with recommended/manual/select-all/skip choices. Current defaults install **Takomi Interview** (`npm:@juicesharp/rpiv-ask-user-question`) so models can ask structured clarification questions. **Takomi Todo** (`npm:@juicesharp/rpiv-todo`), **Takomi Browser QA** (`npm:pi-chrome`), and **Takomi Doc Preview** (`npm:pi-markdown-preview`) remain opt-in. `takomi refresh` runs Pi's package updater so installed optional, custom, old, and new Pi packages are reconciled together.
|
|
52
52
|
|
|
53
|
+
Takomi keeps `pi-subagents` installed as an internal runtime module, but setup/refresh now detects legacy raw Pi subagent activation (`npm:pi-subagents` in Pi settings or `~/.pi/agent/extensions/subagent`) and offers to disable it so models see `takomi_subagent` instead of two competing subagent tools.
|
|
54
|
+
|
|
53
55
|
### Context Manager
|
|
54
56
|
|
|
55
57
|
Takomi now ships a Pi-native `takomi-context-manager` extension. It reduces prompt bloat with progressive context loading:
|
|
@@ -60,6 +62,7 @@ Takomi now ships a Pi-native `takomi-context-manager` extension. It reduces prom
|
|
|
60
62
|
- `takomi_subagent` is guarded by routing-policy context and can recover from wrong-provider model choices
|
|
61
63
|
- `/context-report` shows prompt compaction, loaded skills/policies, blocked actions, model-routing corrections, and duplicate extension diagnostics
|
|
62
64
|
|
|
65
|
+
`context_report` is context-manager-specific rather than a clone of Pi's Alt-C window. It restores its own hidden snapshots and Pi tool-result history after `/reload`/restart, and labels any remaining gaps instead of reporting fresh in-memory zeros as session truth. It supports `mode: "summary" | "verbose" | "problems"`; `verbose: true` remains a compatibility alias for `mode: "verbose"`. The `/context-report` slash command supports argument completions for `summary`, `verbose`, and `problems`.
|
|
63
66
|
|
|
64
67
|
### Option A: Global Install (Best for Multi-IDE Users) ⭐
|
|
65
68
|
|
|
@@ -112,17 +115,25 @@ run vibe genesis
|
|
|
112
115
|
continue build with takomi
|
|
113
116
|
```
|
|
114
117
|
|
|
115
|
-
Install the Takomi protocol suite:
|
|
116
|
-
|
|
117
|
-
```bash
|
|
118
|
-
npx -y skills add https://github.com/JStaRFilms/VibeCode-Protocol-Suite --skill takomi
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
Original Takomi-authored skills in this bundle include `21st-dev-components`, `takomi`, `global-brand-namer`, `jstar-reviewer`, and the core VibeCode/Takomi workflow skills that ship with the CLI.
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
118
|
+
Install the Takomi protocol suite:
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
npx -y skills add https://github.com/JStaRFilms/VibeCode-Protocol-Suite --skill takomi
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
Original Takomi-authored skills in this bundle include `21st-dev-components`, `takomi`, `global-brand-namer`, `jstar-reviewer`, and the core VibeCode/Takomi workflow skills that ship with the CLI.
|
|
125
|
+
|
|
126
|
+
### Codex Plugin Quick Start
|
|
127
|
+
|
|
128
|
+
For the newer repo-local Codex plugin path, enable `takomi-codex` from `.agents/plugins/marketplace.json`. That marketplace entry points Codex at `./plugins/takomi-codex`, which includes plugin metadata, the `takomi-codex` skill, and local verification scripts.
|
|
129
|
+
|
|
130
|
+
This plugin path is distinct from `skills add --skill takomi`, which installs the older global Takomi skill. Use natural language such as `use takomi-codex to inspect this repo`, `use Takomi to plan this feature`, or `create a Takomi roadbook for this work`.
|
|
131
|
+
|
|
132
|
+
See [Takomi Codex Onboarding](docs/takomi-codex-onboarding.md) for activation, first-run verification, policy loading, roadbooks, dry-run dispatch, no-Pi fallback, and troubleshooting.
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
## 📦 Skill Ecosystem
|
|
126
137
|
|
|
127
138
|
Think of skills as specialized team members you can summon on demand. From security audits to AI video generation — there's a skill for that.
|
|
128
139
|
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: exam-creator-skill
|
|
3
|
+
description: Creates and revises school exam papers using Johno's preferred workflow. Use for JSS/Primary exam generation, remixing questions from lesson notes or chat transcripts, building question papers plus marking schemes, creating assets folders for diagrams, applying the 40-mark house style, producing compact DOCX output, and running draft/marking/verification passes with room for user feedback and revisions.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Exam Creator Skill
|
|
7
|
+
|
|
8
|
+
Use this skill when building or revising school exam papers, especially for OBHIS / Olive Blessed Crest Academy.
|
|
9
|
+
|
|
10
|
+
See the detailed house rules in [references/workflow-rulebook.md](references/workflow-rulebook.md).
|
|
11
|
+
See the model routing policy in [references/model-routing-policy.md](references/model-routing-policy.md).
|
|
12
|
+
|
|
13
|
+
## Core Principle
|
|
14
|
+
|
|
15
|
+
Follow the user's house style by default, but always leave room for correction. If the user gives a new rule, prefer the new rule and update the working assumptions before generating more papers.
|
|
16
|
+
|
|
17
|
+
Terminology rule: when the user says **Gemini**, treat that as **Gemini via the agy CLI** unless the user explicitly says otherwise.
|
|
18
|
+
|
|
19
|
+
## Default Workflow
|
|
20
|
+
|
|
21
|
+
1. **Identify the subject, class, term, and destination folder.**
|
|
22
|
+
2. **Collect the authority material**:
|
|
23
|
+
- lesson notes
|
|
24
|
+
- ChatGPT transcripts
|
|
25
|
+
- sample exam layout if provided
|
|
26
|
+
- photographed handwritten pages, when provided
|
|
27
|
+
3. **For photographed handwritten pages, extract with multimodal vision first**:
|
|
28
|
+
- use a multimodal model/subagent to read the image directly
|
|
29
|
+
- batch images in small ordered groups, usually 3-5 images per extraction task
|
|
30
|
+
- explicitly forbid OCR/Tesseract/Python preprocessing on the first pass unless the model is not multimodal
|
|
31
|
+
- use OCR only as fallback when direct model vision is unavailable or fails on a specific page
|
|
32
|
+
- preserve image filename/page references for every uncertain item
|
|
33
|
+
4. **Confirm the paper pattern before drafting** if any of these are unclear:
|
|
34
|
+
- subject family (Mathematics/English vs other subjects)
|
|
35
|
+
- mark split
|
|
36
|
+
- question counts
|
|
37
|
+
- whether theory is answer-all or answer-any
|
|
38
|
+
5. **Create or reuse clean folders**:
|
|
39
|
+
- `Questions/`
|
|
40
|
+
- `Marking Scheme/` only when requested
|
|
41
|
+
- `Questions/assets/` for all generated SVG/PNG/image diagrams
|
|
42
|
+
6. **Draft the paper first.**
|
|
43
|
+
7. **Create the marking scheme second only when requested.**
|
|
44
|
+
8. **Run an independent verification pass third.**
|
|
45
|
+
9. **Apply user feedback and rerender** instead of defending the first draft.
|
|
46
|
+
|
|
47
|
+
## Preferred Multi-Agent Pattern
|
|
48
|
+
|
|
49
|
+
Default model split:
|
|
50
|
+
- orchestrator: parent assistant
|
|
51
|
+
- drafting: Gemini via agy CLI by default, escalate to GPT 5.4 High when the paper is tricky
|
|
52
|
+
- marking: Gemini via agy CLI
|
|
53
|
+
- verification: GPT
|
|
54
|
+
|
|
55
|
+
When subagents are available, use this split:
|
|
56
|
+
|
|
57
|
+
- **Drafting agent**: creates the paper and diagram assets.
|
|
58
|
+
- **Marking agent**: creates the marking scheme and validates every objective answer.
|
|
59
|
+
- **Review agent**: independently rechecks answers, numbering, marks, wording, and diagram correctness.
|
|
60
|
+
|
|
61
|
+
If subagents are not available, still preserve the same three-pass logic manually.
|
|
62
|
+
|
|
63
|
+
## House Rules To Hardcode
|
|
64
|
+
|
|
65
|
+
### 1) Marks and paper shape
|
|
66
|
+
|
|
67
|
+
#### Mathematics and English
|
|
68
|
+
Use this as the default unless the user overrides it:
|
|
69
|
+
|
|
70
|
+
- total exam score: **40 marks**
|
|
71
|
+
- **50 objective questions**
|
|
72
|
+
- each objective = **1/2 mark**
|
|
73
|
+
- objective total = **25 marks**
|
|
74
|
+
- **5 theory questions**
|
|
75
|
+
- student answers **any 3**
|
|
76
|
+
- theory total = **15 marks**
|
|
77
|
+
- no separate Section B short-answer block unless the user explicitly asks for one
|
|
78
|
+
|
|
79
|
+
#### Other subjects
|
|
80
|
+
Default assumption:
|
|
81
|
+
|
|
82
|
+
- still over **40 marks** total
|
|
83
|
+
- can include open-ended plus theory sections
|
|
84
|
+
- if the exact split is not stated, ask before finalizing
|
|
85
|
+
|
|
86
|
+
Never silently reuse the old 100-mark structure unless the user explicitly asks for it.
|
|
87
|
+
|
|
88
|
+
### 2) Layout rules
|
|
89
|
+
|
|
90
|
+
For the final paper DOCX, prefer:
|
|
91
|
+
|
|
92
|
+
- **Times New Roman**
|
|
93
|
+
- use one font size consistently within a paper; **start with 14 pt** and only reduce it if layout pressure makes it necessary
|
|
94
|
+
- narrow margins
|
|
95
|
+
- every exam header should include, in this order where possible: school name, academic session, term/exam title, pupil name/date line, examination number/time line, class, arm, subject, and instructions
|
|
96
|
+
- header must be **1-column**
|
|
97
|
+
- body should be **1-column by default**; use 2-column or 3-column only when it genuinely improves fit for dense objective papers
|
|
98
|
+
- do not apply a multi-column body just because the skill mentions compact layout; use judgment per subject
|
|
99
|
+
- bold black headings instead of oversized decorative headings
|
|
100
|
+
- objective options must start on the **same line as the question** whenever possible; keep them inline with about 3 spaces between choices, not vertically stacked unless unavoidable
|
|
101
|
+
- if the paper looks like it will run to **3 pages**, try a **2-column or 3-column body layout** before reducing the font size; use judgment based on content density
|
|
102
|
+
- preserve the school name and student-detail heading fields from the source, or leave clear blanks/placeholders if they are not provided
|
|
103
|
+
- if the source uses an arm/stream/class line, keep it but do not hardcode labels like `Arm:` unless the source explicitly requires them
|
|
104
|
+
- when using separate header/body sections in DOCX, make the body section **continuous** so it does not jump to a new page
|
|
105
|
+
- avoid hard page breaks between the heading block and the paper body unless the user explicitly asks for a new page
|
|
106
|
+
- remove explicit `Total Marks: ...` header line unless requested
|
|
107
|
+
- target about **2 pages** per paper where practical
|
|
108
|
+
|
|
109
|
+
### 3) Diagram and image rules
|
|
110
|
+
|
|
111
|
+
- Keep all generated figures inside `Questions/assets/`.
|
|
112
|
+
- Choose the diagram method by complexity:
|
|
113
|
+
- simple geometric/line diagrams, tables, clocks, arrows, and labels: SVG first; generate PNG copies if DOCX rendering needs them
|
|
114
|
+
- pictorial objects for young pupils, e.g. mango, pot, bucket, moon, table, cup, house, animals, people, classroom objects: prefer Anti-Gravity image generation or another image-generation path, then place the generated PNG/JPG in `Questions/assets/`
|
|
115
|
+
- hybrid diagrams: combine clean SVG labels/structure with generated image assets when useful
|
|
116
|
+
- When using Anti-Gravity for diagrams, explicitly tell it whether to generate images, use SVG, or use a hybrid method, and require it to report which method was used.
|
|
117
|
+
- Never include the teacher's written answer labels in student-facing diagrams. If the source labels a keyboard as "Keyboard" or groups division answers for marking guidance, remove that answer/label from the final exam.
|
|
118
|
+
- Keep diagrams separated when the source has separate question items or separate objects that must be arranged on the paper. Do not combine unrelated drawings into one asset just for convenience; combine only when the source/question explicitly presents them as one group.
|
|
119
|
+
- Preserve the source question order for diagram-heavy nursery/primary papers by rebuilding from the original images, not only from extraction summaries.
|
|
120
|
+
- If an item asks pupils to colour an object or flag, do not colour it in the exam; provide an outline only unless the instruction asks for a sample.
|
|
121
|
+
- Keep angle labels and vertex labels clearly visible for geometry.
|
|
122
|
+
- Avoid placing numbers directly on triangle edges.
|
|
123
|
+
- If labels are cramped, move them outward and add white-backed label boxes if needed.
|
|
124
|
+
|
|
125
|
+
### 4) Feedback loop
|
|
126
|
+
|
|
127
|
+
After each significant draft:
|
|
128
|
+
|
|
129
|
+
- expect user corrections
|
|
130
|
+
- revise quickly
|
|
131
|
+
- update the source files and rerender the DOCX
|
|
132
|
+
- if the DOCX is locked/open, save a `v2` file rather than failing the task
|
|
133
|
+
|
|
134
|
+
## Output Expectations
|
|
135
|
+
|
|
136
|
+
For each subject batch, try to maintain:
|
|
137
|
+
|
|
138
|
+
- editable paper source, usually `questions.md`
|
|
139
|
+
- concise support/source metadata if useful
|
|
140
|
+
- final DOCX for the paper
|
|
141
|
+
- marking scheme source
|
|
142
|
+
- final DOCX for the marking scheme when requested
|
|
143
|
+
- objective-validation notes
|
|
144
|
+
- verification report
|
|
145
|
+
- all diagrams in `Questions/assets/`
|
|
146
|
+
|
|
147
|
+
## Authoring Guidance
|
|
148
|
+
|
|
149
|
+
- Keep questions standard and school-appropriate.
|
|
150
|
+
- Remix questions reasonably from the provided curriculum material.
|
|
151
|
+
- Stay within the authority source unless the user allows expansion.
|
|
152
|
+
- Make objective questions unambiguous.
|
|
153
|
+
- Do not leak answers from teacher notes, source annotations, labels, grouped examples, or marking cues into the student-facing paper.
|
|
154
|
+
- For handwritten sources, try hard to infer unclear words from context, subject vocabulary, options, and neighboring pages before marking `[unclear]`.
|
|
155
|
+
- If uncertainty remains, create a user-review list with image filename/page number, question number, cropped/quoted context if possible, and the competing interpretations. Ask the user instead of leaving unexplained uncertainty in the final paper.
|
|
156
|
+
- Ensure the marking scheme matches final numbering exactly when a marking scheme is requested.
|
|
157
|
+
- For diagrams, refer to them consistently as Diagram A, B, C, etc.
|
|
158
|
+
|
|
159
|
+
## Required Clarifications
|
|
160
|
+
|
|
161
|
+
Ask the user before proceeding when any of the following is missing:
|
|
162
|
+
|
|
163
|
+
- subject
|
|
164
|
+
- class level
|
|
165
|
+
- authority source
|
|
166
|
+
- sample layout path if layout matching matters
|
|
167
|
+
- exact marks pattern for non-Math/non-English subjects
|
|
168
|
+
- desired final format if not obvious
|
|
169
|
+
- final interpretation of handwritten items that remain ambiguous after a multimodal-first extraction pass and contextual inference
|
|
170
|
+
|
|
171
|
+
## Safe Revision Rules
|
|
172
|
+
|
|
173
|
+
When updating an already-generated paper:
|
|
174
|
+
|
|
175
|
+
1. revise the editable source first
|
|
176
|
+
2. revise the marking scheme next if numbering/marks changed
|
|
177
|
+
3. rerun validation/verification if answers, wording, or diagrams changed
|
|
178
|
+
4. rerender DOCX last
|
|
179
|
+
|
|
180
|
+
## Reference
|
|
181
|
+
|
|
182
|
+
Load and follow [references/workflow-rulebook.md](references/workflow-rulebook.md) when you need the exact house style details.
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Exam Creator Model Routing Policy
|
|
2
|
+
|
|
3
|
+
Use this routing policy for the exam-creation workflow unless the user overrides it.
|
|
4
|
+
|
|
5
|
+
## Terminology Rule
|
|
6
|
+
|
|
7
|
+
When the user says **Gemini**, interpret that as **Gemini via the agy CLI** unless the user explicitly says otherwise.
|
|
8
|
+
|
|
9
|
+
## Default Routing
|
|
10
|
+
|
|
11
|
+
- **Orchestrator:** parent assistant / orchestrator
|
|
12
|
+
- **Drafting agent:** **Gemini via agy CLI**
|
|
13
|
+
- **Marking agent:** **Gemini via agy CLI**
|
|
14
|
+
- **Verification agent:** **GPT**
|
|
15
|
+
|
|
16
|
+
## Why This Is The Default
|
|
17
|
+
|
|
18
|
+
- Drafting and marking are the highest-volume steps.
|
|
19
|
+
- Gemini is preferred there because it is cheaper and faster.
|
|
20
|
+
- Verification is the quality gate, so GPT is preferred for the final correctness check.
|
|
21
|
+
|
|
22
|
+
## Escalation Rule For Drafting
|
|
23
|
+
|
|
24
|
+
Upgrade the **drafting agent** from Gemini via agy CLI to **GPT 5.4 High** when any of these are true:
|
|
25
|
+
|
|
26
|
+
- the source notes are messy or inconsistent
|
|
27
|
+
- the subject requires tighter wording judgment
|
|
28
|
+
- ambiguity risk is high
|
|
29
|
+
- the diagram/question structure is more delicate than usual
|
|
30
|
+
- the paper is Mathematics or English and extra care is desired
|
|
31
|
+
|
|
32
|
+
## Practical Modes
|
|
33
|
+
|
|
34
|
+
### Default cheap/fast mode
|
|
35
|
+
- Orchestrator → parent assistant
|
|
36
|
+
- Drafting → Gemini via agy CLI
|
|
37
|
+
- Marking → Gemini via agy CLI
|
|
38
|
+
- Verification → GPT
|
|
39
|
+
|
|
40
|
+
### Escalated drafting mode
|
|
41
|
+
- Orchestrator → parent assistant
|
|
42
|
+
- Drafting → GPT 5.4 High
|
|
43
|
+
- Marking → Gemini via agy CLI
|
|
44
|
+
- Verification → GPT
|
|
45
|
+
|
|
46
|
+
## Guiding Principle
|
|
47
|
+
|
|
48
|
+
Use **Gemini via agy CLI for drafting and marking by default**, **GPT for verification**, and only upgrade drafting to **GPT 5.4 High** when the paper is tricky enough to justify the extra cost.
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
# OBHIS Exam Workflow Rulebook
|
|
2
|
+
|
|
3
|
+
This reference captures the current house style agreed during the Mathematics paper workflow.
|
|
4
|
+
|
|
5
|
+
## Scope
|
|
6
|
+
|
|
7
|
+
Use this rulebook for OBHIS / Olive Blessed Crest Academy exam generation unless the user gives a newer rule.
|
|
8
|
+
|
|
9
|
+
## Terminology Rule
|
|
10
|
+
|
|
11
|
+
When the user says **Gemini**, interpret that as **Gemini via the agy CLI** unless the user explicitly says otherwise.
|
|
12
|
+
|
|
13
|
+
## Workflow Summary
|
|
14
|
+
|
|
15
|
+
1. Gather source materials.
|
|
16
|
+
2. For photographed handwritten pages, run a multimodal-first extraction pass before OCR:
|
|
17
|
+
- use direct model vision on the image files
|
|
18
|
+
- batch images in small ordered groups, usually 3-5 images per model task
|
|
19
|
+
- explicitly forbid OCR/Tesseract/Python preprocessing on the first pass
|
|
20
|
+
- use OCR only as fallback when direct vision is unavailable or fails for a specific page
|
|
21
|
+
3. Confirm subject-specific mark pattern.
|
|
22
|
+
4. Create clean folder structure.
|
|
23
|
+
5. Draft question paper.
|
|
24
|
+
6. Build marking scheme only when requested.
|
|
25
|
+
7. Independently verify.
|
|
26
|
+
8. Incorporate user feedback.
|
|
27
|
+
9. Rerender deliverables.
|
|
28
|
+
|
|
29
|
+
## Folder Structure
|
|
30
|
+
|
|
31
|
+
Preferred output structure:
|
|
32
|
+
|
|
33
|
+
- `Questions/`
|
|
34
|
+
- `questions.md`
|
|
35
|
+
- final exam `.docx`
|
|
36
|
+
- `assets/`
|
|
37
|
+
- all SVG diagrams
|
|
38
|
+
- all PNG diagram copies used for Word export
|
|
39
|
+
- `Marking Scheme/` only when requested
|
|
40
|
+
- `marking-scheme.md`
|
|
41
|
+
- `objective-validation.md`
|
|
42
|
+
- `verification-report.md`
|
|
43
|
+
- marking-scheme `.docx` if needed
|
|
44
|
+
|
|
45
|
+
## Subject Rules
|
|
46
|
+
|
|
47
|
+
### Mathematics and English
|
|
48
|
+
|
|
49
|
+
Default pattern:
|
|
50
|
+
|
|
51
|
+
- exam total = **40 marks**
|
|
52
|
+
- objective count = **50**
|
|
53
|
+
- objective marks = **0.5 each**
|
|
54
|
+
- objective total = **25 marks**
|
|
55
|
+
- theory questions = **5**
|
|
56
|
+
- answer any = **3**
|
|
57
|
+
- theory total = **15 marks**
|
|
58
|
+
- no separate short-answer section by default
|
|
59
|
+
|
|
60
|
+
### Other Subjects
|
|
61
|
+
|
|
62
|
+
Current preference:
|
|
63
|
+
|
|
64
|
+
- may still use open-ended and theory sections
|
|
65
|
+
- still intended to fit the 40-mark exam system
|
|
66
|
+
- exact split should be clarified before final generation if not explicitly stated
|
|
67
|
+
|
|
68
|
+
## Layout Rules
|
|
69
|
+
|
|
70
|
+
- use **Times New Roman**
|
|
71
|
+
- default body size **12 pt**
|
|
72
|
+
- narrow margins
|
|
73
|
+
- compact layout
|
|
74
|
+
- header must be 1-column and should include: school name, academic session, term/exam title, pupil name/date, examination number/time, class, arm, subject, and instructions
|
|
75
|
+
- body is **1-column by default**
|
|
76
|
+
- use 2-column/3-column body only when a dense objective paper genuinely needs it for fit; do not apply columns mechanically to every subject
|
|
77
|
+
- headings should be bold and black, not oversized
|
|
78
|
+
- objective options should appear inline or compactly, not stacked unless unavoidable
|
|
79
|
+
- remove `Total Marks` line unless requested
|
|
80
|
+
- try to keep each paper around **2 pages** where practical
|
|
81
|
+
|
|
82
|
+
## Diagram Rules
|
|
83
|
+
|
|
84
|
+
- store diagrams in `Questions/assets/`
|
|
85
|
+
- simple line/geometry diagrams: prefer SVG masters plus PNG export copies
|
|
86
|
+
- pictorial nursery/primary objects (mango, pot, bucket, moon, table, cup, animals, classroom objects, etc.): prefer Anti-Gravity image generation or another image-generation path instead of rough SVG-only drawings
|
|
87
|
+
- Anti-Gravity can generate images; when using it, instruct whether to generate images, use SVG, or use a hybrid method, and require a report of the method used
|
|
88
|
+
- do not include answer labels from the teacher’s source in the student-facing diagram, e.g. do not label the keyboard as “Keyboard” when the question asks pupils to identify it
|
|
89
|
+
- keep separate source drawings as separate assets unless the question explicitly presents them as one grouped diagram; this helps preserve order and layout
|
|
90
|
+
- for diagram-heavy papers, rebuild the draft directly from the original tagged images instead of relying only on extraction summaries
|
|
91
|
+
- do not show worked/grouped answers in division or counting diagrams when the child is supposed to solve them
|
|
92
|
+
- if pupils are asked to colour an object or flag, leave it as an outline unless the exam explicitly asks for a sample
|
|
93
|
+
- labels must be readable when labels are part of the prompt rather than the answer
|
|
94
|
+
- angle values must not be hidden by edges
|
|
95
|
+
- move text away from lines when needed
|
|
96
|
+
- rerender diagrams if the user reports visibility problems
|
|
97
|
+
|
|
98
|
+
## Review Rules
|
|
99
|
+
|
|
100
|
+
- objective answer validation is mandatory when a marking scheme or answer key is requested
|
|
101
|
+
- marking scheme must match final numbering when requested
|
|
102
|
+
- verification should independently confirm correctness
|
|
103
|
+
- for handwritten sources, infer unclear text aggressively from context before marking it unclear
|
|
104
|
+
- any remaining ambiguous handwriting must be captured in a user-review list with image filename/page reference, question number, and candidate interpretations
|
|
105
|
+
- if a wording ambiguity is found, fix the paper and then realign the scheme when a scheme exists
|
|
106
|
+
|
|
107
|
+
## Feedback Rules
|
|
108
|
+
|
|
109
|
+
- user feedback overrides previous assumptions
|
|
110
|
+
- update future papers to follow the corrected rule
|
|
111
|
+
- if a DOCX is locked, save a versioned file such as `v2`
|
|
112
|
+
|
|
113
|
+
## Notes
|
|
114
|
+
|
|
115
|
+
This rulebook is intentionally opinionated because it represents Johno's workflow. Keep it flexible enough to ask follow-up questions whenever a new subject or mark pattern does not clearly fit the stored defaults.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "takomi",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.38",
|
|
4
4
|
"description": "🎯 Stop wrestling with AI. Start building with purpose. The artisan's toolkit for agent workflows, Codex skills, and original Takomi capabilities like 21st.dev integration.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"commander": "^13.1.0",
|
|
51
51
|
"figlet": "^1.8.0",
|
|
52
52
|
"fs-extra": "^11.3.0",
|
|
53
|
-
"pi-subagents": "0.
|
|
53
|
+
"pi-subagents": "0.31.0",
|
|
54
54
|
"picocolors": "^1.1.1",
|
|
55
55
|
"prompts": "^2.4.2"
|
|
56
56
|
},
|
package/src/cli.js
CHANGED
|
@@ -44,7 +44,7 @@ import {
|
|
|
44
44
|
isStoreInitialized,
|
|
45
45
|
} from './store.js';
|
|
46
46
|
import { runDoctor } from './doctor.js';
|
|
47
|
-
import { ensurePiInstalled, ensurePiSubagentsInstalled, launchTakomiHarness, printPiInstallResult, printPiSubagentsInstallResult, updatePiCliPackage, updatePiManagedPackages, printPiManagedPackageUpdateResult } from './pi-harness.js';
|
|
47
|
+
import { disableRawPiSubagentsActivation, ensurePiInstalled, ensurePiSubagentsInstalled, formatRawPiSubagentsDisableActions, formatRawPiSubagentsFindings, inspectRawPiSubagentsActivation, launchTakomiHarness, printPiInstallResult, printPiSubagentsInstallResult, updatePiCliPackage, updatePiManagedPackages, printPiManagedPackageUpdateResult } from './pi-harness.js';
|
|
48
48
|
import { installPiHarnessAssets, printPiInstallSummary, syncPiHarnessAssets, validatePiHarnessInstall } from './pi-installer.js';
|
|
49
49
|
import { offerPiOptionalFeatures } from './pi-optional-features.js';
|
|
50
50
|
import {
|
|
@@ -461,6 +461,37 @@ async function installAllTargets(options = {}) {
|
|
|
461
461
|
await installSkillsTarget();
|
|
462
462
|
}
|
|
463
463
|
|
|
464
|
+
async function offerRawPiSubagentsHardening({ interactive = process.stdin.isTTY && process.stdout.isTTY } = {}) {
|
|
465
|
+
const audit = await inspectRawPiSubagentsActivation({ cwd: process.cwd() });
|
|
466
|
+
if (!audit.findings.length) return;
|
|
467
|
+
|
|
468
|
+
console.log(pc.yellow('\n⚠ Raw Pi subagents activation detected'));
|
|
469
|
+
console.log(pc.dim(formatRawPiSubagentsFindings(audit.findings)));
|
|
470
|
+
console.log(pc.dim('\nTakomi keeps pi-subagents installed as an internal module, but raw Pi activation exposes the separate `subagent` tool next to `takomi_subagent`.'));
|
|
471
|
+
|
|
472
|
+
let shouldDisable = process.env.TAKOMI_DISABLE_RAW_PI_SUBAGENTS === '1';
|
|
473
|
+
if (interactive && process.env.TAKOMI_DISABLE_RAW_PI_SUBAGENTS !== '1') {
|
|
474
|
+
const response = await prompts({
|
|
475
|
+
type: 'confirm',
|
|
476
|
+
name: 'disable',
|
|
477
|
+
message: 'Disable raw Pi subagents activation so agents only see takomi_subagent?',
|
|
478
|
+
initial: true,
|
|
479
|
+
});
|
|
480
|
+
shouldDisable = response.disable === true;
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
if (!shouldDisable) {
|
|
484
|
+
console.log(pc.yellow(interactive
|
|
485
|
+
? 'Leaving raw Pi subagents activation unchanged.'
|
|
486
|
+
: 'Non-interactive run: leaving raw Pi subagents activation unchanged. Set TAKOMI_DISABLE_RAW_PI_SUBAGENTS=1 to disable automatically.'));
|
|
487
|
+
return;
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
const result = await disableRawPiSubagentsActivation({ cwd: process.cwd() });
|
|
491
|
+
console.log(pc.green('✔ Disabled raw Pi subagents activation'));
|
|
492
|
+
console.log(pc.dim(formatRawPiSubagentsDisableActions(result.actions)));
|
|
493
|
+
}
|
|
494
|
+
|
|
464
495
|
async function installPiTarget(options = {}) {
|
|
465
496
|
const { offerOptionalFeatures = true } = options;
|
|
466
497
|
console.log(pc.magenta('🧭 Pi Harness Preflight\n'));
|
|
@@ -493,12 +524,14 @@ async function installPiTarget(options = {}) {
|
|
|
493
524
|
const result = await installPiHarnessAssets(program.version());
|
|
494
525
|
const validation = await validatePiHarnessInstall();
|
|
495
526
|
printPiInstallSummary(result, validation);
|
|
527
|
+
await offerRawPiSubagentsHardening();
|
|
496
528
|
if (offerOptionalFeatures) {
|
|
497
529
|
console.log(pc.cyan('\n🧩 Optional Takomi Pi feature packs...\n'));
|
|
498
530
|
await offerPiOptionalFeatures({ interactive: true });
|
|
499
531
|
}
|
|
500
532
|
console.log(pc.cyan('\n📦 Checking Pi-managed extension package updates...\n'));
|
|
501
533
|
printPiManagedPackageUpdateResult(await updatePiManagedPackages());
|
|
534
|
+
await offerRawPiSubagentsHardening();
|
|
502
535
|
console.log(pc.dim('\nNext: cd <project> && takomi\n'));
|
|
503
536
|
} catch (error) {
|
|
504
537
|
console.log(pc.red('\nPi harness asset install failed.'));
|
|
@@ -512,8 +545,10 @@ async function installPiOptionalFeaturesTarget() {
|
|
|
512
545
|
printPiInstallResult(pi);
|
|
513
546
|
if (!pi.ok) return;
|
|
514
547
|
await offerPiOptionalFeatures({ interactive: true });
|
|
548
|
+
await offerRawPiSubagentsHardening();
|
|
515
549
|
console.log(pc.cyan('\n📦 Checking Pi-managed extension package updates...\n'));
|
|
516
550
|
printPiManagedPackageUpdateResult(await updatePiManagedPackages());
|
|
551
|
+
await offerRawPiSubagentsHardening();
|
|
517
552
|
}
|
|
518
553
|
|
|
519
554
|
async function syncPiTarget() {
|
|
@@ -522,8 +557,10 @@ async function syncPiTarget() {
|
|
|
522
557
|
const result = await syncPiHarnessAssets(program.version());
|
|
523
558
|
const validation = await validatePiHarnessInstall();
|
|
524
559
|
printPiInstallSummary(result, validation);
|
|
560
|
+
await offerRawPiSubagentsHardening();
|
|
525
561
|
console.log(pc.cyan('\n📦 Checking Pi-managed extension package updates...\n'));
|
|
526
562
|
printPiManagedPackageUpdateResult(await updatePiManagedPackages());
|
|
563
|
+
await offerRawPiSubagentsHardening();
|
|
527
564
|
} catch (error) {
|
|
528
565
|
console.log(pc.red('\nPi sync failed.'));
|
|
529
566
|
console.log(pc.dim(String(error?.message || error)));
|