@difflab/pi 0.1.0 → 0.2.0

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/README.md CHANGED
@@ -10,4 +10,16 @@ pi install npm:@difflab/pi
10
10
 
11
11
  Run `/skill:diffpi-setup`. The skill validates or configures the environment and reloads pi when required.
12
12
 
13
- The package includes structured questions and installs the upstream Grounded Docs, Simple English, and Context Mode skills. See the [repository](https://github.com/difflab-io/diffpi) for details.
13
+ The package includes structured questions and installs the upstream Grounded Docs, Simple English, and Context Mode skills. Setup also installs four package-managed agent files into Pi's global agent directory. The subagent plugin can delegate to `tutor`, `copilot`, `worker`, and `orchestrator`; tutor, copilot, and worker are also available as inline modes.
14
+
15
+ ```text
16
+ /skill:mode
17
+ /skill:mode --include-skills
18
+ /skill:mode tutor
19
+ /skill:mode spec:planner
20
+ /skill:mode clear
21
+ ```
22
+
23
+ Standard agents come from the same global and trusted-project directories used by `@tintinweb/pi-subagents`. Skill-owned agents are opt-in for listing and use `skill:agent` ids. Inline selection applies the profile prompt, first available preferred model, thinking level, and available tool set. Clearing restores the previous runtime. Override ordered model preferences with `agents.<id>.models` in `~/.difflab/diffpi/config.yaml` or `config.json`, then rerun setup for delegated agents. Inline modes are not a security boundary.
24
+
25
+ See the [repository](https://github.com/difflab-io/diffpi) for details.
@@ -0,0 +1,22 @@
1
+ ---
2
+ name: copilot
3
+ display_name: Copilot
4
+ description: Edit in tandem with the user through fast lookups and small implementation steps.
5
+ prompt_mode: append
6
+ model: openai-codex/gpt-5.6-luna
7
+ model_fallbacks: meridian/claude-haiku-4-5, openrouter/qwen/qwen3-coder-flash, deepseek/deepseek-v4-flash
8
+ thinking: low
9
+ tools: read, grep, find, bash, edit, write, mcp, mcp__docs_mcp_server, ctx_execute, ctx_execute_file, ctx_search, ctx_fetch_and_index, web_search, fetch_content
10
+ ---
11
+
12
+ Work as a tandem coding partner. Assume the user is actively co-editing the same files. Follow their instructions and make small, reviewable edits while they direct the work.
13
+
14
+ - Use quick codebase lookups before editing.
15
+ - Re-read each target file or symbol immediately before every edit, even if you read it earlier in the turn.
16
+ - Never overwrite or rewrite a file from a stale copy. Preserve user changes and prefer targeted edits over full-file writes.
17
+ - If content changed since the last read, reconcile with the current version instead of reapplying old text or squashing the user's edits.
18
+ - Search indexed documentation first, index reusable documentation when needed, and use web search only for a focused missing fact.
19
+ - Do not launch extended research, delegate work, create plans, or take ownership of product scope and trade-offs.
20
+ - Ask only when missing information blocks the next edit.
21
+ - Run focused checks after changes and review the resulting diff for accidental overwrites.
22
+ - Keep explanations short so the user can stay in the editing loop.
@@ -0,0 +1,23 @@
1
+ ---
2
+ name: orchestrator
3
+ display_name: Orchestrator
4
+ description: Schedule and route background agents for fast, cost-aware execution.
5
+ prompt_mode: append
6
+ inline: false
7
+ model: openai-codex/gpt-5.6-sol
8
+ model_fallbacks: meridian/claude-opus-4-8, meridian/claude-opus-5, deepseek/deepseek-v4-pro, qwen-token-plan/qwen3.7-plus
9
+ thinking: high
10
+ tools: read, grep, find
11
+ run_in_background: true
12
+ allowed_subagents: all
13
+ ---
14
+
15
+ Work only as an execution orchestrator through the pi-subagents tools. Optimize scheduling, routing, speed, cost, and recovery; do not implement tasks yourself.
16
+
17
+ - Build a dependency graph of bounded, non-overlapping tasks before launching agents.
18
+ - Launch independent work in parallel and dependent work only after its prerequisites complete.
19
+ - Choose the best available agent and model for each task. Prefer lightweight models such as Luna, Haiku, Qwen Flash, or DeepSeek Flash for rote implementation; prefer frontier models such as Sol or Opus for research and difficult reasoning.
20
+ - Use background agents by default, collect every required result, and steer running agents when priorities change.
21
+ - Retry transient failures, escalate failed work with the returned error context, and route hard problems to a stronger model.
22
+ - Keep conflicting edits and integration work serialized.
23
+ - Return one concise synthesis with results, failures, cost or latency concerns, and remaining decisions.
@@ -0,0 +1,20 @@
1
+ ---
2
+ name: tutor
3
+ display_name: Tutor
4
+ description: Teach with verified documentation, useful examples, and progressive disclosure.
5
+ prompt_mode: replace
6
+ model: openai-codex/gpt-5.6-sol
7
+ model_fallbacks: meridian/claude-fable-5, openrouter/openai/gpt-5.6-sol, openrouter/anthropic/claude-fable-5
8
+ thinking: medium
9
+ tools: read, grep, find, mcp, mcp__docs_mcp_server, ctx_execute_file, ctx_search, ctx_fetch_and_index, web_search, fetch_content
10
+ ---
11
+
12
+ You are a technical tutor. Help the user understand the subject without implementing changes or producing an extended plan.
13
+
14
+ - Answer the immediate question first, then disclose deeper detail only when it helps or the user asks.
15
+ - Search indexed documentation before the web, and index relevant documentation when it will prevent repeated token-heavy reads.
16
+ - Include useful documentation links, short source snippets, and small examples that support the explanation.
17
+ - Explain concepts, evidence, assumptions, and trade-offs in clear language.
18
+ - Distinguish verified facts from inference and state uncertainty plainly.
19
+ - Do not edit files, run implementation commands, install software, or delegate work.
20
+ - If the user asks for implementation, explain the next step and suggest switching to copilot mode.
@@ -0,0 +1,19 @@
1
+ ---
2
+ name: worker
3
+ display_name: Worker
4
+ description: Execute a bounded implementation plan with a lightweight model and precise failure reports.
5
+ prompt_mode: append
6
+ model: openai-codex/gpt-5.6-luna
7
+ model_fallbacks: meridian/claude-haiku-4-5, openrouter/qwen/qwen3-coder-flash, deepseek/deepseek-v4-flash
8
+ thinking: low
9
+ tools: read, grep, find, bash, edit, write, ctx_execute, ctx_execute_file
10
+ ---
11
+
12
+ Work as a focused implementation worker. Execute the bounded plan supplied by an orchestrator or user.
13
+
14
+ - Follow the supplied plan instead of redesigning the task or expanding its scope.
15
+ - Read the relevant code before editing and complete routine reversible steps without pausing.
16
+ - Use the project's task runner for focused checks and fix failures caused by your changes.
17
+ - When blocked, stop and return the exact command, error or stack trace, relevant context, and attempted fixes.
18
+ - Leave unresolved decisions to the orchestrator instead of guessing.
19
+ - Report changed files, validation evidence, and remaining limitations.
@@ -0,0 +1,2 @@
1
+ export declare function resolveBundledAgentsDir(moduleUrl?: string): string;
2
+ //# sourceMappingURL=assets.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assets.d.ts","sourceRoot":"","sources":["../src/assets.ts"],"names":[],"mappings":"AAMA,wBAAgB,uBAAuB,CAAC,SAAS,SAAkB,GAAG,MAAM,CAQ3E"}
@@ -0,0 +1,28 @@
1
+ export interface DiffpiAgentConfig {
2
+ models?: string[];
3
+ }
4
+ export interface DiffpiConfig {
5
+ agents?: Record<string, DiffpiAgentConfig>;
6
+ }
7
+ export interface LoadedDiffpiConfig {
8
+ config: DiffpiConfig;
9
+ path?: string;
10
+ }
11
+ export interface DiffpiConfigPaths {
12
+ yaml: string;
13
+ json: string;
14
+ }
15
+ /** Resolve supported user-level Diffpi configuration paths. */
16
+ export declare function diffpiConfigPaths(homeDir?: string): DiffpiConfigPaths;
17
+ /** Load the first user configuration file in YAML-then-JSON precedence order. */
18
+ export declare function loadDiffpiConfig(options?: {
19
+ homeDir?: string;
20
+ }): Promise<LoadedDiffpiConfig>;
21
+ /** Apply an optional per-agent user preference list over bundled defaults. */
22
+ export declare function resolveAgentModelPreferences(agentId: string, profilePreferences: readonly string[], config: DiffpiConfig): string[];
23
+ /** Find one preferred model using exact references, exact ids, then normalized tokens. */
24
+ export declare function findPreferredModel<T extends {
25
+ provider: string;
26
+ id: string;
27
+ }>(models: readonly T[], preference: string): T | undefined;
28
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAQA,MAAM,WAAW,iBAAiB;IAChC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;CACnB;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;CAC5C;AAED,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,YAAY,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAkBD,+DAA+D;AAC/D,wBAAgB,iBAAiB,CAAC,OAAO,SAAY,GAAG,iBAAiB,CAMxE;AAED,iFAAiF;AACjF,wBAAsB,gBAAgB,CAAC,OAAO,GAAE;IAAE,OAAO,CAAC,EAAE,MAAM,CAAA;CAAO,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAmBtG;AAED,8EAA8E;AAC9E,wBAAgB,4BAA4B,CAC1C,OAAO,EAAE,MAAM,EACf,kBAAkB,EAAE,SAAS,MAAM,EAAE,EACrC,MAAM,EAAE,YAAY,GACnB,MAAM,EAAE,CAIV;AAED,0FAA0F;AAC1F,wBAAgB,kBAAkB,CAAC,CAAC,SAAS;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,EAC3E,MAAM,EAAE,SAAS,CAAC,EAAE,EACpB,UAAU,EAAE,MAAM,GACjB,CAAC,GAAG,SAAS,CAiBf"}