BIG pi update with claude chat

This commit is contained in:
Jonas H
2026-04-24 14:22:59 +02:00
parent fbb00a49ba
commit 248667468c
24 changed files with 4225 additions and 1112 deletions

View File

@@ -0,0 +1,110 @@
---
name: add-agent
description: "Add a new Claude agent definition to ~/.claude/agents/ and an accompanying skill to ~/.pi/agent/skills/. Use when creating new specialized agents."
---
# Add Agent
When the user wants to create a new specialized Claude agent:
## Agent File Convention
Create a `.md` file in `~/.claude/agents/` with this structure:
```markdown
---
name: agent_name
description: One-line description of what the agent does
tools: Read, Bash[, Edit, Write] # include only what's needed
model: sonnet | opus
---
You are an [role]. [1-2 sentence description of purpose].
Available tools:
- read: Read file contents
- bash: Execute bash commands
- edit: Make surgical edits to files # if applicable
- write: Create or overwrite files # if applicable
Guidelines:
- Use bash for file operations: prefer `rg` over grep, `fd` over find, glob patterns for batch file matching
- Use read to examine files [before editing] # adapt phrasing
- [Agent-specific guidelines]
- When summarizing your actions, output plain text directly - do NOT use cat or bash to display what you did
- Be concise in your responses
- Show file paths clearly when working with files
```
## Key Rules
1. **`name`** in frontmatter must match what skills reference as `agent: "name"`
2. **`tools`** — only include tools the agent actually needs. Read-only agents use `Read, Bash`
3. **`model`** — `sonnet` for execution/review, `opus` for strategic/advisory work
4. **Always include** the "output plain text directly" guideline — agents without it tend to use `cat`/`echo` instead of responding directly
5. **Bash guideline** should read: `prefer \`rg\` over grep, \`fd\` over find, glob patterns for batch file matching`
6. **Bash tool description** should be: `Execute bash commands`
## Skill File Convention
Create `~/.pi/agent/skills/<skill-name>/SKILL.md`:
```markdown
---
name: skill-name
description: "What triggers this skill. Use when [condition]."
---
# Skill Title
When [trigger condition]:
## What to include in the prompt
1. **[Section 1]** — description
2. **[Section 2]** — description
...
The `agent_name` agent has `Tool1` and `Tool2` tools only — [what it can/can't do].
## How to call
\```
ask_claude({
agent: "agent_name",
question: "Specific instruction for the agent.",
prompt: `
## Section 1
[Template]
## Section 2
[Template]
`
})
\```
## After the review
- [What to do with the agent's output]
- [How to summarize for the user]
- [When to loop back or escalate]
```
## Skill Key Rules
1. **Skill `name`** should be kebab-case (e.g., `claude-debug`, not `claude_debug`)
2. **Description** must be in quotes if it contains special characters
3. **`agent:` in `ask_claude()`** must match the agent's `name:` exactly
4. **Include a "What to include" section** — gives the calling agent a template
5. **Include a "How to call" section** — with a concrete `ask_claude()` example
6. **Include an "After the review" section** — what to do with the output
## Existing Agents (for reference)
| Agent | Model | Tools | Purpose |
|-------|-------|-------|---------|
| `minimal` | sonnet | Read, Bash, Edit, Write | General coding |
| `code_review` | sonnet | Read, Bash, Edit, Write | Review & fix code |
| `plan_review` | opus | Read, Bash | Review plans |
| `debug` | sonnet | Read, Bash | Trace bugs |
| `oracle` | opus | Read, Bash | Strategic guidance |

View File

@@ -0,0 +1,153 @@
---
name: ask-claude
description: "Invoke Claude (any agent or model) for an opinion, review, or analysis. Use when the user asks you to ask a specific Claude about something specific — e.g. trade-offs of an approach, a focused review, or a second opinion."
---
# Ask Claude
Use `ask_claude` to consult Claude with any combination of agent, model, question, and prompt.
## Parameters
| Parameter | Required | Description |
|-----------|----------|-------------|
| `prompt` | yes | The content for Claude to reason about (context, code, plan, bug report, etc.) |
| `question` | no | What specifically to ask — prepended as a focused review directive |
| `agent` | no | Agent name from `~/.claude/agents/`. See **Available agents** below. |
| `model` | no | Override the model: `"opus"`, `"sonnet"`, `"haiku"` |
| `session_id` | no | Resume a prior conversation (returned in every response) |
If neither `agent` nor `model` is set, defaults to Claude Sonnet.
> **Multi-turn:** Every response includes a `session_id`. Pass it back in a subsequent `ask_claude()` call to continue the same conversation with the same agent/model.
## Available agents
See `~/.claude/agents/` for the full list. Common agents:
| Agent | Model | Tools | Use when |
|-------|-------|-------|----------|
| `plan_review` | Opus | Read, Bash | Reviewing plans for correctness, completeness, feasibility, and risk |
| `code_review` | Sonnet | Read, Bash, Edit, Write | Reviewing implementations; can apply fixes directly |
| `debug` | Sonnet | Read, Bash | Tracing bugs and root causes; will NOT apply fixes |
| `oracle` | Opus | Read, Bash | Hard problems, architectural decisions, when you're stuck |
Pick the agent that matches the task. If unsure, ask the user which agent to use, or use a raw `model=` instead of an agent.
## Common patterns
### Plan review
```
ask_claude({
agent: "plan_review",
question: "Review for correctness, completeness, feasibility, and risk. Highlight missing steps or unclear requirements.",
prompt: `
## Project Context
[Key facts from CLAUDE.md]
## Codebase Exploration
[Modules/files you read]
## Implementation Plan
[Your full plan, step by step]
## Open Questions
[Anything uncertain]
`
})
```
### Code review (with fix capability)
```
ask_claude({
agent: "code_review",
question: "Review for bugs, architectural issues, style, and correctness. Apply fixes for any issues you find.",
prompt: `
## Project Conventions
[Relevant context not in CLAUDE.md]
## What Was Implemented
[Brief description]
## Plan That Was Followed
[The implementation plan]
## Files Changed
- path/to/file.ts — [what changed]
## Code to Review
[Paste key sections OR instruct the agent to read the files above]
`
})
```
### Debugging
```
ask_claude({
agent: "debug",
question: "Trace the root cause. Provide specific file paths, line numbers, and the exact code responsible. Suggest a fix but do not apply it.",
prompt: `
## The Issue
[What's happening vs. what should happen]
## Error Output
[Any logs, stack traces, or error messages]
## Relevant Files
- path/to/file.ts — [why it's relevant]
## What I've Already Tried
[Hypotheses tested, things ruled out]
`
})
```
### Oracle (hard problems)
```
ask_claude({
agent: "oracle",
question: "Analyze this problem and provide guidance. Explain your reasoning and recommend the best path forward.",
prompt: `
## The Problem
[What you're trying to solve and why it's hard]
## Codebase Context
[Relevant files, modules, and patterns explored]
## Options Considered
[Approaches evaluated and their trade-offs]
## What I Need Clarified
[Specific question or decision point]
`
})
```
### Free-form model question (no agent)
```
ask_claude({
model: "opus",
question: "What are the trade-offs of this approach vs using a message queue?",
prompt: `We're considering polling a database table every 5 seconds for new jobs instead of a queue...`
})
```
### Continuing a conversation
When Claude returns a `session_id` in its response, pass it back to continue the same conversation:
```
ask_claude({
agent: "code_review",
question: "Apply the fixes you identified.",
session_id: "<session_id from prior response>",
prompt: "Please proceed with the fixes."
})
```
## After the response
- Summarize Claude's key points for the user.
- If Claude raises blockers or important concerns, address them before proceeding.
- For plan reviews: if blockers or missing steps are flagged, update the plan and re-invoke if changes are significant.
- For code reviews: Claude (via `code_review`) may apply fixes directly — summarize what was changed.
- For debugging: apply the fix yourself or delegate to a coding agent.
- For oracle: proceed with the recommended approach, or loop back if more clarification is needed.

View File

@@ -0,0 +1,50 @@
---
name: implementor
description: "Delegate implementation of a fix or feature to the implementor agent. Use when you have a clear plan, bug fix, or feature to implement and want a focused agent to handle the full coding + build-verify cycle."
---
# Implementor
When you need to implement a fix, feature, or refactoring with full build verification:
## What to include in the prompt
1. **Goal** — what needs to be built or fixed, in 1-2 sentences
2. **Context** — relevant files, functions, or modules (include the actual code or file paths)
3. **Plan** — step-by-step description of the changes to make (if you have one)
4. **Constraints** — any project conventions, patterns to follow, or things to avoid
5. **Verification** — how to confirm the implementation is correct (build command, test names, etc.)
The `implementor` agent has `Read`, `Bash`, `Edit`, and `Write` tools only — it can read code, run commands, and make changes. It cannot use semantic search or web search.
## How to call
```
ask_claude({
agent: "implementor",
question: "Implement [brief description of the fix or feature].",
prompt: `
## Goal
[What needs to be done]
## Context
[Relevant files and code snippets]
## Plan
[Step-by-step changes, or "investigate and determine the best approach"]
## Constraints
[Project conventions, patterns to follow, things to avoid]
## Verification
[Build command, tests to run, how to confirm correctness]
`
})
```
## After the review
- Check whether the agent reported successful build/verification
- If it failed, either re-invoke with the error details or fix the remaining issues directly
- Summarize for the user: what files changed, what was verified, and any remaining concerns
- For complex implementations, consider running `diagnostics` sub-agent or relevant tests afterward as a second pass