Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
519b94b
Add Pi settings that scan the pi-flow role folders
prineycom Nov 9, 2026
d90294c
Add the seven Pi pipeline roles with answer schemas
prineycom Nov 9, 2026
e59a0fd
Add the Pi workflow templates standard, parallel and investigate
prineycom Nov 9, 2026
ff03900
Drop the /review command from PLAN-FORMAT and add the Execution section
prineycom Nov 9, 2026
668192d
Name the Pi roles in PIPELINE and correct the child PI_SESSION_ID
prineycom Nov 9, 2026
c713e13
Describe the Pi role and template formats, own roles and model tiers
prineycom Nov 9, 2026
74af105
Name the Pi pipeline resources in README, engine development and test…
prineycom Nov 9, 2026
b1d56a0
Record MP-116 in the changelog
prineycom Nov 9, 2026
5883f49
Chain the parallel template without nested async functions
prineycom Nov 9, 2026
4df7429
Reject async functions in the Pi workflow templates test
prineycom Nov 9, 2026
d5661c9
Say workflow templates take no nested async functions
prineycom Nov 9, 2026
c697239
Merge MP-116: Роли, шаблоны и контракты для Pi
prineycom Nov 9, 2026
0a1202c
Add the mypi_ask tool to the Pi extension
prineycom Nov 9, 2026
6819c10
Add the /flow command to the Pi extension
prineycom Nov 9, 2026
9915b90
Add the Pi-only flow skill up to the agreed plan
prineycom Nov 9, 2026
81e4208
Document the Pi /flow and its tool bindings in the pipeline
prineycom Nov 9, 2026
c2e0e8d
Document the Pi /flow command and mypi_ask in integration, testing an…
prineycom Nov 9, 2026
9328e53
Note the Pi /flow part 1 in the changelog
prineycom Nov 9, 2026
dcb4fc2
Quote the flow skill description so Pi parses its frontmatter
prineycom Nov 9, 2026
923eddb
Make the scout ask about alternatives the task leaves open
prineycom Nov 9, 2026
fd2d063
Narrow the scout's open-alternatives rule to forks within the three
prineycom Nov 9, 2026
7029706
Test that every shared skill has a frontmatter Pi can parse
prineycom Nov 9, 2026
9e5117d
Commit the answers already written when a /flow question is cancelled
prineycom Nov 9, 2026
34f8a1d
Say in the mypi_ask description that a cancelled answer is not recorded
prineycom Nov 9, 2026
64f8a8f
List the shared skills frontmatter test in the testing policy
prineycom Nov 9, 2026
87f35b6
Merge MP-117: /flow в Pi, часть 1: от команды до согласованного плана
prineycom Nov 9, 2026
c7146b9
Report outside-plan files and review ranges from the Pi flow templates
prineycom Nov 9, 2026
1b7860c
Let the Pi tester follow the project stand document and hand a stand …
prineycom Nov 9, 2026
2dff59d
Name the stand document and the release in the plan Execution section
prineycom Nov 9, 2026
42d10d7
Run the Pi flow from the agreed plan to the merge and the release
prineycom Nov 9, 2026
5cf396a
Document the Pi flow execution, approval and release in the pipeline
prineycom Nov 9, 2026
83f53c7
Name the Pi flow release exception, its tests and the changelog entry
prineycom Nov 9, 2026
dbddca7
Start the Pi flow base check of a reworked key from its own last flow…
prineycom Nov 9, 2026
20dc3ab
Describe the Pi /flow command as running to the merge and the release
prineycom Nov 9, 2026
d6d89d7
Take every Pi flow plan URL from the key's derive.json
prineycom Nov 9, 2026
1542977
Place every Pi flow line in the score header with its own commit
prineycom Nov 9, 2026
ecb2c92
Keep Pi flow acceptance remarks in progress.md, out of the score
prineycom Nov 9, 2026
42e1ef3
Push the Pi flow branch before the self-test
prineycom Nov 9, 2026
566bb14
List every executed key in the Pi flow PR title
prineycom Nov 9, 2026
51d39f8
Take every Pi flow time from date
prineycom Nov 9, 2026
9de7b99
Resume the Pi flow inside Ship after a merged key or a removed worktree
prineycom Nov 9, 2026
297e561
List the release-started line among the Pi flow resume lines
prineycom Nov 9, 2026
c699342
Resume the Pi flow after the epic acceptance at the PR step
prineycom Nov 9, 2026
54deeed
Treat a reviewer answer without outsidePlan as none in the Pi flow te…
prineycom Nov 9, 2026
17771c5
List the epic acceptance line among the Pi flow resume lines
prineycom Nov 10, 2026
b27892a
Merge MP-118: /flow в Pi, часть 2: от согласованного плана до мержа и…
prineycom Nov 10, 2026
3079b52
Add the Pi /epic command that runs the epic skill
prineycom Nov 10, 2026
1c359d3
Add the Pi-only epic skill
prineycom Nov 10, 2026
b646dba
Document the Pi /epic in the pipeline
prineycom Nov 10, 2026
f52aef4
Name the Pi /epic command in the integration and testing docs
prineycom Nov 10, 2026
3b0c31f
Add the Pi /epic to the changelog
prineycom Nov 10, 2026
5f20b38
Merge MP-119: /epic в Pi
prineycom Nov 10, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions .pi/extensions/mypi-lib/ask.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
export interface AskParams { question: string; options: string[] }

export interface AskContext {
hasUI: boolean;
ui: {
select(title: string, options: string[], opts?: { signal?: AbortSignal }): Promise<string | undefined>;
input(title: string, placeholder?: string, opts?: { signal?: AbortSignal }): Promise<string | undefined>;
};
}

type AskDetails = { answer: string; custom: boolean } | { answer: null; cancelled: true } | { answer: null; error: 'no-ui' };

export interface AskTool {
name: string;
label: string;
description: string;
parameters: Record<string, unknown>;
executionMode: 'sequential';
execute(toolCallId: string, params: AskParams, signal: AbortSignal, onUpdate: unknown, ctx: AskContext):
Promise<{ content: { type: 'text'; text: string }[]; details: AskDetails; isError?: boolean }>;
}

const OWN_WORD = 'Своё слово';

export function registerAsk(pi: { registerTool(tool: AskTool): void }): void {
pi.registerTool({
name: 'mypi_ask',
label: 'mypi ask',
description: 'Ask the engineer one question and wait for the answer. options: 2–4 short labels, the recommended one first; the tool marks it «(рекомендую)» and adds «Своё слово» for a typed answer. Put the facts and one line of reasoning per option into question. Returns {"answer","custom"}; {"answer":null,"cancelled":true} when the engineer cancels — then stop; record no answer to it.',
parameters: {
type: 'object',
properties: {
question: { type: 'string', description: 'The question with its facts and the reasoning per option' },
options: { type: 'array', items: { type: 'string' }, minItems: 2, maxItems: 4, description: 'Option labels, the recommended one first' },
},
required: ['question', 'options'],
additionalProperties: false,
},
executionMode: 'sequential',
async execute(_toolCallId, params, signal, _onUpdate, ctx) {
if (!ctx.hasUI) return { content: [{ type: 'text', text: 'Error: mypi_ask needs the interactive Pi UI; nothing was asked.' }],
details: { answer: null, error: 'no-ui' }, isError: true };
const list = [params.options[0] + ' (рекомендую)', ...params.options.slice(1), OWN_WORD];
const done = (details: AskDetails) => ({ content: [{ type: 'text' as const, text: JSON.stringify(details) }], details });
const cancelled = done({ answer: null, cancelled: true });
const choice = await ctx.ui.select(params.question, list, { signal });
if (choice === undefined) return cancelled;
const index = list.indexOf(choice);
if (index === list.length - 1) {
const typed = (await ctx.ui.input(OWN_WORD + ':', undefined, { signal }))?.trim();
return typed ? done({ answer: typed, custom: true }) : cancelled;
}
return done({ answer: params.options[index]!, custom: false });
},
});
}
16 changes: 16 additions & 0 deletions .pi/extensions/mypi-lib/install.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { chmodSync, existsSync, mkdirSync, rmSync, statSync, unlinkSync } from 'node:fs';
import { join } from 'node:path';
import { registerAsk } from './ask.js';
import type { AskTool } from './ask.js';
import { completionSource, openCompletions, scopeCodes } from './open-completions.js';
import type { CompletionItem, OpenCatalog } from './open-completions.js';

Expand Down Expand Up @@ -31,6 +33,7 @@ export interface ExtensionAPI {
on(name: 'agent_end', handler: (event: { messages: { role: string; content?: unknown }[] }) => void): void;
on(name: 'agent_settled', handler: (event: unknown, ctx: ExtensionContext) => Promise<void>): void;
on(name: 'ui_prompt_start', handler: (event: { kind: string; title?: string }) => Promise<void>): void;
registerTool(tool: AskTool): void;
}

export type RunCli = (args: string[], options: { cwd: string; signal: AbortSignal; onLine: (line: string) => void }) =>
Expand Down Expand Up @@ -262,4 +265,17 @@ export function install(pi: ExtensionAPI, root: string, serve: ServeEvents, runt
pi.sendUserMessage(('/skill:inbox ' + args.trim()).trim(), { expandPromptTemplates: true });
},
});
pi.registerCommand('flow', {
description: 'Run tasks of one project in Pi from the plan to the merge and the release: /flow <name> <KEY> [<KEY>…], or /flow <name> to resume',
handler: async args => {
pi.sendUserMessage(('/skill:flow ' + args.trim()).trim(), { expandPromptTemplates: true });
},
});
pi.registerCommand('epic', {
description: 'Lead an epic in Pi from research to its subtasks: /epic <KEY>',
handler: async args => {
pi.sendUserMessage(('/skill:epic ' + args.trim()).trim(), { expandPromptTemplates: true });
},
});
registerAsk(pi);
}
6 changes: 6 additions & 0 deletions .pi/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"subagents": {
"defaultExtensions": [],
"agentScanDirs": ["integrations/pi-flow", "home/pi-flow"]
}
}
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ from existing transcripts. MEMORY.md is no longer read; move facts into INDEX.md
- Journal in the warmup (MP-91): a project warmup ends its tail with «Журнал» — the number of journal entries of the project and all its tasks with the local date of the newest one («Записей в журнале проекта нет.» when none) — and a task warmup with the task's last five entries in the journal line format (date, time, type, text up to 300 characters, artifacts; «Записей в журнале задачи нет.» when none); both name the `journal` call with `limit` 20 and its CLI form. Over the budget a task warmup drops the shown entries from the oldest before clipping knowledge entries, and after the knowledge entries clips the end of its card with a pointer to `context_read`, so a long card no longer pushes the Claude hook past 10,000 characters; the project line, the task heading with its count and the loader are never cut. The counts come from one SQL statement of the journal store (`stats`, `last`), not from a scope-resolving read, so the Claude hook stays fast.
- Organization scope and chat (MP-78): the bare organization slug (`tb-ff`) is a session key. `/open tb-ff` (MCP `open_session`, CLI `mypi open`) opens, focuses or resumes the organization chat in the Herdr tab `org-tb-ff` of the workspace `tb-ff`, in the engine root, with no clone or worktree; `global`, `all`, an unknown organization and an organization without registered projects are refused. The organization chat leads the tasks of all registered projects of its organization: it opens their task chats and sends them parent messages directly. Its warmup (role `org`) carries the global and organization knowledge entries, one line per project and the events addressed to it; its start message lists each project's open tasks by status. Pi completes `/open` with the organization's projects and their open tasks; the pipeline skills accept the organization scope (`mp-task scope` adds `org` and `codes`).
- Skill `/epic` and role `plan-challenger` (MP-107: MP-109): `/epic <KEY>` reads the epic's step from its status and folder (`docs/PIPELINE.md`, «Epics») and leads research, one review round, publication, an independent check by the read-only role `plan-challenger`, one question per finding with its decision row, version 2 and the subtasks created with `--parent`; the answer «Завести и запустить /flow» runs `/flow <name> <KEY>`. Claude Code only, through `.claude/skills/epic` and `.claude/agents`.
- Pi pipeline roles and templates (MP-116, epic MP-68): `integrations/pi-flow/` holds the roles `scout`, `planner`, `executor`, `reviewer`, `tester`, `investigator` and `challenger`, each with its answer schema in `outputSchema`, and the workflow templates `standard.js` (implement, review, fix through `resume`, at most two review rounds), `parallel.js` and `investigate.js` (read-only fan-out). The tracked `.pi/settings.json` makes pi-subagents scan `integrations/pi-flow` and `home/pi-flow` (own roles and templates) and start children without ambient extensions; in Pi sessions in the engine root `scout` and `reviewer` shadow the pi-subagents builtins of those names. `docs/agents/agent-integration.md` describes the role and template formats, own roles in `home/pi-flow/` and the personal model tiers. The roles are run by hand with `subagent` until the Pi `/flow` arrives; `.claude/agents` is unchanged.
- Pi `/flow`, part 1 (MP-117, epic MP-68): the Pi-only skill `integrations/skills/flow/SKILL.md`, run by the extension command `/flow`, takes the tasks of one project from the typed command to an agreed plan — session scope, subtasks, order, flow branch and score, parallel reconnaissance by `scout` through `investigate.js`, the plan by `planner` with its «Execution» section, publication on derive and the question «Согласовать / Правки»; `/flow <name>` resumes from the flow score after a restart. Every question goes through the new extension tool `mypi_ask` (2–4 options, the recommended one first, «Своё слово»; Escape cancels: the run stops, records no answer to that question and only commits the answers already written). Execution after the agreed plan is part 2 (MP-118); Claude's `/flow` is unchanged.
- Pi `/flow`, part 2 (MP-118, epic MP-68): after «Согласовать» each key runs by its plan's «Execution» — the base check, the task worktree, the workflow template through `subagent` in the background while the next plan is agreed, `do-report.json` and `review-report.json` (rounds with their range, findings with their resolution, checked by one line), fixes by resuming the executor, the project's checks by the lead (three attempts), the `--no-ff` merge into the flow branch and the self-test by `tester` by the project's stand document `<project home>/stand.md`; then the checks of the assembled branch, the epic acceptance, the PR and CI, the stand handed to the engineer and the question «Одобрить / Замечания / Стоп». «Замечания» sends the keys they touch back to the plan rework and executes them again; «Одобрить» merges the PR by the `/ship` procedure and runs the project's `release` procedure (none — merge only); the statuses end at `merged`. The reviewer role gains `outsidePlan` (`standard.js` and `parallel.js` stop before a fix and the lead asks once per key), each review round carries its `range`, `tester` can leave a stand up for the engineer (`handover`), and plans gain a release line in «Execution». Claude's `/flow` and `/ship` are unchanged.
- Pi `/epic` (MP-119, epic MP-68): the Pi-only skill `integrations/skills/epic/SKILL.md`, run by the extension command `/epic`, leads an epic through steps 1–5 of «Epics» — the research by the `executor` role in research mode (only `research.md` in the epic's folder), one `reviewer` round on the document, version 1 on derive, the independent check by `challenger`, one `mypi_ask` per finding with its row in the decision table, version 2 by resuming the same executor (a fresh one when it is not retained), the «Подзадачи» question and the subtasks created with `--parent`; the answer «Завести и запустить /flow» hands the run to the Pi `/flow` skill in the same chat. Claude's `/epic` is unchanged.

### Changed

Expand All @@ -33,6 +37,7 @@ from existing transcripts. MEMORY.md is no longer read; move facts into INDEX.md
- Event routing (MP-78): a task has two parents, its project chat and its organization chat. `turn_end` and `waiting` go to the sender of the parent message that started the turn (`mypi event emit --to`), else to the project; a milestone goes to the parent that last sent the task a message, else to the project, unless that recipient makes the change. Refusals of a non-parent sender name both parents.
- Sessions tree (MP-78): `mypi sessions` (MCP `sessions`) shows global → org → project → task.
- Schema 14 (MP-78): `sessions` gains the scope `org` and the column `org_id`; `mypi db init` is required. `mypi org remove` refuses while an organization session or an event with its slug exists.
- Pipeline texts (MP-116): `docs/PLAN-FORMAT.md` no longer names a `/review` command (a rework plan comes from `/plan`; Acceptance is walked at the manual check before `/ship`) and gains the «Execution» section, mandatory for plans the Pi `/flow` runs and absent from Claude plans; `docs/PIPELINE.md` says a pi-subagents child's `PI_SESSION_ID` is its own id, so its scope falls back to `MYPI_SCOPE`, then `global`.

### Removed

Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ any more: warmup serves `home/USER-INSTRUCTIONS.md`. Backups keep accepting the
| Personal agent instructions | `home/USER-INSTRUCTIONS.md` |
| Personal mypi settings (`defaultAgent`) | `home/settings.json` |
| Pi settings, MCP servers, packages, skills, extensions, prompts, themes | `~/.pi/agent/` |
| Own Pi pipeline roles and workflow templates | `home/pi-flow/` |
| Project knowledge | `home/projects/<org>/<project>/` |
| Project source code | `projects/<org>/<project>/`, its own Git |
| Task worktrees | `projects/<org>/<project>--<KEY>-<slug>/`, created by `mypi task worktree <KEY>` |
Expand Down Expand Up @@ -466,8 +467,10 @@ mypi/
├── test/ # fast and boundary
├── scripts/ # bounded build/checks
├── integrations/prompts/ # warmup role and how-to texts
├── integrations/skills/ # built-in skills: open, inbox, project-management, retro
├── integrations/skills/ # built-in skills: open, inbox, project-management, retro; flow (Pi only)
├── integrations/pi-flow/ # Pi pipeline roles (*.md) and workflow templates (*.js)
├── .pi/ # tracked Pi configuration
│ ├── settings.json # pi-subagents: no ambient extensions, role scan roots
│ ├── extensions/mypi.ts # MCP registration and warmup per session
│ └── skills -> ../integrations/skills
├── .claude/ # tracked Claude Code configuration
Expand Down
Loading
Loading