{ "name": "reflect", "description": "Mine Pi usage through adaptive parallel scans, develop three ideas, and have an adversarial judge select one terse proposal.", "args": { "hint": "[focus]", "params": ["focus"] }, "schemas": { "PartitionPlan": { "type": "object", "properties": { "focus": { "type": "string", "maxLength": 1200 }, "coverage": { "type": "array", "maxItems": 12, "items": { "type": "string", "maxLength": 1200 } }, "uncovered_scope": { "type": "array", "maxItems": 12, "items": { "type": "string", "maxLength": 1200 } }, "tasks": { "type": "array", "minItems": 1, "maxItems": 24, "items": { "type": "object", "properties": { "id": { "type": "string", "maxLength": 96, "pattern": "^[A-Za-z0-9_-]+$" }, "source": { "type": "string", "enum": ["sessions", "config", "extensions"] }, "label": { "type": "string", "maxLength": 240 }, "scope": { "type": "string", "maxLength": 1200 }, "locators": { "type": "array", "minItems": 1, "maxItems": 24, "items": { "type": "string", "maxLength": 1200 } }, "instructions": { "type": "array", "minItems": 1, "maxItems": 12, "items": { "type": "string", "maxLength": 1200 } }, "exclusions": { "type": "array", "maxItems": 12, "items": { "type": "string", "maxLength": 1200 } } }, "required": [ "id", "source", "label", "scope", "locators", "instructions", "exclusions" ] } } }, "required": ["focus", "coverage", "uncovered_scope", "tasks"] }, "ScanResult": { "type": "object", "properties": { "task_id": { "type": "string", "maxLength": 96 }, "source": { "type": "string", "enum": ["sessions", "config", "extensions"] }, "label": { "type": "string", "maxLength": 240 }, "inspected": { "type": "array", "maxItems": 16, "items": { "type": "string", "maxLength": 1200 } }, "observations": { "type": "array", "maxItems": 4, "items": { "type": "object", "properties": { "id": { "type": "string", "maxLength": 120, "pattern": "^[A-Za-z0-9_-]+$" }, "finding": { "type": "string", "maxLength": 1600 }, "evidence": { "type": "string", "maxLength": 2400 }, "locator": { "type": "string", "maxLength": 1600 } }, "required": ["id", "finding", "evidence", "locator"] } }, "counterevidence": { "type": "array", "maxItems": 6, "items": { "type": "string", "maxLength": 1600 } }, "gaps": { "type": "array", "maxItems": 8, "items": { "type": "string", "maxLength": 1600 } } }, "required": [ "task_id", "source", "label", "inspected", "observations", "counterevidence", "gaps" ] }, "Candidate": { "type": "object", "properties": { "source": { "type": "string", "maxLength": 120 }, "name": { "type": "string", "maxLength": 240 }, "idea": { "type": "string", "maxLength": 2000 }, "change": { "type": "string", "maxLength": 3200 }, "suggested_destination": { "type": "string", "maxLength": 1200 }, "impact": { "type": "string", "maxLength": 2400 }, "current_state": { "type": "string", "maxLength": 2400 }, "expected_state": { "type": "string", "maxLength": 2400 }, "evidence": { "type": "array", "minItems": 1, "maxItems": 10, "items": { "type": "object", "properties": { "claim": { "type": "string", "maxLength": 1600 }, "detail": { "type": "string", "maxLength": 2400 }, "locator": { "type": "string", "maxLength": 1600 }, "source": { "type": "string", "maxLength": 120 }, "newly_inspected": { "type": "boolean" } }, "required": [ "claim", "detail", "locator", "source", "newly_inspected" ] } }, "existing_asset_comparison": { "type": "array", "maxItems": 8, "items": { "type": "object", "properties": { "path": { "type": "string", "maxLength": 1200 }, "relation": { "type": "string", "maxLength": 1600 } }, "required": ["path", "relation"] } }, "counterevidence": { "type": "array", "maxItems": 8, "items": { "type": "string", "maxLength": 1600 } }, "gaps": { "type": "array", "maxItems": 12, "items": { "type": "string", "maxLength": 1600 } } }, "required": [ "source", "name", "idea", "change", "suggested_destination", "impact", "current_state", "expected_state", "evidence", "existing_asset_comparison", "counterevidence", "gaps" ] }, "FinalReport": { "type": "object", "properties": { "choice": { "type": "string", "minLength": 1, "maxLength": 1200 }, "report": { "type": "string", "minLength": 1, "maxLength": 8000 } }, "required": ["choice", "report"] } }, "phases": [ { "id": "partition", "kind": "single", "step": { "summary": "partition reflection evidence sources", "prompt": "partition evidence collection for this reflection focus: {args.focus}. an empty focus means overall pi usage.\n\n- inspect source metadata and sizes, not substantive evidence\n- read and follow applicable agent instructions\n- read and follow the pi-sessions skill when inspecting session metadata\n- cover pi sessions; non-secret global and project pi agent config; and existing extensions from active global, project, and configured package roots\n- discover active roots from pi settings and package manifests rather than crawling home\n- never read auth files, decrypted secrets, secret-bearing files, or raw session files\n- split work along natural boundaries so tasks have roughly comparable evidence volume\n- use one config task unless observed size requires more\n- split extensions by active root or large subtree\n- split sessions by bounded date or discovered-session groups\n- allocate task count according to observed volume, with no more than 24 total tasks\n- make every task self-contained with exact locators, instructions, and exclusions\n- record omitted or sampled scope explicitly\n- use only read-only inspection and do not invoke nested agents\n\nreturn PartitionPlan.", "tools": ["read", "grep", "ls", "bash"], "model": "small", "schema": "PartitionPlan" } }, { "id": "scan", "kind": "fanout", "over": "{partition.results[].tasks[]}", "concurrency": 12, "step": { "summary": "scan evidence partition {item}", "prompt": "scan this assigned evidence partition: {item}. reflection focus: {args.focus}.\n\n- inspect only the assigned scope and exact locators\n- follow every supplied instruction and exclusion\n- read and follow applicable agent instructions\n- for sessions, read and follow pi-sessions without inventing another inspection method\n- collect concrete evidence of repeated friction, manual rituals, missed checks, duplication, or relevant existing capability\n- distinguish direct observations from interpretation\n- cite session evidence by session id plus entry id or source line, and cite file evidence by exact path and relevant locator\n- count independent occurrences, not copied summaries, retained transcript material, abandoned branches, or repeated discussion of one incident\n- return no more than four strongest observations\n- include counterevidence, blockers, sampling limits, and uncovered scope\n- do not propose solutions\n- do not expose protected data, modify anything, use network access, or invoke nested agents\n\nreturn ScanResult and echo the task id, source, and label exactly.", "tools": ["read", "grep", "ls", "bash"], "model": "tiny", "schema": "ScanResult" } }, { "id": "analyze", "kind": "fanout", "over": "{scan.results | groupBy source}", "concurrency": 3, "step": { "summary": "develop one source-owned improvement idea from {item}", "prompt": "develop exactly one high-impact pi workflow improvement from this source group: {item}. reflection focus: {args.focus}. partition failures: {partition.failures}. scanner failures: {scan.failures}.\n\n- treat the group key as the assigned source and its items as the complete scanner evidence packet\n- keep primary investigation within the assigned source\n- inspect additional detail when it can change the idea\n- inspect relevant existing assets outside the source only to test overlap, feasibility, or destination\n- follow applicable agent instructions and the pi-sessions skill for any added session inspection\n- prefer improving or merging an existing asset over creating another asset\n- select one concrete idea for this source, even when evidence is imperfect\n- include every fact used to support the idea in the returned evidence array\n- mark evidence gathered during this analysis as newly inspected\n- give exact session or file locators for all evidence, including newly inspected evidence\n- compare the idea with relevant existing assets at exact paths\n- include material counterevidence, relevant failed scans, sampling limits, and uncertainty in gaps\n- describe current and expected states plainly so another agent can draw them\n- never rely on tool history or hidden context because the final judge receives only this returned candidate\n- never invent evidence, expose protected data, modify anything, use network access, or invoke nested agents\n\nreturn Candidate. echo the source group key exactly in source and give the idea a short distinctive name.", "tools": ["read", "grep", "ls", "bash"], "model": "medium", "schema": "Candidate" } }, { "id": "devil", "kind": "single", "step": { "summary": "adversarially select one reflection proposal", "prompt": "act as adversarial final judge for these source-owned candidate ideas: {analyze.results}. analyzer failures: {analyze.failures}. reflection focus: {args.focus}.\n\n- challenge recurrence, causality, impact, novelty, scope, maintenance cost, and evidence quality\n- compare the independently sourced ideas and detect duplicated, already-solved, overly broad, or weakly supported proposals\n- pick the strongest available idea and improve its proposal\n- name every supplied idea exactly once in a short ideas list\n- mark the picked idea with ✓ followed by two spaces\n- mark each rejected idea with ✗ followed by two spaces and one short reason\n- never invent evidence or claim independent verification\n- keep the whole report terse and human-readable, not a structured field dump\n- begin with one line shaped as an icon, two spaces, a concise action, scope, kind, and @path\n- choose the icon, action, scope, kind, and path language that best fits the proposal; do not use a fixed taxonomy\n- use that same opening action line without its icon as the terse choice value\n- follow the report opening with one sentence describing the proposal\n- use tasteful icons with two spaces of padding for compact section labels\n- give at most three short why bullets, five evidence bullets, and three caveat bullets\n- include minimal current and expected mermaid diagrams\n- do not include a status, acceptance check, process recap, raw candidate dump, or rigid key-value layout\n- output markdown only inside the report field\n\nreturn FinalReport with choice and report.", "model": "huge", "schema": "FinalReport" } } ], "return": "{devil.results[].choice}", "report": "{devil.results[].report}" }