ワンクリックで
package-pi-colgrep
Package-specific context for @gotgenes/pi-colgrep. Load when working on code, tests, or docs in packages/pi-colgrep/.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Package-specific context for @gotgenes/pi-colgrep. Load when working on code, tests, or docs in packages/pi-colgrep/.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Vitest mock patterns (vi.mock, vi.hoisted, vi.fn reset), TDD planning rules, and general test strategy. Load when writing or debugging tests.
Pre-completion protocol for implementation agents — gather context, dispatch the pre-completion-reviewer subagent, and handle its report before writing stage notes and recommending /ship-issue. Load at the end of /tdd-plan and /build-plan after all implementation steps are complete.
Package-specific context for @gotgenes/pi-permission-system. Load when working on code, tests, or docs in packages/pi-permission-system/.
TypeScript conventions, code design principles (SOLID, self-documenting code, file organization), structural design heuristics (dependency width, LoD, output arguments), pnpm rules, ES2024 target, Pi SDK patterns, and Biome/ESLint conflict workarounds. Load during implementation, refactoring, or code review.
Review a module's dependency and structural patterns for code smells. Use when adding a parameter to a shared interface, when a dependency bag grows past 5 fields, or when planning a refactoring that touches wiring between layers.
Heuristics and process for discovering structural improvements in a package. Load when planning a new improvement round — contains the smell taxonomy, analysis workflow, and prioritization framework distilled from 10 phases of pi-subagents refactoring.
| name | package-pi-colgrep |
| description | Package-specific context for @gotgenes/pi-colgrep. Load when working on code, tests, or docs in packages/pi-colgrep/. |
Pi extension that exposes the ColGrep semantic code-search CLI as an agent tool and keeps its index current across a session.
Read docs/architecture/architecture.md before making structural changes — it holds the module map, the index-management lifecycle, and the reindexer state machine.
Two cooperating concerns reach the CLI through one seam:
colgrep tool (tools/colgrep.ts → lib/search.ts → lib/args.ts + lib/format.ts).lib/availability.ts, lib/config.ts, lib/index-status.ts, lib/reindex.ts).src/
├── extension.ts # entry point: wires handlers + /colgrep-reindex, owns session state
├── tool-result.ts # ok() / err() AgentToolResult builders
├── tools/
│ └── colgrep.ts # registers the colgrep tool; executeColGrepSearch; rendering
└── lib/ # SDK-free business logic
├── exec.ts # Exec type — the single seam to process execution
├── availability.ts # AvailabilityState (cached colgrep --version)
├── config.ts # loadConfig (indexOnStartup), config path builders
├── index-status.ts # checkIndexExists + pure indexExistsFromStatus parser
├── reindex.ts # createReindexer: debounce, queue, coalesce, shutdown
├── search.ts # runSearch: build args, exec, format
├── args.ts # buildSearchArgs: SearchParams → CLI argv
└── format.ts # formatResults / formatHit: colgrep --json → text
src/lib/ must not import from @earendil-works/pi-coding-agent — only extension.ts and tools/colgrep.ts touch Pi types.
Library modules take an injected Exec (the sole seam to the CLI).colgrep binary must never block the agent.session_start fires reindexer.runNow() fire-and-forget.
Never re-add an await there.indexExists (probed once on session_start via colgrep status).
Do not proactively index a directory the operator never searches.colgrep init at a time. runNow() coalesces concurrent calls onto the in-flight promise; shutdown() awaits it.These bit us once — encode them, don't rediscover them:
colgrep search auto-indexes a missing/stale index on demand.
Lazy indexing is free; the extension never needs to force an index just so search works.colgrep status <path> exits 0 whether or not an index exists and has no --json.
Parse stdout: the literal No index found is the stable negative signal (indexExistsFromStatus).colgrep init -y . is the build/refresh command the reindexer runs.Extension-owned JSON config, project overriding global (mirrors pi-github-tools):
<agentDir>/extensions/pi-colgrep/config.json<cwd>/.pi/extensions/pi-colgrep/config.jsonindexOnStartup (boolean, default true): when false, no background startup index; the index is built lazily on first search or via /colgrep-reindex.
Missing file is silent; malformed file warns and defaults apply.
Exec in lib/ tests so every test runs offline — no real colgrep calls.reindex.ts (debounce/queue).
Never vi.runAllTimersAsync(); advance with a specific duration.TestPi stub and mock #src/lib/config via a vi.hoisted loadConfig stub to control indexOnStartup without touching the filesystem.init exec and checking the handler returns with the indexing status still set (not cleared); drain via session_shutdown before asserting the cleared status.