@poolzin/pool-bot 2026.2.20 → 2026.2.21

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.
@@ -0,0 +1,156 @@
1
+ ---
2
+ name: plcode-controller
3
+ description: "Control and operate PLCODE via CLI commands, slash commands, and multi-agent orchestration. Manage sessions, select models, delegate to agents (plan/code/review), and coordinate development workflows."
4
+ metadata: {"poolbot":{"emoji":"🎛️","requires":{"anyBins":["plcode"]}}}
5
+ ---
6
+
7
+ # PLCODE Controller
8
+
9
+ ## Core Rule
10
+
11
+ All planning, coding, and review happens inside PLCODE.
12
+ Use the appropriate agent for each phase of work.
13
+ Never skip the planning phase.
14
+
15
+ ## Pre-flight
16
+
17
+ - Confirm the user's working directory and project.
18
+ - Ask which AI provider/model to use if not already configured.
19
+ - Run `plcode doctor` to verify the environment is healthy.
20
+ - Do not proceed if critical issues are detected.
21
+
22
+ ## Session Management
23
+
24
+ - Check for existing sessions using:
25
+ ```
26
+ plcode session list
27
+ ```
28
+ - If the current project already has a session, reuse it.
29
+ - Never create a new session without user approval.
30
+ - Sessions are tied to project directories and preserve full context.
31
+
32
+ ## Agent Control
33
+
34
+ PLCODE uses multi-agent orchestration (AGNOS) with specialized agents. List available agents:
35
+
36
+ ```
37
+ plcode agents list
38
+ ```
39
+
40
+ Key agents for the standard workflow:
41
+
42
+ | Agent | Role |
43
+ | -------------- | -------------------------------------------- |
44
+ | planner_agent | Task analysis, step-by-step planning |
45
+ | code_agent | Code implementation and refactoring |
46
+ | review_agent | Code review with metrics, no subjective bias |
47
+ | test_agent | Test-driven development (RED-GREEN-REFACTOR) |
48
+ | critic_agent | Compare approaches and select best plan |
49
+ | executor_agent | Execute code in controlled sandbox |
50
+
51
+ Inspect any agent for details:
52
+
53
+ ```
54
+ plcode agents inspect <agent-name>
55
+ ```
56
+
57
+ ## Model Selection
58
+
59
+ - List available models:
60
+ ```
61
+ plcode models
62
+ ```
63
+ - For detailed provider info:
64
+ ```
65
+ plcode models --verbose
66
+ ```
67
+ - If authentication is needed:
68
+ ```
69
+ plcode auth
70
+ ```
71
+ - Wait for the user to confirm auth is complete before continuing.
72
+
73
+ ## Planning Phase
74
+
75
+ Use the `/plan` command to create structured execution plans:
76
+
77
+ ```
78
+ /plan <task description>
79
+ ```
80
+
81
+ The TaskPlanner will:
82
+
83
+ - Analyze task complexity (simple / moderate / complex).
84
+ - Assess risk level (low / medium / high).
85
+ - Generate step-by-step execution plan with agent assignments.
86
+ - Identify required MCP tools per step.
87
+
88
+ Review the plan carefully:
89
+
90
+ - If the plan is incorrect or incomplete, ask PLCODE to revise it.
91
+ - If complexity is high, consider breaking into smaller tasks.
92
+ - Do not proceed to implementation without an approved plan.
93
+
94
+ ## Implementation Phase
95
+
96
+ Once the plan is approved, execute it. Two modes are available:
97
+
98
+ - **one-shot**: Execute all steps sequentially in the current session.
99
+ - **background**: Execute steps in the background, freeing the session.
100
+
101
+ During implementation:
102
+
103
+ - The code_agent handles code changes.
104
+ - The test_agent runs tests as each step completes.
105
+ - If a step fails, PLCODE will attempt recovery or escalate.
106
+
107
+ ## Review Phase
108
+
109
+ After implementation, trigger a review:
110
+
111
+ ```
112
+ /review
113
+ ```
114
+
115
+ The review_agent evaluates:
116
+
117
+ - Code quality and adherence to standards.
118
+ - Test coverage and correctness.
119
+ - Security and performance implications.
120
+
121
+ If the review flags issues, return to the planning phase for that specific issue.
122
+
123
+ ## Question Handling
124
+
125
+ If PLCODE or any agent asks a clarification question during implementation:
126
+
127
+ - Pause implementation.
128
+ - Provide the answer or switch context to the planner_agent.
129
+ - Confirm the revised approach before resuming.
130
+ - Never ignore questions during implementation.
131
+
132
+ ## Completion
133
+
134
+ - Repeat the Plan -> Implement -> Review loop until all requirements are satisfied.
135
+ - Never skip the planning phase.
136
+ - Never bypass review for non-trivial changes.
137
+ - Use `plcode session list` to verify session state.
138
+
139
+ ## MCP Tools Available
140
+
141
+ PLCODE exposes 32+ MCP tools across 5 categories:
142
+
143
+ | Category | Tools | Examples |
144
+ | ------------- | ----- | ------------------------------------------------------------ |
145
+ | Observability | 7 | `get_service_health`, `get_bra_health`, `get_memory_metrics` |
146
+ | Git | 8 | `get_repo_structure`, `get_diff`, `open_pull_request` |
147
+ | LSP | 9 | `lsp_diagnostics`, `find_references`, `code_metrics` |
148
+ | Knowledge | 5 | `check_dependency_cves`, `analyze_dependencies` |
149
+ | Web | 3 | `web_search`, `web_fetch`, `web_extract` |
150
+
151
+ ## Output Format
152
+
153
+ - Show all CLI commands and slash commands explicitly.
154
+ - State which agent is active and what mode is selected.
155
+ - Provide auth links verbatim when they appear.
156
+ - Display plan summaries with complexity and risk assessments.
@@ -0,0 +1,65 @@
1
+ ### Ask for Provider
2
+
3
+ Which AI provider and model do you want to use?
4
+ Run `plcode models` to see what's available.
5
+
6
+ ### Ask for Auth
7
+
8
+ The selected provider requires authentication.
9
+ Run `plcode auth` to authenticate, then confirm when you're ready.
10
+
11
+ ### Environment Check
12
+
13
+ Let me verify your environment is ready.
14
+ Running `plcode doctor` to check for issues.
15
+
16
+ ### Plan Request
17
+
18
+ Analyze this task and create a structured execution plan.
19
+ Break it into clear steps, assign the right agent to each step, and identify which MCP tools are needed.
20
+ Flag any risks or questions before we start.
21
+
22
+ ### Plan Revision
23
+
24
+ The plan needs changes. Here's what to adjust:
25
+ [specify issues]
26
+ Please revise the plan and present the updated version.
27
+
28
+ ### Implementation Request
29
+
30
+ The plan is approved. Proceed with implementation using the assigned agents and tools.
31
+ Report progress after each step.
32
+
33
+ ### Review Request
34
+
35
+ Implementation is complete. Run a review to check:
36
+
37
+ - Code quality and standards compliance
38
+ - Test coverage and correctness
39
+ - Security and performance implications
40
+
41
+ ### Parallel Dispatch
42
+
43
+ This task has independent subtasks. Dispatching parallel agents:
44
+
45
+ - Agent A: [subtask 1]
46
+ - Agent B: [subtask 2]
47
+ - Agent C: [subtask 3]
48
+
49
+ Each agent works independently. I'll integrate results when all complete.
50
+
51
+ ### Session Reuse Check
52
+
53
+ I found an existing session for this project.
54
+ Do you want to continue from where we left off, or start fresh?
55
+
56
+ ### Failure Report
57
+
58
+ Step [N] failed during execution.
59
+ Error: [error details]
60
+ Options:
61
+
62
+ 1. Retry the step
63
+ 2. Skip and continue
64
+ 3. Abort the plan and re-plan
65
+ Which do you prefer?
@@ -0,0 +1,53 @@
1
+ ## PLCODE Command Cheatsheet
2
+
3
+ ### CLI Commands
4
+
5
+ | Command | Description |
6
+ | ------------------------------- | -------------------------------------------- |
7
+ | `plcode` | Start PLCODE (TUI mode) |
8
+ | `plcode run <prompt>` | Run a one-shot task |
9
+ | `plcode session list` | List all sessions |
10
+ | `plcode agents list` | List all available agents (PLCODE + AGNOS) |
11
+ | `plcode agents inspect <agent>` | Show agent details and capabilities |
12
+ | `plcode agents test [agent]` | Test agent connectivity |
13
+ | `plcode agents restart [agent]` | Restart an agent |
14
+ | `plcode models` | List available AI providers and models |
15
+ | `plcode models --verbose` | Detailed model info with capabilities |
16
+ | `plcode models --refresh` | Force refresh model list |
17
+ | `plcode auth` | Authenticate with an AI provider |
18
+ | `plcode doctor` | Check environment health |
19
+ | `plcode status` | Show current session and system status |
20
+ | `plcode logs` | View recent logs |
21
+ | `plcode tools` | List available MCP tools |
22
+ | `plcode bra` | BRA (Background Repository Agent) management |
23
+ | `plcode mcp` | MCP server management |
24
+ | `plcode stats` | Show usage statistics |
25
+ | `plcode debug` | Debug mode |
26
+ | `plcode export` | Export session data |
27
+ | `plcode import` | Import session data |
28
+ | `plcode upgrade` | Upgrade PLCODE |
29
+ | `plcode acp` | Git add, commit, push in one command |
30
+
31
+ ### Slash Commands (Inside TUI)
32
+
33
+ | Command | Description |
34
+ | --------- | --------------------------------------------------- |
35
+ | `/plan` | Create a structured execution plan with TaskPlanner |
36
+ | `/review` | Trigger code review via review_agent |
37
+ | `/init` | Initialize project configuration |
38
+
39
+ ### Keyboard Shortcuts (TUI)
40
+
41
+ | Key | Action |
42
+ | -------- | ------------------------ |
43
+ | `Enter` | Send message |
44
+ | `Ctrl+C` | Cancel current operation |
45
+ | `Ctrl+D` | Exit PLCODE |
46
+
47
+ ### AGNOS Multi-Agent Commands
48
+
49
+ | Command | Description |
50
+ | --------------------------- | ---------------------------------------- |
51
+ | `plcode agnos` | AGNOS orchestration management |
52
+ | `plcode task <description>` | Dispatch a task to the appropriate agent |
53
+ | `plcode agent <name>` | Interact with a specific agent directly |
@@ -0,0 +1,60 @@
1
+ ## Common Failures and Responses
2
+
3
+ ### Authentication Fails
4
+
5
+ - Run `plcode auth` again
6
+ - Ask the user to verify their credentials or API key
7
+ - Do not proceed without confirmed authentication
8
+
9
+ ### Model Not Available
10
+
11
+ - Run `plcode models --refresh` to update the model list
12
+ - Inform the user which models are available
13
+ - Ask for an alternative provider or model
14
+
15
+ ### Plan Generation Fails
16
+
17
+ - Simplify the task description
18
+ - Break into smaller sub-tasks
19
+ - Check if required MCP tools are available with `plcode tools`
20
+
21
+ ### Agent Not Responding
22
+
23
+ - Check agent status: `plcode agents inspect <agent-name>`
24
+ - Restart the agent: `plcode agents restart <agent-name>`
25
+ - If persistent, check BRA health: use `get_bra_health` MCP tool
26
+
27
+ ### Circuit Breaker Tripped
28
+
29
+ - A circuit breaker trips after repeated failures on the same operation
30
+ - Wait for the cooldown period (automatic)
31
+ - Check which circuit tripped via `get_bra_health`
32
+ - The circuit will auto-reset; retry after the cooldown
33
+
34
+ ### Memory Pressure
35
+
36
+ - PLCODE monitors memory pressure at 4 levels: normal, warning, critical, emergency
37
+ - At warning (70%): automatic pruning of expired entries
38
+ - At critical (85%): aggressive cleanup + forced GC
39
+ - At emergency (95%): full data cleanup
40
+ - If operations slow down, check with `get_memory_metrics`
41
+
42
+ ### Session Issues
43
+
44
+ - If session state is corrupt, list sessions: `plcode session list`
45
+ - Start a new session only with user approval
46
+ - Export important session data first: `plcode export`
47
+
48
+ ### MCP Tool Errors
49
+
50
+ - Verify tool availability: `plcode tools`
51
+ - Check MCP server status: `plcode mcp`
52
+ - Some tools require specific permissions or connections
53
+ - Retry once before reporting failure to the user
54
+
55
+ ### Step Execution Fails During Plan
56
+
57
+ - The TaskPlanner will attempt automatic recovery
58
+ - If recovery fails, it escalates to the user
59
+ - Options: retry the step, skip the step, or abort the plan
60
+ - Never silently skip a failed step
@@ -0,0 +1,57 @@
1
+ ## Model Selection Procedure
2
+
3
+ ### List Available Models
4
+
5
+ ```
6
+ plcode models
7
+ ```
8
+
9
+ For detailed capabilities and pricing info:
10
+
11
+ ```
12
+ plcode models --verbose
13
+ ```
14
+
15
+ To force refresh the model list from providers:
16
+
17
+ ```
18
+ plcode models --refresh
19
+ ```
20
+
21
+ ### Select a Provider
22
+
23
+ - The user specifies which provider/model they want to use
24
+ - PLCODE supports multiple providers (Anthropic, OpenAI, etc.)
25
+ - Each provider may have different authentication requirements
26
+
27
+ ### Authentication
28
+
29
+ If the selected provider requires authentication:
30
+
31
+ ```
32
+ plcode auth
33
+ ```
34
+
35
+ - PLCODE will guide through the auth flow
36
+ - If a login URL is generated, copy it exactly and send it to the user
37
+ - Wait for the user to confirm authentication is complete
38
+ - Never assume authentication succeeded without confirmation
39
+
40
+ ### Switching Models Mid-Session
41
+
42
+ - Models can be changed during a session
43
+ - Run `plcode models` again to switch
44
+ - Existing session context is preserved across model changes
45
+
46
+ ### Model Selection for Agents
47
+
48
+ - Different agents may use different models
49
+ - The planner_agent benefits from high-reasoning models
50
+ - The code_agent works best with code-specialized models
51
+ - Model assignment per agent is configured in PLCODE settings
52
+
53
+ ### Troubleshooting
54
+
55
+ - If a model is listed but fails to respond, check auth status
56
+ - If no models appear, run `plcode models --refresh`
57
+ - If a provider is not listed, it may need to be configured first
@@ -0,0 +1,52 @@
1
+ ## Planning Phase
2
+
3
+ Uses the `/plan` command and TaskPlanner:
4
+
5
+ - Analyzes task complexity (simple / moderate / complex)
6
+ - Assesses risk level (low / medium / high)
7
+ - Generates step-by-step execution plan
8
+ - Assigns the right agent to each step
9
+ - Identifies required MCP tools per step
10
+ - No code is written during planning
11
+
12
+ Key agents in planning:
13
+
14
+ - **planner_agent**: Creates execution plans
15
+ - **critic_agent**: Compares approaches and selects the best plan
16
+
17
+ ## Implementation Phase
18
+
19
+ Executes the approved plan:
20
+
21
+ - **code_agent**: Writes and refactors code
22
+ - **test_agent**: Writes tests (TDD: RED-GREEN-REFACTOR)
23
+ - **executor_agent**: Runs code in sandbox
24
+ - Two execution modes:
25
+ - `one-shot`: Sequential execution in current session
26
+ - `background`: Background execution, frees the session
27
+
28
+ ## Review Phase
29
+
30
+ Uses the `/review` command:
31
+
32
+ - **review_agent**: Metrics-based code review (no subjective decisions)
33
+ - Checks code quality, test coverage, security, performance
34
+ - Flags issues for re-planning if needed
35
+
36
+ ## Phase Switching
37
+
38
+ | Transition | When |
39
+ | ------------------- | ----------------------------------------------------- |
40
+ | Plan -> Implement | Plan approved by user |
41
+ | Implement -> Plan | Question arises, step fails, or approach needs change |
42
+ | Implement -> Review | All implementation steps complete |
43
+ | Review -> Plan | Review flags issues that need re-planning |
44
+ | Review -> Done | All checks pass, no issues found |
45
+
46
+ ## Rules
47
+
48
+ - Always start with Plan for non-trivial tasks
49
+ - Never write code during the planning phase
50
+ - Never skip review for changes touching multiple files
51
+ - If implementation raises questions, pause and return to Plan
52
+ - The plan must include agent assignments and MCP tool requirements
@@ -0,0 +1,40 @@
1
+ ## Handling Questions During Execution
2
+
3
+ ### From Agents During Implementation
4
+
5
+ If any agent asks a clarification question during implementation:
6
+
7
+ 1. Pause the current execution step immediately
8
+ 2. Present the question to the user clearly
9
+ 3. Wait for the user's answer
10
+ 4. Feed the answer back to the planner_agent if it affects the plan
11
+ 5. Revise the plan if needed
12
+ 6. Resume implementation only after the question is resolved
13
+
14
+ ### From the User
15
+
16
+ If the user asks a question mid-workflow:
17
+
18
+ 1. Pause current execution
19
+ 2. Answer using available context (session history, plan state, code state)
20
+ 3. If the question implies a change in direction, return to the planning phase
21
+ 4. If it's informational only, answer and resume
22
+
23
+ ### Escalation Pattern
24
+
25
+ PLCODE uses an escalation pattern for unresolved questions:
26
+
27
+ | Level | Handler | When |
28
+ | ----- | ------------- | ---------------------------------------------------- |
29
+ | 1 | Current agent | Agent can answer from its own context |
30
+ | 2 | planner_agent | Question affects the plan or approach |
31
+ | 3 | critic_agent | Multiple valid approaches, need to pick the best |
32
+ | 4 | User | Decision requires human judgment or domain knowledge |
33
+
34
+ ### Rules
35
+
36
+ - Never ignore a question and continue implementing
37
+ - Never make assumptions about ambiguous requirements
38
+ - If in doubt, escalate to the user rather than guessing
39
+ - Questions that affect the plan must go through the planner_agent
40
+ - Questions about code style or conventions can be handled by the code_agent
@@ -0,0 +1,63 @@
1
+ ## Session Rules
2
+
3
+ ### Core Principles
4
+
5
+ - PLCODE keeps a full history of sessions per project
6
+ - The same project must always reuse its existing session
7
+ - Reusing sessions preserves context, decisions, and plan history
8
+ - Starting a new session is allowed only if the user explicitly asks
9
+
10
+ ### Listing Sessions
11
+
12
+ ```
13
+ plcode session list
14
+ ```
15
+
16
+ Output includes:
17
+
18
+ - Session ID
19
+ - Project directory
20
+ - Creation timestamp
21
+ - Last activity
22
+ - Parent session (if any)
23
+
24
+ ### Session Reuse
25
+
26
+ - When starting work on a project, always check for existing sessions first
27
+ - If a session exists for the current project directory, use it
28
+ - Session context includes: conversation history, plan state, agent state, MCP tool state
29
+
30
+ ### Creating New Sessions
31
+
32
+ - Only create a new session when:
33
+ - No session exists for the project
34
+ - The user explicitly requests a fresh start
35
+ - The existing session is corrupt or unrecoverable
36
+ - Before creating a new session, consider exporting the old one:
37
+ ```
38
+ plcode export
39
+ ```
40
+
41
+ ### Session Data
42
+
43
+ Sessions store:
44
+
45
+ - Full conversation history
46
+ - Active and completed plans
47
+ - Agent delegation history
48
+ - MCP tool invocations and results
49
+ - Model/provider selections
50
+
51
+ ### Importing and Exporting
52
+
53
+ - Export session: `plcode export`
54
+ - Import session: `plcode import`
55
+ - Useful for backup, migration, or sharing context between machines
56
+
57
+ ### Parent Sessions
58
+
59
+ - Sessions can have parent sessions, forming a hierarchy
60
+ - Child sessions inherit context from their parent
61
+ - Useful for branching exploration without losing the main thread
62
+
63
+ If unsure whether to reuse or create, always ask the user.
@@ -0,0 +1,35 @@
1
+ ## Standard Workflow
2
+
3
+ 1. Verify environment health with `plcode doctor`
4
+ 2. Confirm AI provider and model with the user
5
+ 3. Authenticate if needed using `plcode auth`
6
+ 4. Reuse existing project session via `plcode session list`
7
+ 5. Use `/plan <task>` to create a structured execution plan
8
+ 6. Review the plan: check complexity, risk, agent assignments
9
+ 7. Approve or revise the plan
10
+ 8. Execute the plan (one-shot or background mode)
11
+ 9. Handle interruptions: if questions arise, pause and clarify before resuming
12
+ 10. Run `/review` to evaluate implemented changes
13
+ 11. If review flags issues, return to step 5 for the specific issue
14
+ 12. Repeat until all user requirements are satisfied
15
+
16
+ ## Delegation Workflow (Complex Tasks)
17
+
18
+ For tasks involving multiple independent subsystems:
19
+
20
+ 1. Use `/plan` to break the task into subtasks
21
+ 2. Identify independent subtasks that can run in parallel
22
+ 3. Dispatch parallel agents using the Task tool (one agent per domain)
23
+ 4. Review each agent's output when complete
24
+ 5. Verify changes don't conflict
25
+ 6. Run full test suite
26
+ 7. Integrate all changes
27
+
28
+ ## Quick Fix Workflow (Simple Tasks)
29
+
30
+ For trivial changes that don't need full orchestration:
31
+
32
+ 1. Describe the change directly
33
+ 2. code_agent implements it
34
+ 3. Verify with a targeted test run
35
+ 4. Done -- no formal plan/review needed for single-line fixes