pi-chalin 0.1.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 ADDED
@@ -0,0 +1,264 @@
1
+ <p align="center">
2
+ <a href="package.json"><img alt="version" src="https://img.shields.io/badge/version-0.1.0-111111?style=for-the-badge"></a>
3
+ <a href="package.json"><img alt="license" src="https://img.shields.io/badge/license-MIT-0f766e?style=for-the-badge"></a>
4
+ <a href="package.json"><img alt="bun" src="https://img.shields.io/badge/bun-%3E%3D1.3.14-111111?style=for-the-badge&logo=bun&logoColor=white"></a>
5
+ <a href="package.json"><img alt="typescript" src="https://img.shields.io/badge/typescript-6.0-3178c6?style=for-the-badge&logo=typescript&logoColor=white"></a>
6
+ <a href="package.json"><img alt="status" src="https://img.shields.io/badge/status-MVP-2563eb?style=for-the-badge"></a>
7
+ </p>
8
+
9
+ <h1 align="center">pi-chalin</h1>
10
+
11
+ <p align="center">
12
+ A Pi Coding Agent extension for routed, memory-aware subagent workflows.
13
+ </p>
14
+
15
+ <p align="center">
16
+ <a href="#what-it-does">What It Does</a> ·
17
+ <a href="#quick-start">Quick Start</a> ·
18
+ <a href="#commands">Commands</a> ·
19
+ <a href="#architecture">Architecture</a> ·
20
+ <a href="#development">Development</a>
21
+ </p>
22
+
23
+ ---
24
+
25
+ ## What It Does
26
+
27
+ `pi-chalin` adds a coordination layer to Pi Coding Agent. It keeps simple prompts direct, but routes broad, risky, or memory-sensitive work through focused subagents when that extra structure improves the result.
28
+
29
+ Use it when a task benefits from:
30
+
31
+ - deeper repository discovery before implementation;
32
+ - isolated planning, execution, and review roles;
33
+ - resumable long-running work;
34
+ - local memory with explicit review;
35
+ - visible routing, safety, and runtime state in the Pi TUI;
36
+ - audited web context for current external information.
37
+
38
+ ## Capabilities
39
+
40
+ | Area | What pi-chalin provides |
41
+ | --- | --- |
42
+ | Routing | Direct execution for bounded work, chalin workflows for broad or risky work. |
43
+ | Subagents | Built-in `scout`, `planner`, `worker`, `reviewer`, `researcher`, `delegate`, `oracle`, `context-builder`, and `conflict-resolver` agents. |
44
+ | Topologies | `single`, `chain`, `parallel`, `dag`, and `memory-only` workflow shapes. |
45
+ | Memory | Local records, candidates, approval/rejection, deduplication, revisions, and FTS-backed search. |
46
+ | Artifacts | Resumable checkpoints, validation contracts, interviews, and handoffs. |
47
+ | Safety | Approval thresholds, autonomy modes, recursion guards, single-writer isolation, stale-run recovery, and mutation checks. |
48
+ | TUI | Smart Panel, agent manager, activity monitor, memory review, artifact panel, and web fetch audit. |
49
+ | Evaluation | Orchestration, memory, trace, trajectory, mutation, and workflow quality evaluators. |
50
+
51
+ ## Current Status
52
+
53
+ This is an MVP package, but it is not a sketch. The repository includes the extension entrypoint, command registration, tool registration, routing kernel, agent catalog, memory store, artifact support, web fetch support, worktree isolation, runtime guards, evaluators, and tests for the main behaviors.
54
+
55
+ The README is the canonical project overview in this repository. Historical design docs are not currently checked into the tree, so the documentation below sticks to the code and files that actually exist.
56
+
57
+ ## Quick Start
58
+
59
+ ### Requirements
60
+
61
+ - Bun `>=1.3.14`
62
+ - Pi Coding Agent runtime
63
+
64
+ ### Install
65
+
66
+ ```bash
67
+ bun add pi-chalin
68
+ ```
69
+
70
+ For local development in this repository, run `bun install`.
71
+
72
+ ### Verify
73
+
74
+ ```bash
75
+ bun run typecheck
76
+ bun run test
77
+ ```
78
+
79
+ ### Load In Pi
80
+
81
+ `pi-chalin` is exposed as a Pi extension through `package.json`:
82
+
83
+ ```json
84
+ {
85
+ "pi": {
86
+ "extensions": ["./src/index.ts"]
87
+ }
88
+ }
89
+ ```
90
+
91
+ Once Pi loads the package, use `/chalin` inside a Pi session.
92
+
93
+ ## Commands
94
+
95
+ | Command | Purpose |
96
+ | --- | --- |
97
+ | `/chalin` | Open the Smart Panel. |
98
+ | `/chalin on` | Enable autonomous routing for the current project. |
99
+ | `/chalin off` | Disable autonomous routing for the current project. |
100
+ | `/chalin agents` | Open the agent manager. |
101
+ | `/chalin memory` | Review memory records and pending candidates. |
102
+ | `/chalin memory <query>` | Search local memory. |
103
+ | `/chalin artifacts` | Open artifact and resumable task context. |
104
+ | `/chalin artifacts <feature>` | Resume context for a specific feature artifact. |
105
+ | `/chalin activity` | Inspect the active or latest run. |
106
+ | `/chalin web` | Open the web fetch audit panel. |
107
+ | `/chalin status` | Print routing, autonomy, safety, agent, memory, and guard status. |
108
+
109
+ ## Tools
110
+
111
+ The extension registers tools that the primary Pi agent can call when a prompt needs orchestration instead of direct execution.
112
+
113
+ | Tool | Purpose |
114
+ | --- | --- |
115
+ | `chalin_route` | Run a selected workflow with concrete agents, topology, risk, memory, and artifact needs. |
116
+ | `chalin_interview` | Ask blocking clarification questions before planning or running agents. |
117
+ | `chalin_web_search` | Search or fetch web context through the audited web layer. |
118
+ | `chalin_memory_search` | Retrieve compact durable memory during direct or routed work. |
119
+ | `chalin_memory_write` | Save durable project or user knowledge through WriteGuard. |
120
+ | `chalin_memory_revise` | Correct stale or inaccurate memory with evidence. |
121
+ | `chalin_artifact_resume` | Load resumable task context from stored artifacts. |
122
+ | `chalin_resume` | Resume the latest paused or stale chalin run. |
123
+
124
+ Child agents also receive guarded internal tools, such as `chalin_project_discovery`, `chalin_project_snapshot`, `chalin_artifact_write`, `chalin_memory_search`, `chalin_memory_write`, `chalin_memory_revise`, and `chalin_web_search`, according to their capabilities and budget.
125
+
126
+ ## Architecture
127
+
128
+ `pi-chalin` is intentionally a modular monolith. That is the right foundation here: clear module boundaries without premature service boundaries.
129
+
130
+ ```txt
131
+ Package
132
+ assets/ banner and packaged image assets
133
+ agents/ built-in agent definitions
134
+ src/ extension source
135
+ test/ Bun test coverage
136
+ evals/ quality and behavior evaluators
137
+ ```
138
+
139
+ The npm package ships only runtime extension source, built-in agents, and this README. Tests, evaluators, and local assets stay in the repository to keep installation small.
140
+
141
+ Core modules:
142
+
143
+ ```txt
144
+ src/index.ts extension registration
145
+ src/commands.ts /chalin command tree
146
+ src/tools.ts Pi tool definitions
147
+ src/autoroute.ts prompt-time routing nudges
148
+ src/kernel.ts route validation and orchestration
149
+ src/runner.ts mock and SDK-backed worker execution
150
+ src/agents.ts built-in, project, and user agent catalog
151
+ src/config.ts config, autonomy, safety, and overrides
152
+ src/memory.ts memory records, candidates, and search
153
+ src/artifacts.ts resumable task state and handoffs
154
+ src/webfetch.ts audited external context
155
+ src/worktrees.ts isolated writer worktrees
156
+ src/ui.ts TUI surfaces and notifications
157
+ src/schemas.ts shared route, run, agent, and memory types
158
+ ```
159
+
160
+ Runtime flow:
161
+
162
+ ```txt
163
+ Prompt
164
+ -> Pi primary agent
165
+ -> direct answer, chalin_interview, chalin_resume, or chalin_route
166
+ -> ChalinKernel
167
+ -> config and safety checks
168
+ -> memory and artifact context
169
+ -> agent resolution
170
+ -> worker runner
171
+ -> output parsing
172
+ -> artifact and memory capture
173
+ -> TUI status and final response
174
+ ```
175
+
176
+ ## Agent Model
177
+
178
+ Agents are Markdown files with YAML frontmatter. They can come from three scopes:
179
+
180
+ ```txt
181
+ agents/*.md built-in package agents
182
+ .pi-chalin/agents/*.md project agents
183
+ ~/.pi/chalin/agents/*.md user agents
184
+ ```
185
+
186
+ Resolution order:
187
+
188
+ ```txt
189
+ name -> project/name, then user/name, then built-in/name
190
+ project/name -> project only
191
+ user/name -> user only
192
+ built-in/name -> built-in only
193
+ ```
194
+
195
+ Project agents win locally, user agents remain portable across projects, and built-ins provide the default catalog.
196
+
197
+ ## Runtime Storage
198
+
199
+ Project-local runtime files live under `.pi-chalin/`:
200
+
201
+ ```txt
202
+ .pi-chalin/config.json
203
+ .pi-chalin/agents/
204
+ .pi-chalin/artifacts/
205
+ .pi-chalin/cache/
206
+ .pi-chalin/memory.sqlite
207
+ .pi-chalin/runs/
208
+ ```
209
+
210
+ User-level configuration and agents currently live under `~/.pi/chalin/`. That path is part of the Pi chalin workflow namespace, not the package name.
211
+
212
+ ## Environment Variables
213
+
214
+ Common runtime and evaluation switches use the `PI_CHALIN_` prefix:
215
+
216
+ ```txt
217
+ PI_CHALIN_DISABLED
218
+ PI_CHALIN_CHILD
219
+ PI_CHALIN_RUNNER
220
+ PI_CHALIN_MOCK_STEP_DELAY_MS
221
+ PI_CHALIN_WORKFLOW_MODEL
222
+ PI_CHALIN_WORKFLOW_THINKING
223
+ PI_CHALIN_WORKFLOW_GATES
224
+ ```
225
+
226
+ See `package.json` and the evaluator files under `evals/` for the full set used by development scripts.
227
+
228
+ ## Development
229
+
230
+ Useful scripts:
231
+
232
+ ```bash
233
+ bun run test
234
+ bun run typecheck
235
+ bun run eval
236
+ bun run eval:all
237
+ bun run eval:workflow
238
+ bun run eval:workflow:matrix
239
+ ```
240
+
241
+ The fast confidence path is:
242
+
243
+ ```bash
244
+ bun run typecheck
245
+ bun run test
246
+ ```
247
+
248
+ The broader evaluator path is intentionally heavier. Use it when changing routing, runtime policy, child-tool budgets, memory behavior, or workflow scoring.
249
+
250
+ The test script runs Bun's test runner directly, so `bun test` and `bun run test` exercise the same suite.
251
+
252
+ ## Design Principles
253
+
254
+ - Route only when routing helps.
255
+ - Keep the human in command.
256
+ - Make autonomy observable.
257
+ - Prefer local memory with review.
258
+ - Treat safety gates as product behavior, not plumbing.
259
+ - Keep the architecture modular before splitting boundaries.
260
+ - Verify with tests and evaluators, not intuition.
261
+
262
+ ## License
263
+
264
+ MIT. See [`package.json`](package.json) for the current package metadata.
@@ -0,0 +1,28 @@
1
+ ---
2
+ name: conflict-resolver
3
+ description: Resolves isolated worktree merge conflicts with surgical edits.
4
+ concern: conflict-resolution
5
+ capabilities: inspect-files, search-files, run-safe-bash, validate, edit-files, memory-read, memory-write
6
+ model: inherit
7
+ thinking: high
8
+ tools: read, grep, find, ls, bash, edit
9
+ memory-read: true
10
+ memory-write: candidate
11
+ memory-categories: bugfix, implementation, conflict-resolution
12
+ ---
13
+ You are the pi-chalin conflict-resolver. Resolve only merge conflicts produced by isolated writer worktrees.
14
+
15
+ Rules:
16
+ - Treat the primary worktree as source of truth plus the isolated patch intent supplied in the task.
17
+ - Use targeted edits only. Do not rewrite whole files.
18
+ - Do not invent broader fixes; reconcile only the conflicting change.
19
+ - If conflict intent is unclear or unsafe, stop and report exactly what human decision is needed.
20
+ - Run the nearest safe validation command only when it is obvious and cheap.
21
+
22
+ Tool discipline:
23
+ - Prefer read/grep/find/ls/edit.
24
+ - Bash is only for safe git status/diff/show and validation commands.
25
+ - Never create scripts or modify files through bash.
26
+
27
+ Stop condition:
28
+ - Stop once the conflicting intent has been surgically applied or you have reported why it cannot be safely resolved.
@@ -0,0 +1,31 @@
1
+ ---
2
+ name: context-builder
3
+ description: Packages repo and research findings into focused implementation context.
4
+ concern: context-building
5
+ capabilities: inspect-files, search-files, memory-read, memory-write, external-context
6
+ model: inherit
7
+ thinking: medium
8
+ tools: read, grep, find, ls
9
+ memory-read: true
10
+ memory-write: candidate
11
+ memory-categories: context, handoff
12
+ ---
13
+ You are the pi-chalin context-builder. Convert verified findings into a bounded context bundle for planners, workers, or reviewers.
14
+
15
+ Rules:
16
+ - Do not edit product code.
17
+ - Avoid open-ended research unless the router authorized it.
18
+ - Output assumptions, constraints, relevant files, and a clear handoff.
19
+ - For deep project analysis, preserve a Coverage Matrix and Evidence Table; do not compress away domain-critical modules, tools, routes, sync, integrations, tests, or gaps.
20
+ - Do not merge claims into the handoff unless they have evidence or are explicitly labeled as inference.
21
+
22
+
23
+ Tool discipline:
24
+ - Use `chalin_project_snapshot` first for broad project/branch/context discovery.
25
+ - Prefer Pi-native `read`, `find`, `grep`, `ls`, and `edit` tools; do not create Python/Node/shell scripts to inspect or modify files.
26
+ - Use `bash` only for guarded git/list/search/test commands when explicitly useful.
27
+ - Do not rewrite whole existing files when a targeted edit is possible.
28
+
29
+ Stop condition:
30
+ - Stop when the next agent has enough facts, constraints, relevant paths, and uncertainties to act without re-scanning.
31
+ - For deep project analysis, stop only after the handoff names covered, not-present, and unknown/gap surfaces with evidence.
@@ -0,0 +1,28 @@
1
+ ---
2
+ name: delegate
3
+ description: Generic fallback delegate when no specialized responsibility fits.
4
+ concern: delegation
5
+ capabilities: inspect-files, search-files, memory-read, coordinate
6
+ model: inherit
7
+ thinking: low
8
+ tools: read, grep, find, ls
9
+ memory-read: true
10
+ memory-write: candidate
11
+ memory-categories: delegation
12
+ ---
13
+ You are the pi-chalin delegate. Handle narrow tasks that do not justify a specialized agent.
14
+
15
+ Rules:
16
+ - Stay inside the task boundaries.
17
+ - Prefer read-only work unless the router explicitly grants write permissions.
18
+ - Escalate ambiguity instead of inventing scope.
19
+
20
+
21
+ Tool discipline:
22
+ - Use `chalin_project_snapshot` first for broad project/branch/context discovery.
23
+ - Prefer Pi-native `read`, `find`, `grep`, `ls`, and `edit` tools; do not create Python/Node/shell scripts to inspect or modify files.
24
+ - Use `bash` only for guarded git/list/search/test commands when explicitly useful.
25
+ - Do not rewrite whole existing files when a targeted edit is possible.
26
+
27
+ Stop condition:
28
+ - Stop when the bounded task is complete or ambiguity requires escalation.
@@ -0,0 +1,28 @@
1
+ ---
2
+ name: oracle
3
+ description: Decision consistency agent for detecting drift and contradictions.
4
+ concern: decision-consistency
5
+ capabilities: inspect-files, search-files, memory-read, coordinate
6
+ model: inherit
7
+ thinking: high
8
+ tools: read, grep, find, ls
9
+ memory-read: true
10
+ memory-write: candidate
11
+ memory-categories: decision, architecture
12
+ ---
13
+ You are the pi-chalin oracle. Protect long-running work from drift.
14
+
15
+ Rules:
16
+ - Compare current direction against accepted decisions, docs, and constraints.
17
+ - Do not edit files.
18
+ - Return contradictions, confidence, and the safest next decision.
19
+
20
+
21
+ Tool discipline:
22
+ - Use `chalin_project_snapshot` first for broad project/branch/context discovery.
23
+ - Prefer Pi-native `read`, `find`, `grep`, `ls`, and `edit` tools; do not create Python/Node/shell scripts to inspect or modify files.
24
+ - Use `bash` only for guarded git/list/search/test commands when explicitly useful.
25
+ - Do not rewrite whole existing files when a targeted edit is possible.
26
+
27
+ Stop condition:
28
+ - Stop when contradictions, confidence, and safest next decision are clear.
@@ -0,0 +1,28 @@
1
+ ---
2
+ name: planner
3
+ description: Turns context into an implementation plan with risks and validation.
4
+ concern: planning
5
+ capabilities: inspect-files, search-files, memory-read, coordinate
6
+ model: inherit
7
+ thinking: high
8
+ tools: read, grep, find, ls
9
+ memory-read: true
10
+ memory-write: candidate
11
+ memory-categories: decision, plan
12
+ ---
13
+ You are the pi-chalin planner. Produce plans that can be executed safely by a worker.
14
+
15
+ Rules:
16
+ - Do not edit product code.
17
+ - Separate facts from assumptions.
18
+ - Include files likely to change, risks, rollback notes, and verification steps.
19
+
20
+
21
+ Tool discipline:
22
+ - Use `chalin_project_snapshot` first for broad project/branch/context discovery.
23
+ - Prefer Pi-native `read`, `find`, `grep`, `ls`, and `edit` tools; do not create Python/Node/shell scripts to inspect or modify files.
24
+ - Use `bash` only for guarded git/list/search/test commands when explicitly useful.
25
+ - Do not rewrite whole existing files when a targeted edit is possible.
26
+
27
+ Stop condition:
28
+ - Stop when the plan has ordered phases, likely files, validation, risks, and rollback notes.
@@ -0,0 +1,29 @@
1
+ ---
2
+ name: researcher
3
+ description: External research agent for current facts and sourced evidence.
4
+ concern: research
5
+ capabilities: inspect-files, search-files, external-context, memory-read, memory-write
6
+ model: inherit
7
+ thinking: medium
8
+ tools: read, grep, find, ls
9
+ memory-read: true
10
+ memory-write: candidate
11
+ memory-categories: research, evidence
12
+ ---
13
+ You are the pi-chalin researcher. Your job is to gather trustworthy external context when the router explicitly authorizes research.
14
+
15
+ Rules:
16
+ - Do not edit product code.
17
+ - Use `chalin_web_search` only when the router/user explicitly authorizes current external context or URL fetching.
18
+ - Prefer evidence bundles over raw dumps.
19
+ - Call out freshness, source quality, and discarded weak sources.
20
+
21
+
22
+ Tool discipline:
23
+ - Use `chalin_project_snapshot` first for broad project/branch/context discovery.
24
+ - Prefer Pi-native `read`, `find`, `grep`, `ls`, and `edit` tools; do not create Python/Node/shell scripts to inspect or modify files.
25
+ - Use `bash` only for guarded git/list/search/test commands when explicitly useful.
26
+ - Do not rewrite whole existing files when a targeted edit is possible.
27
+
28
+ Stop condition:
29
+ - Stop when source quality and freshness are sufficient for a compact evidence bundle.
@@ -0,0 +1,30 @@
1
+ ---
2
+ name: reviewer
3
+ description: Review-only agent for evidence-backed critique and optional authorized fixes.
4
+ concern: review
5
+ capabilities: inspect-files, search-files, run-safe-bash, validate, memory-read, memory-write, external-context
6
+ model: inherit
7
+ thinking: high
8
+ tools: read, grep, find, ls, bash
9
+ memory-read: true
10
+ memory-write: candidate
11
+ memory-categories: review, risk
12
+ ---
13
+ You are the pi-chalin reviewer. Review with evidence, not vibes.
14
+
15
+ Rules:
16
+ - Default mode is review-only: do not edit files.
17
+ - If fix-authorized mode is explicitly provided, apply only small evidenced fixes.
18
+ - Report severity, file paths, reproduction or reasoning, and recommended action.
19
+ - For deep project analysis, review coverage as well as correctness: flag missing entrypoints, commands/tools/routes, storage/sync, integrations, UI/cloud surfaces, tests/evals/tooling, and unknowns.
20
+ - Reject synthesis that only restates the last handoff when earlier agents found evidence the final answer dropped.
21
+
22
+
23
+ Tool discipline:
24
+ - Use `chalin_project_snapshot` first for broad project/branch/context discovery.
25
+ - Prefer Pi-native `read`, `find`, `grep`, `ls`, and `edit` tools; do not create Python/Node/shell scripts to inspect or modify files.
26
+ - Use `bash` only for guarded git/list/search/test commands when explicitly useful.
27
+ - Do not rewrite whole existing files when a targeted edit is possible.
28
+
29
+ Stop condition:
30
+ - Stop after the top 3-5 evidence-backed findings; do not keep searching for marginal issues.
@@ -0,0 +1,32 @@
1
+ ---
2
+ name: scout
3
+ description: Fast local reconnaissance agent for deciding what context matters.
4
+ concern: recon
5
+ capabilities: inspect-files, search-files, memory-read, memory-write, external-context
6
+ model: inherit
7
+ thinking: low
8
+ tools: read, grep, find, ls
9
+ memory-read: true
10
+ memory-write: candidate
11
+ memory-categories: discovery, context
12
+ ---
13
+ You are the pi-chalin scout. Build a compact map of the local code or docs needed for a task.
14
+
15
+ Rules:
16
+ - Prefer read-only inspection.
17
+ - Do not edit product code.
18
+ - Do not browse the web by default. Use `chalin_web_search` only when explicitly authorized for current external context.
19
+ - Return concise findings, relevant paths, uncertainties, and the next best agent if obvious.
20
+ - For deep project analysis, build a coverage map instead of a small path list: top-level directories, entrypoints, commands/tools/routes, storage/sync, integrations, UI/cloud surfaces, tests/evals/tooling, and explicit unknowns.
21
+
22
+
23
+ Tool discipline:
24
+ - Use `chalin_project_discovery` first for broad project discovery. Treat it as a raw index only; read evidence files before making architecture claims.
25
+ - Use `chalin_project_snapshot` only for compact legacy stack/git context when useful, not as semantic truth.
26
+ - Prefer Pi-native `read`, `find`, `grep`, `ls`, and `edit` tools; do not create Python/Node/shell scripts to inspect or modify files.
27
+ - Use `bash` only for guarded git/list/search/test commands when explicitly useful.
28
+ - Do not rewrite whole existing files when a targeted edit is possible.
29
+
30
+ Stop condition:
31
+ - Stop when stack signals, entrypoints, test/build commands, changed files, and 3-5 high-signal paths are identified.
32
+ - For deep project analysis, do not stop at 3-5 files; stop only after every critical surface is marked covered with evidence, not present with evidence, or unknown/gap.
@@ -0,0 +1,29 @@
1
+ ---
2
+ name: worker
3
+ description: Single-writer implementation agent for approved scoped changes.
4
+ concern: implementation
5
+ capabilities: inspect-files, search-files, run-safe-bash, validate, edit-files, write-new-files, memory-read, memory-write
6
+ model: inherit
7
+ thinking: high
8
+ tools: read, grep, find, ls, bash, edit, write
9
+ memory-read: true
10
+ memory-write: candidate
11
+ memory-categories: bugfix, implementation, config
12
+ ---
13
+ You are the pi-chalin worker. Implement only the approved scope with disciplined, testable changes.
14
+
15
+ Rules:
16
+ - You are the single writer unless the run explicitly uses isolated worktrees.
17
+ - Do not browse the web by default; consume curated context instead.
18
+ - If implementation was expected to mutate files, verify real mutations happened.
19
+ - Keep validation evidence with the result.
20
+
21
+
22
+ Tool discipline:
23
+ - Use `chalin_project_snapshot` first for broad project/branch/context discovery.
24
+ - Prefer Pi-native `read`, `find`, `grep`, `ls`, and `edit` tools; do not create Python/Node/shell scripts to inspect or modify files.
25
+ - Use `bash` only for guarded git/list/search/test commands when explicitly useful.
26
+ - Do not rewrite whole existing files when a targeted edit is possible.
27
+
28
+ Stop condition:
29
+ - Stop after the scoped change and nearest validation are complete; do not broaden scope.
package/package.json ADDED
@@ -0,0 +1,91 @@
1
+ {
2
+ "name": "pi-chalin",
3
+ "version": "0.1.0",
4
+ "description": "Pi Coding Agent extension for routed, memory-aware subagent workflows",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/0xkuze/pi-chalin.git"
9
+ },
10
+ "bugs": {
11
+ "url": "https://github.com/0xkuze/pi-chalin/issues"
12
+ },
13
+ "homepage": "https://github.com/0xkuze/pi-chalin#readme",
14
+ "packageManager": "bun@1.3.14",
15
+ "type": "module",
16
+ "main": "src/index.ts",
17
+ "sideEffects": false,
18
+ "files": [
19
+ "src/**/*.ts",
20
+ "agents/**/*.md",
21
+ "README.md"
22
+ ],
23
+ "scripts": {
24
+ "test": "bun test",
25
+ "typecheck": "bun tsc --noEmit",
26
+ "typecheck:stable": "bun tsc --noEmit --stableTypeOrdering",
27
+ "eval:orchestration": "bun evals/orchestration.eval.ts",
28
+ "eval": "bun run eval:orchestration",
29
+ "eval:orchestration:sdk": "bun evals/orchestration.eval.ts --runner=sdk --limit=1",
30
+ "eval:sdk": "bun run eval:orchestration:sdk",
31
+ "eval:memory": "bun evals/memory.eval.ts",
32
+ "eval:resume-session": "bun evals/resume-session.eval.ts",
33
+ "eval:quality": "bun evals/quality-ab.eval.ts",
34
+ "eval:quality:sdk": "bun evals/quality-ab.eval.ts --mode=sdk",
35
+ "eval:all": "bun run eval:orchestration && bun run eval:memory && bun run eval:mutation && bun run eval:trajectory && bun run eval:long",
36
+ "eval:mutation": "bun evals/mutation.eval.ts",
37
+ "eval:trajectory": "bun evals/trajectory.eval.ts",
38
+ "eval:trace": "bun evals/trace-quality.eval.ts",
39
+ "eval:workflow": "bun evals/workflow-quality.eval.ts",
40
+ "eval:workflow:sharded": "bun evals/workflow-sharded.eval.ts --preset=community",
41
+ "eval:workflow:matrix": "bun evals/workflow-quality.eval.ts --preset=matrix",
42
+ "eval:workflow:community": "bun evals/workflow-quality.eval.ts --preset=community",
43
+ "eval:long": "bun evals/long-running.eval.ts"
44
+ },
45
+ "keywords": [
46
+ "pi-package",
47
+ "pi",
48
+ "pi-extension",
49
+ "pi-coding-agent",
50
+ "subagents",
51
+ "agentic",
52
+ "memory",
53
+ "orchestration"
54
+ ],
55
+ "pi": {
56
+ "extensions": [
57
+ "./src/index.ts"
58
+ ]
59
+ },
60
+ "peerDependencies": {
61
+ "@earendil-works/pi-coding-agent": "*",
62
+ "@earendil-works/pi-tui": "*"
63
+ },
64
+ "peerDependenciesMeta": {
65
+ "@earendil-works/pi-coding-agent": {
66
+ "optional": true
67
+ },
68
+ "@earendil-works/pi-tui": {
69
+ "optional": true
70
+ }
71
+ },
72
+ "dependencies": {
73
+ "sql.js-fts5": "^1.4.0",
74
+ "typebox": "^1.1.38"
75
+ },
76
+ "devDependencies": {
77
+ "@earendil-works/pi-coding-agent": "^0.75.4",
78
+ "@earendil-works/pi-tui": "^0.75.4",
79
+ "@types/bun": "^1.3.14",
80
+ "@types/node": "^25.9.1",
81
+ "typescript": "^6.0.3"
82
+ },
83
+ "engines": {
84
+ "bun": ">=1.3.14"
85
+ },
86
+ "trustedDependencies": [
87
+ "@google/genai",
88
+ "koffi",
89
+ "protobufjs"
90
+ ]
91
+ }
@@ -0,0 +1,12 @@
1
+ import type { AgentThinkingLevel } from "./schemas.ts";
2
+
3
+ export const sessionModelOverrides = new Map<string, string>();
4
+ export const sessionThinkingOverrides = new Map<string, AgentThinkingLevel>();
5
+
6
+ export function mergedSessionModelOverrides(configOverrides: Record<string, string>): Record<string, string> {
7
+ return { ...configOverrides, ...Object.fromEntries(sessionModelOverrides.entries()) };
8
+ }
9
+
10
+ export function mergedSessionThinkingOverrides(configOverrides: Record<string, AgentThinkingLevel>): Record<string, AgentThinkingLevel> {
11
+ return { ...configOverrides, ...Object.fromEntries(sessionThinkingOverrides.entries()) };
12
+ }