-
Notifications
You must be signed in to change notification settings - Fork 4
feat(agent): harden runtime agent design #82
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| version: 1 | ||
| agent: | ||
| extend: ./agent.yaml | ||
| name: "ask" | ||
| mode: primary | ||
| system_prompt_args: | ||
| ROLE_ADDITIONAL: | | ||
| You are in Ask mode: a read-only assistant for answering questions, explaining code, | ||
| and recommending next steps without modifying files. | ||
|
|
||
| Ask-mode rules: | ||
| - Do not edit files, write plans to disk, launch mutating tools, commit, stage, push, or run commands that modify the system. | ||
| - Use repository evidence before answering codebase, architecture, debugging, or configuration questions. | ||
| - Use direct reads for known files and exploration subagents or searches for broader questions. | ||
| - If the user asks for implementation, explain the likely approach and say they should switch to the default/code agent or explicitly ask you to proceed with changes. | ||
| - Keep answers concise and cite paths or commands when they are load-bearing. | ||
|
|
||
| Final response contract: | ||
| - Start with the direct answer. | ||
| - Include evidence bullets only when the answer depends on repository inspection. | ||
| - End with blockers only if missing context prevents a reliable answer. | ||
| when_to_use: | | ||
| Use as a primary read-only mode for answering questions and explaining code without changing the workspace. | ||
| allowed_tools: | ||
| - "pythinker_code.tools.agent:Agent" | ||
| - "pythinker_code.tools.agent:RunAgents" | ||
| - "pythinker_code.tools.skill:ReadSkill" | ||
| - "pythinker_code.tools.ask_user:AskUserQuestion" | ||
| - "pythinker_code.tools.file:ReadFile" | ||
| - "pythinker_code.tools.file:ReadMediaFile" | ||
| - "pythinker_code.tools.file:Glob" | ||
| - "pythinker_code.tools.file:Grep" | ||
| - "pythinker_code.tools.file:SmartSearch" | ||
| - "pythinker_code.tools.web:SearchWeb" | ||
| - "pythinker_code.tools.web:FetchURL" | ||
| exclude_tools: | ||
| - "pythinker_code.tools.todo:SetTodoList" | ||
| - "pythinker_code.tools.memory:Memory" | ||
| - "pythinker_code.tools.scratchpad:Scratchpad" | ||
| - "pythinker_code.tools.background:TaskInput" | ||
| - "pythinker_code.tools.background:TaskHandoff" | ||
| - "pythinker_code.tools.background:TaskStop" | ||
| - "pythinker_code.tools.file:WriteFile" | ||
| - "pythinker_code.tools.file:StrReplaceFile" | ||
| - "pythinker_code.tools.plan:ExitPlanMode" | ||
| - "pythinker_code.tools.plan.enter:EnterPlanMode" | ||
| subagents: | ||
| explore: | ||
| path: ./explore.yaml | ||
| description: "Fast codebase exploration with prompt-enforced read-only behavior." | ||
| plan: | ||
| path: ./plan.yaml | ||
| description: "Read-only implementation planning and architecture design." | ||
| review: | ||
| path: ./review.yaml | ||
| description: "Read-only code review with severity-scored findings." | ||
| debugger: | ||
| path: ./debugger.yaml | ||
| description: "Failure/log/stack-trace root-cause analysis with reproduction evidence." | ||
| judge: | ||
| path: ./judge.yaml | ||
| description: "Independent final quality gate for answers and reports." | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| version: 1 | ||
| agent: | ||
| extend: ./agent.yaml | ||
| name: "debug" | ||
| mode: primary | ||
| system_prompt_args: | ||
| ROLE_ADDITIONAL: | | ||
| You are in Debug mode: a systematic root-cause diagnostician. | ||
|
|
||
| Debug-mode protocol: | ||
| - Start by identifying 5-7 plausible causes, then narrow to the 1-2 most likely from evidence. | ||
| - Reproduce or inspect the failure before proposing a fix whenever a bounded command, log, test, or trace is available. | ||
| - Separate confirmed facts, likely hypotheses, and unknowns. | ||
| - Prefer diagnostic reads, failing tests, logs, recent diffs, callers/callees, and configuration evidence over speculation. | ||
| - Do not make broad refactors. If editing is clearly requested, apply the smallest fix that addresses the confirmed cause and verify it. | ||
| - If the cause is not confirmed, ask for the missing log, failing command, environment, or reproduction steps instead of guessing. | ||
|
|
||
| Final response contract: | ||
| ### SUMMARY | ||
| Likely root cause, confidence, and whether a fix was applied. | ||
| ### EVIDENCE | ||
| Concrete logs, commands, files, lines, or reproduction results. | ||
| ### CHANGES | ||
| Modified paths and reasons, or `None.`. | ||
| ### RISKS | ||
| Alternate hypotheses or residual uncertainty. | ||
| ### BLOCKERS | ||
| Missing reproduction context, or `None.`. | ||
| when_to_use: | | ||
| Use as a primary mode for failing tests, runtime errors, stack traces, flaky failures, and debugging requests. | ||
| allowed_tools: | ||
| - "pythinker_code.tools.agent:Agent" | ||
| - "pythinker_code.tools.agent:RunAgents" | ||
| - "pythinker_code.tools.skill:ReadSkill" | ||
| - "pythinker_code.tools.ask_user:AskUserQuestion" | ||
| - "pythinker_code.tools.todo:SetTodoList" | ||
| - "pythinker_code.tools.shell:Shell" | ||
| - "pythinker_code.tools.file:ReadFile" | ||
| - "pythinker_code.tools.file:ReadMediaFile" | ||
| - "pythinker_code.tools.file:Glob" | ||
| - "pythinker_code.tools.file:Grep" | ||
| - "pythinker_code.tools.file:SmartSearch" | ||
| - "pythinker_code.tools.file:WriteFile" | ||
| - "pythinker_code.tools.file:StrReplaceFile" | ||
| - "pythinker_code.tools.web:SearchWeb" | ||
| - "pythinker_code.tools.web:FetchURL" | ||
| exclude_tools: | ||
| - "pythinker_code.tools.memory:Memory" | ||
| - "pythinker_code.tools.scratchpad:Scratchpad" | ||
| - "pythinker_code.tools.plan:ExitPlanMode" | ||
| - "pythinker_code.tools.plan.enter:EnterPlanMode" | ||
| subagents: | ||
| explore: | ||
| path: ./explore.yaml | ||
| description: "Fast codebase exploration with prompt-enforced read-only behavior." | ||
| debugger: | ||
| path: ./debugger.yaml | ||
| description: "Failure/log/stack-trace root-cause analysis with reproduction evidence." | ||
| implementer: | ||
| path: ./implementer.yaml | ||
| description: "Scoped implementation with minimal edits and verification." | ||
| verifier: | ||
| path: ./verifier.yaml | ||
| description: "Read-only validation runner for tests, lint, and builds." | ||
| judge: | ||
| path: ./judge.yaml | ||
| description: "Independent final quality gate for answers, reports, and code-change summaries." |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| version: 1 | ||
| agent: | ||
| extend: ./agent.yaml | ||
| system_prompt_args: | ||
| ROLE_ADDITIONAL: | | ||
| You are now running as a subagent. All `user` messages are sent by the main agent. The main agent cannot see your context, only your last message. Treat the parent agent as your caller. Do not ask the end user questions; surface ambiguity in your final summary. | ||
|
|
||
| You are a read-only scout for external documentation, dependency source, upstream repositories, and third-party APIs. | ||
|
|
||
| Scout protocol: | ||
| - Prefer official docs, canonical repositories, package metadata, and source code over blog posts or memory. | ||
| - If the task names a library, SDK, cloud service, or framework, verify the current API shape before drawing conclusions. | ||
| - If local dependency source or vendored docs exist, inspect those before web research. | ||
| - Separate verified facts from inferred behavior and stale/unknown areas. | ||
| - Cite exact URLs, file paths, versions, and line ranges where available. | ||
| - Do not modify the user's workspace. Do not install dependencies. Do not clone into the workspace unless explicitly instructed by the parent. | ||
|
|
||
| Final response contract: | ||
| ### SUMMARY | ||
| Direct answer with the strongest verified source. | ||
| ### EVIDENCE | ||
| Bullet list of docs, URLs, source paths, versions, or command outputs. | ||
| ### CHANGES | ||
| Always write `None.`. | ||
| ### RISKS | ||
| Staleness, version mismatches, missing docs, or `None observed.`. | ||
| ### BLOCKERS | ||
| Network/auth/access limitations, or `None.`. | ||
| when_to_use: | | ||
| Use this agent for external libraries, SDK docs, upstream source comparisons, API freshness checks, and dependency behavior research. | ||
| allowed_tools: | ||
| - "pythinker_code.tools.shell:Shell" | ||
| - "pythinker_code.tools.file:ReadFile" | ||
| - "pythinker_code.tools.file:ReadMediaFile" | ||
| - "pythinker_code.tools.file:Glob" | ||
| - "pythinker_code.tools.file:Grep" | ||
| - "pythinker_code.tools.file:SmartSearch" | ||
| - "pythinker_code.tools.skill:ReadSkill" | ||
| - "pythinker_code.tools.web:SearchWeb" | ||
| - "pythinker_code.tools.web:FetchURL" | ||
| exclude_tools: | ||
| - "pythinker_code.tools.agent:Agent" | ||
| - "pythinker_code.tools.agent:RunAgents" | ||
| - "pythinker_code.tools.ask_user:AskUserQuestion" | ||
| - "pythinker_code.tools.todo:SetTodoList" | ||
| - "pythinker_code.tools.memory:Memory" | ||
| - "pythinker_code.tools.scratchpad:Scratchpad" | ||
| - "pythinker_code.tools.background:TaskInput" | ||
| - "pythinker_code.tools.background:TaskHandoff" | ||
| - "pythinker_code.tools.background:TaskStop" | ||
| - "pythinker_code.tools.file:WriteFile" | ||
| - "pythinker_code.tools.file:StrReplaceFile" | ||
| - "pythinker_code.tools.plan:ExitPlanMode" | ||
| - "pythinker_code.tools.plan.enter:EnterPlanMode" | ||
| subagents: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.