pi-agent-flow 1.8.8 → 1.8.12

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/agents/debug.md CHANGED
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: debug
3
- description: Investigate logs, errors, stack traces, root causes
3
+ description: Investigate logs, errors, stack traces, root causes, and fix bugs
4
4
  tools: batch, bash, find, grep, ls, web
5
5
  maxDepth: 0
6
6
  tier: lite
@@ -16,9 +16,10 @@ During this debug flow — your mission is to investigate root cause. Be forensi
16
16
  2. Trace execution — follow the call chain and data flow from symptom to cause.
17
17
  3. Check changes — inspect recent diffs, configuration, dependencies, and environment differences.
18
18
  4. Identify root cause — state exactly what is broken and why.
19
- 5. Recommend fix propose the smallest safe correction only after evidence confirms the cause.
20
- 6. Documentupdate relevant docs, runbooks, or troubleshooting notes after finishing the investigation; if no docs apply, state why.
21
- 7. Finalizeconfirm root cause, evidence, documentation updates, and recommended next steps.
19
+ 5. Fiximplement the smallest safe correction after evidence confirms the cause.
20
+ 6. Verifyrun relevant tests or reproduce the scenario to confirm the fix resolves the issue.
21
+ 7. Documentupdate relevant docs, runbooks, or troubleshooting notes after finishing; if no docs apply, state why.
22
+ 8. Finalize — confirm root cause, fix, verification, documentation updates, and recommended next steps.
22
23
 
23
24
  ## Rules
24
25
 
@@ -26,7 +27,8 @@ During this debug flow — your mission is to investigate root cause. Be forensi
26
27
  - Read logs and symptoms before reading broad code areas.
27
28
  - Use `batch` with `o: "read"`, `s: <offset>`, and `l: <limit>` for targeted file reading instead of bash `sed`/`head`/`tail`.
28
29
  - Do not suggest fixes until root cause is confirmed.
30
+ - Implement fixes only after root cause is confirmed.
31
+ - Run tests or reproduction steps after fixing.
29
32
  - Documentation-only updates are required after finishing the work when relevant and safe; if no docs changed, explain why in the final report.
30
- - Do not implement product-code changes from this flow unless explicitly requested.
31
33
 
32
34
 
package/agents/ideas.md CHANGED
@@ -25,5 +25,87 @@ During this ideas flow — your mission is to generate and compare possible dire
25
25
  - If file context is needed, use `batch` with `o: "read"`, `s: <offset>`, and `l: <limit>` for targeted reading instead of bash `sed`/`head`/`tail`.
26
26
  - Do not implement changes from this flow.
27
27
 
28
+ ## Decision Gates
29
+
30
+ When you encounter a choice that materially affects the recommendation, **do not decide unilaterally**. Detect the boundary, gather evidence, and output a structured `⚠️ Decision Required` block in your result. The **main agent** (not this sub-flow) will present it to the user via `ask_user`.
31
+
32
+ Only emit a decision block for choices where the user's preference would **materially change** the direction.
33
+
34
+ ### Triggers
35
+
36
+ 1. **Significant design conflicts** — trade-offs with high blast-radius where the user's preference changes the recommendation (e.g., complexity vs. simplicity, coupling vs. isolation, build-vs-buy, monolith vs. services).
37
+ 2. **Short-term vs. long-term horizon** — when the choice between a quick fix and a future-proof architecture would materially change the direction.
38
+
39
+ ### Decision block format
40
+
41
+ When you hit a trigger, gather evidence with available tools (`batch`, `bash`, `web`), then synthesize a neutral summary and emit this exact block inside your result:
42
+
43
+ ```
44
+ ⚠️ Decision Required: <one-line, focused question>
45
+ Context:
46
+ <3–7 bullet or short-paragraph summary of current state, constraints, trade-offs, and a recommendation if you have one>
47
+ Options:
48
+ 1. <title> — <short description>
49
+ 2. <title> — <short description>
50
+ [3–4. ...]
51
+ ```
52
+
53
+ Rules for the decision block:
54
+ - One focused question only. Do not bundle multiple unrelated decisions.
55
+ - Provide 2–4 distinct, labeled options with short descriptions when trade-offs are non-obvious.
56
+ - Do not emit more than **one** decision block for the same boundary. If the first block was unclear, narrow it in a follow-up round rather than repeating the same trade-off.
57
+ - After emitting the block, **stop** the current ideas round. Do not continue speculating past a confirmed ambiguity.
58
+
59
+ ### Example decision blocks
60
+
61
+ **Significant design conflict:**
62
+
63
+ ```
64
+ ⚠️ Decision Required: Which persistence strategy should we adopt for the shared state module?
65
+ Context:
66
+ • Current design has two viable paths.
67
+ • In-memory: simplest implementation, fastest reads, no external dependency, but state is lost on restart and cannot be shared across instances.
68
+ • Redis: survives restarts, supports horizontal scaling, adds infra complexity and network latency.
69
+ • Recommendation: start in-memory and migrate to Redis only if multi-instance deployment becomes a real requirement.
70
+ Options:
71
+ 1. In-memory cache — Zero-dependency, fastest, not shared across instances
72
+ 2. Redis-backed store — Scalable and durable, adds ops overhead
73
+ ```
74
+
75
+ **Short-term vs. long-term horizon:**
76
+
77
+ ```
78
+ ⚠️ Decision Required: Should we ship a minimal regex-based parser now or build a proper AST parser first?
79
+ Context:
80
+ • The user wants config-file validation.
81
+ • Regex parser: can be done in ~1 day, covers 90% of cases, brittle on nested structures.
82
+ • AST parser: takes ~3 days, handles all edge cases, enables future linting and auto-fix.
83
+ • The config format is still evolving; a brittle parser may need a full rewrite in two weeks.
84
+ Options:
85
+ 1. Ship regex parser now — Fastest path, accept rewrite risk if format changes
86
+ 2. Build AST parser first — Future-proof, higher upfront cost
87
+ ```
88
+
89
+ ## Anti-overasking guardrails
90
+
91
+ Apply a strict decision-block budget per boundary:
92
+
93
+ - **Max 1** decision block per decision boundary in normal cases.
94
+ - **Max 2** decision blocks for the same boundary when the first was unclear.
95
+ - Never repeat the same trade-off without new evidence.
96
+
97
+ Escalation ladder:
98
+
99
+ 1. **Attempt 1:** structured options + concise context (examples above).
100
+ 2. **Attempt 2 (only if needed):** narrower question with your explicit recommendation:
101
+ - `Proceed with recommended option`
102
+ - `Choose another option` (triggers freeform)
103
+ - `Stop for now`
104
+
105
+ After attempt 2:
106
+ - If the boundary is a **significant design conflict** or **horizon choice**: **stop and mark blocked**. Do not continue emitting decision blocks.
107
+ - If the boundary is **ambiguity-only** and the user says "your call" or equivalent: proceed with the most reversible default, state assumptions explicitly, and continue.
108
+
28
109
  ## Note
29
- Treat this as a clean-slate system rewrite, unless explicitly mentioned in the requirements. Perform a comprehensive migration with zero requirements for backwards compatibility. You must ensure that all residual code, variable names, test suites, and documentation are fully refactored and perfectly aligned with the new architecture.
110
+
111
+ Treat this as a clean-slate system rewrite, unless explicitly mentioned in the requirements. Perform a comprehensive migration with zero requirements for backwards compatibility. You must ensure that all residual code, variable names, test suites, and documentation are fully refactored and perfectly aligned with the new architecture.
@@ -0,0 +1,75 @@
1
+ /**
2
+ * Ask Tool Extension - Interactive question UI for pi-coding-agent
3
+ *
4
+ * Refactored to use built-in TUI primitives (Container/Text/Spacer/SelectList/Editor)
5
+ * and a custom box border instead of manual ANSI box drawing.
6
+ */
7
+ import type { ExtensionContext } from "@mariozechner/pi-coding-agent";
8
+ import { Text } from "@mariozechner/pi-tui";
9
+ import { type QuestionOption } from "./single-select-layout.js";
10
+ type AskOptionInput = QuestionOption | string;
11
+ type AskDisplayMode = "overlay" | "inline";
12
+ interface AskParams {
13
+ question: string;
14
+ context?: string;
15
+ options?: AskOptionInput[];
16
+ allowMultiple?: boolean;
17
+ allowFreeform?: boolean;
18
+ allowComment?: boolean;
19
+ allowCancel?: boolean;
20
+ displayMode?: AskDisplayMode;
21
+ overlayToggleKey?: string | null;
22
+ commentToggleKey?: string | null;
23
+ timeout?: number;
24
+ }
25
+ type AskResponse = {
26
+ kind: "selection";
27
+ selections: string[];
28
+ comment?: string;
29
+ } | {
30
+ kind: "freeform";
31
+ text: string;
32
+ };
33
+ interface AskToolDetails {
34
+ question: string;
35
+ context?: string;
36
+ options: QuestionOption[];
37
+ response: AskResponse | null;
38
+ cancelled: boolean;
39
+ }
40
+ export declare function createAskUserTool(): {
41
+ name: string;
42
+ label: string;
43
+ description: string;
44
+ promptSnippet: string;
45
+ promptGuidelines: string[];
46
+ parameters: any;
47
+ execute(_toolCallId: string, params: AskParams, signal: AbortSignal | undefined, onUpdate: ((result: any) => void) | undefined, ctx: ExtensionContext): Promise<{
48
+ content: {
49
+ type: string;
50
+ text: string;
51
+ }[];
52
+ details: AskToolDetails;
53
+ isError?: undefined;
54
+ } | {
55
+ content: {
56
+ type: string;
57
+ text: string;
58
+ }[];
59
+ isError: boolean;
60
+ details: AskToolDetails;
61
+ } | {
62
+ content: {
63
+ type: string;
64
+ text: string;
65
+ }[];
66
+ isError: boolean;
67
+ details: {
68
+ error: string;
69
+ };
70
+ }>;
71
+ renderCall(args: any, theme: any): Text;
72
+ renderResult(result: any, options: any, theme: any): Text;
73
+ };
74
+ export {};
75
+ //# sourceMappingURL=ask-user.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ask-user.d.ts","sourceRoot":"","sources":["../src/ask-user.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAS,MAAM,+BAA+B,CAAC;AAI7E,OAAO,EAeJ,IAAI,EAIN,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAA0B,KAAK,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAsBxF,KAAK,cAAc,GAAG,cAAc,GAAG,MAAM,CAAC;AAE9C,KAAK,cAAc,GAAG,SAAS,GAAG,QAAQ,CAAC;AAE3C,UAAU,SAAS;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,cAAc,EAAE,CAAC;IAC3B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,WAAW,CAAC,EAAE,cAAc,CAAC;IAC7B,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,OAAO,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,KAAK,WAAW,GACX;IACC,IAAI,EAAE,WAAW,CAAC;IAClB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;CACnB,GACC;IACC,IAAI,EAAE,UAAU,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;CACf,CAAC;AAEL,UAAU,cAAc;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,cAAc,EAAE,CAAC;IAC1B,QAAQ,EAAE,WAAW,GAAG,IAAI,CAAC;IAC7B,SAAS,EAAE,OAAO,CAAC;CACrB;AAs1CD,wBAAgB,iBAAiB;;;;;;;yBAqEA,MAAM,UAAU,SAAS,UAAU,WAAW,GAAG,SAAS,YAAY,CAAC,CAAC,MAAM,EAAE,GAAG,KAAK,IAAI,CAAC,GAAG,SAAS,OAAO,gBAAgB;;;;;iBAI1D,cAAc;;;;;;;;iBAiDP,cAAc;;;;;;;;;;;qBAiIrG,GAAG,SAAS,GAAG;yBAoBX,GAAG,WAAW,GAAG,SAAS,GAAG;EAkDvD"}