Skip to content

refactor(config): restructure opencode config and clean up obsolete files#2

Open
Jonathan0823 wants to merge 11 commits into
mainfrom
feature/opencode-cleanup
Open

refactor(config): restructure opencode config and clean up obsolete files#2
Jonathan0823 wants to merge 11 commits into
mainfrom
feature/opencode-cleanup

Conversation

@Jonathan0823
Copy link
Copy Markdown
Owner

@Jonathan0823 Jonathan0823 commented May 22, 2026

Related issue

  • Closes #

Summary

  • Refactored commit and PR commands to plan-only workflows
  • Restructured opencode config and cleaned up obsolete files
  • Removed obsolete agent files (openagent.md, opencoder.md, contextscout.md)
  • Removed obsolete command files (add-context.md, analyze-patterns.md, clean.md, commit.md, context.md, optimize.md, test.md, validate-repo.md)
  • Removed obsolete config/agent-metadata.json
  • Reorganized commands/ directory with updated command files
  • Updated AGENTS.md, README.md, and opencode.json

Scope

  • In scope: opencode config cleanup, command refactoring, obsolete file removal
  • Out of scope: none

Testing

  • Unit tests
  • Integration tests
  • Manual verification

Reviewer focus

  • Please review: AGENTS.md, opencode.json, commands/ directory
  • Risk areas: removed agent files and command files may affect existing workflows

Notes

  • Migrations/config changes: opencode.json restructured
  • Follow-ups: none

Summary by CodeRabbit

  • Documentation

    • Overhauled workflow docs: standardized subagent roles, clarified when to use each, added language-specific final handoff lint/typecheck rules, and introduced plan-first commit/PR/spec/review/fix workflows
    • Added a comprehensive set of slash-command guides and command workflows for planning, testing, optimizing, cleaning, analyzing patterns, and review
    • Updated task/spec generation guidance, task-management guides, and navigation links
  • Chores

    • Reorganized command docs and tightened global permission/execution/configuration controls

Review Change Stack

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 22, 2026

📝 Walkthrough

Walkthrough

This PR standardizes subagent routing and permissions, migrates workflow command specs into a new commands/ directory, updates TaskManager to generate spec-driven task bundles under .tmp/tasks/{feature}/, and realigns documentation/navigation to the new structure.

Changes

Core Agent and Command System Reorganization

Layer / File(s) Summary
Agent workflow standards and subagent routing
AGENTS.md
New subagent roster and usage guide mapping tasks to standardized agents (@ContextScout, @ExternalScout, @CoderAgent, @CodeReviewer, @DocWriter); added Commit Workflow and Permissions & Guardrails; language-specific handoff checks for Go and TypeScript/Next.js.
Core permission and agent configuration
opencode.json, agent/subagents/core/contextscout.md, agent/subagents/code/coder-agent.md
Adds a global permission policy with read/edit/bash/tool constraints and sensitive-file denials; restructures agent configs into plan and build roles with nested permissions; updates ContextScout and CoderAgent permission defaults and runtime output/compaction limits.
Command system migration to commands/ structure
command/* (removed), commands/* (add-context.md, analyze-patterns.md, clean.md, commit.md, context.md, fix.md, optimize.md, pr.md, review.md, spec.md, test.md)
Removes legacy command/ docs where replaced; adds standardized command specifications under commands/ with metadata and stepwise workflows for each slash command.
TaskManager and spec/task schema updates
agent/subagents/core/task-manager.md, context/core/task-management/guides/*, skills/task-management/SKILL.md
TaskManager workflows now generate spec.md plus task bundles under .tmp/tasks/{feature}/, enhanced subtask schema clarifies context_files vs reference_files, adds status/self-correction guards, and updates guides/skill docs to reference spec-driven flows.
Documentation and navigation realignment
README.md, context/core/navigation.md, context/navigation.md
README reframed to “inspired by” OpenAgents Control, documents slash commands and examples, renames command/ to commands/ in structure/customization guidance, and redirects context navigation away from OpenAgents references to core navigation.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Poem

🐰 I hopped through commands and tidy plans,
Moved docs to burrows, re-charted the lands,
Scouts and builders now know their cue,
Specs at .tmp where the tasks come true,
Guardrails set — a neat little warren, anew.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the primary change: restructuring the opencode configuration and cleaning up obsolete files, which aligns with the removal of obsolete agent/command files and the reorganization of the commands/ directory.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/opencode-cleanup

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🧹 Nitpick comments (2)
commands/context.md (1)

3-3: ⚡ Quick win

Use the read-focused agent profile for this command.

This command only discovers and reads context; assigning it to the non-editing profile reduces accidental write capability.

Suggested fix
-agent: build
+agent: plan
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@commands/context.md` at line 3, The file currently sets the agent profile to
a write-oriented profile ("agent: build"); change that setting to the
read-focused agent profile by replacing the "agent: build" entry with the
read-only/read-focused profile token (e.g., "agent: read" or the project's
canonical read profile name) so the command discovers and reads context without
granting editing capabilities—locate the "agent: build" line in
commands/context.md and update it accordingly.
commands/optimize.md (1)

15-19: ⚡ Quick win

Consider adding an explicit approval step.

The workflow suggests fixes (step 4) but doesn't explicitly require user approval before applying them. Given the build agent designation and the learnings about approval-first workflows, consider adding a step that presents findings and proposed fixes for approval before execution.

Based on learnings, approval should be required before destructive operations and architecture changes.

📋 Suggested workflow enhancement
 1. Determine the scope from the user input or current diff.
 2. Check for performance bottlenecks, security issues, and edge cases.
 3. Prioritize issues by impact.
 4. Suggest the smallest effective fix for each major issue.
-5. Keep the report specific and actionable.
+5. Present findings and ask for approval before applying fixes.
+6. Keep the report specific and actionable.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@commands/optimize.md` around lines 15 - 19, Add an explicit approval step
after the proposed-fix step: update the workflow steps (around step "Suggest the
smallest effective fix for each major issue") to insert a new step that presents
findings and proposed fixes to the user and requires explicit approval before
applying any changes; ensure this approval is mandatory for destructive
operations and architecture changes, records who approved it (audit/log), and
requires a clear affirmative action (e.g., "approve" confirmation) before
proceeding.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@agent/subagents/core/contextscout.md`:
- Around line 18-19: The ContextScout policy has a conflicting permission where
the top-level permission "task" is set to allow while the explicit rules for
ContextScout forbid task usage; update the policy so it is consistent—either
remove the global "task: \"*\": \"allow\"" entry or change it to "deny"/remove
task from the ContextScout scope, or alternatively modify ContextScout's
specific rules to explicitly allow the intended task actions; make the change in
the ContextScout policy block (look for the "ContextScout" section and the
"task" entry) and apply the same consistent fix to the other occurrences
referenced (lines ~42-43 and ~116-117).

In `@AGENTS.md`:
- Around line 42-45: The fenced example blocks containing lines like `User:
"What's the best way to implement authentication in Go?" → Use `@ExternalScout`
for library docs, or `@ContextScout` for project conventions` currently lack a
language identifier and trip MD040; update each of these triple-backtick fences
to use ```text (i.e., add the `text` language after the opening ```), and apply
the same change to the other example blocks in this section (the blocks showing
the User/→ Use `@ExternalScout/`@ContextScout examples) so all such fenced
examples include the `text` language tag.

In `@commands/commit.md`:
- Around line 35-44: The markdown fenced code block that begins with ``` and
contains "Branch: <branch>" / "Files: <file list>" / "Risk: <low | medium |
high>" should specify a language to satisfy MD040; change the opening fence from
``` to ```text so the block starts with ```text and leave the rest of the block
contents unchanged, then close with the existing ``` fence.

In `@opencode.json`:
- Around line 101-105: The plan agent policy currently allows mutating VCS
commands ("git add*", "git commit*", "git push*", "gh pr*"), which breaks
plan-only safety; update the policy so those keys are not allowed in plan mode
by changing their values from "allow" to "deny" (or removing them) while keeping
non-mutating commands like "ls" allowed; reference the policy keys "git add*",
"git commit*", "git push*", and "gh pr*" when making the change so the plan
agent cannot perform commits, pushes, or PR creation.

---

Nitpick comments:
In `@commands/context.md`:
- Line 3: The file currently sets the agent profile to a write-oriented profile
("agent: build"); change that setting to the read-focused agent profile by
replacing the "agent: build" entry with the read-only/read-focused profile token
(e.g., "agent: read" or the project's canonical read profile name) so the
command discovers and reads context without granting editing capabilities—locate
the "agent: build" line in commands/context.md and update it accordingly.

In `@commands/optimize.md`:
- Around line 15-19: Add an explicit approval step after the proposed-fix step:
update the workflow steps (around step "Suggest the smallest effective fix for
each major issue") to insert a new step that presents findings and proposed
fixes to the user and requires explicit approval before applying any changes;
ensure this approval is mandatory for destructive operations and architecture
changes, records who approved it (audit/log), and requires a clear affirmative
action (e.g., "approve" confirmation) before proceeding.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 5addb68f-4a48-4fc6-9d51-f058cfbff6d4

📥 Commits

Reviewing files that changed from the base of the PR and between 8eaa273 and cf5b6dd.

📒 Files selected for processing (30)
  • AGENTS.md
  • README.md
  • agent/core/openagent.md
  • agent/core/opencoder.md
  • agent/subagents/core/contextscout.md
  • command/add-context.md
  • command/analyze-patterns.md
  • command/clean.md
  • command/commit.md
  • command/context.md
  • command/openagents/check-context-deps.md
  • command/optimize.md
  • command/test.md
  • command/validate-repo.md
  • commands/add-context.md
  • commands/analyze-patterns.md
  • commands/clean.md
  • commands/commit.md
  • commands/context.md
  • commands/fix.md
  • commands/git-commit.md
  • commands/optimize.md
  • commands/pr.md
  • commands/review.md
  • commands/spec.md
  • commands/test.md
  • config/agent-metadata.json
  • context/core/navigation.md
  • context/navigation.md
  • opencode.json
💤 Files with no reviewable changes (14)
  • command/clean.md
  • command/context.md
  • command/validate-repo.md
  • config/agent-metadata.json
  • command/openagents/check-context-deps.md
  • command/optimize.md
  • agent/core/opencoder.md
  • context/core/navigation.md
  • command/commit.md
  • agent/core/openagent.md
  • commands/git-commit.md
  • command/analyze-patterns.md
  • command/test.md
  • command/add-context.md

Comment on lines 18 to +19
task:
"*": "deny"

"*": "allow"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

ContextScout permissions conflict with its read-only rules.

task is enabled, but the rules explicitly forbid task usage. This makes behavior ambiguous and over-permissive.

Suggested fix
   task:
-    "*": "allow"
+    "*": "deny"

Also applies to: 42-43, 116-117

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@agent/subagents/core/contextscout.md` around lines 18 - 19, The ContextScout
policy has a conflicting permission where the top-level permission "task" is set
to allow while the explicit rules for ContextScout forbid task usage; update the
policy so it is consistent—either remove the global "task: \"*\": \"allow\""
entry or change it to "deny"/remove task from the ContextScout scope, or
alternatively modify ContextScout's specific rules to explicitly allow the
intended task actions; make the change in the ContextScout policy block (look
for the "ContextScout" section and the "task" entry) and apply the same
consistent fix to the other occurrences referenced (lines ~42-43 and ~116-117).

Comment thread AGENTS.md
Comment on lines 42 to 45
```
User: "What's the best way to implement authentication in Go?"
→ Use @researcher
→ Use @ExternalScout for library docs, or @ContextScout for project conventions
```
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Add language identifiers to fenced example blocks.

These fences currently trigger MD040 and can break markdown lint gates.

Suggested fix
-```
+```text
 User: "What's the best way to implement authentication in Go?"
 → Use `@ExternalScout` for library docs, or `@ContextScout` for project conventions

Apply the same `text` fence language to the other example blocks in this section.
</details>


Also applies to: 48-51, 54-57, 60-63, 66-69

<details>
<summary>🧰 Tools</summary>

<details>
<summary>🪛 markdownlint-cli2 (0.22.1)</summary>

[warning] 42-42: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

</details>

</details>

<details>
<summary>🤖 Prompt for AI Agents</summary>

Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @AGENTS.md around lines 42 - 45, The fenced example blocks containing lines
like User: "What's the best way to implement authentication in Go?" → Use @ExternalScoutfor library docs, or@ContextScout for project conventions
currently lack a language identifier and trip MD040; update each of these
triple-backtick fences to use text (i.e., add the `text` language after the opening ), and apply the same change to the other example blocks in this
section (the blocks showing the User/→ Use @ExternalScout/@ContextScout
examples) so all such fenced examples include the text language tag.


</details>

<!-- fingerprinting:phantom:poseidon:hawk -->

<!-- This is an auto-generated comment by CodeRabbit -->

Comment thread commands/commit.md
Comment on lines +35 to +44
```
Branch: <branch>
Files: <file list>
Risk: <low | medium | high>

Proposed commit:
type(scope): description

<one-line summary of what this commit does and why>
```
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Specify a language for the commit-draft fenced block.

This block triggers MD040; adding a language keeps markdown lint clean.

Suggested fix
-   ```
+   ```text
    Branch: <branch>
    Files: <file list>
    Risk: <low | medium | high>
@@
-   ```
+   ```
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
```
Branch: <branch>
Files: <file list>
Risk: <low | medium | high>
Proposed commit:
type(scope): description
<one-line summary of what this commit does and why>
```
🧰 Tools
🪛 markdownlint-cli2 (0.22.1)

[warning] 35-35: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@commands/commit.md` around lines 35 - 44, The markdown fenced code block that
begins with ``` and contains "Branch: <branch>" / "Files: <file list>" / "Risk:
<low | medium | high>" should specify a language to satisfy MD040; change the
opening fence from ``` to ```text so the block starts with ```text and leave the
rest of the block contents unchanged, then close with the existing ``` fence.

Comment thread opencode.json
Comment on lines +101 to +105
"git add*": "allow",
"git commit*": "allow",
"git push*": "allow",
"gh pr*": "allow",
"ls": "allow",
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

plan agent allows mutating git/PR commands, which breaks plan-only safety.

Allowing commit/push/PR execution in plan mode weakens the guardrail contract and can bypass intended approval flow.

Suggested fix
-          "git add*": "allow",
-          "git commit*": "allow",
-          "git push*": "allow",
-          "gh pr*": "allow",
+          "git add*": "deny",
+          "git commit*": "deny",
+          "git push*": "deny",
+          "gh pr*": "deny",
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"git add*": "allow",
"git commit*": "allow",
"git push*": "allow",
"gh pr*": "allow",
"ls": "allow",
"git add*": "deny",
"git commit*": "deny",
"git push*": "deny",
"gh pr*": "deny",
"ls": "allow",
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@opencode.json` around lines 101 - 105, The plan agent policy currently allows
mutating VCS commands ("git add*", "git commit*", "git push*", "gh pr*"), which
breaks plan-only safety; update the policy so those keys are not allowed in plan
mode by changing their values from "allow" to "deny" (or removing them) while
keeping non-mutating commands like "ls" allowed; reference the policy keys "git
add*", "git commit*", "git push*", and "gh pr*" when making the change so the
plan agent cannot perform commits, pushes, or PR creation.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 6

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
agent/subagents/core/task-manager.md (1)

400-417: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Fix malformed JSON fence delimiters in examples.

These blocks use `json / ` instead of proper triple-backtick fences, which can break rendering and markdown lint.

Suggested fix pattern
-`json
+```json
 ...
-`
+```

Also applies to: 503-563, 565-612

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@agent/subagents/core/task-manager.md` around lines 400 - 417, Replace the
malformed code fence that begins with "`json" and ends with a single backtick in
the "context_files" JSON example (the block containing the "context_files"
object) with proper triple-backtick JSON fences (```json ... ```); locate the
example by searching for the "context_files" key and the incorrect backtick
delimiters in agent/subagents/core/task-manager.md and apply the same fix to the
other occurrences referenced (lines ~503-563 and ~565-612) so each example uses
```json at the start and ``` at the end.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@agent/subagents/code/coder-agent.md`:
- Around line 262-266: There are two identical top-level headings "# OpenCode
Agent Configuration" causing MD024; remove the duplicate heading so only a
single "# OpenCode Agent Configuration" remains and consolidate any content
currently under both into that one section (search for the exact heading string
"# OpenCode Agent Configuration" and delete the extra occurrence, keeping the
metadata comments under the remaining heading).
- Around line 8-10: The permission entry permission.bash["*"] = "ask" is too
broad; replace the wildcard with an explicit allowlist of only the exact
commands this subagent needs (e.g., the existing "bash
.opencode/skills/task-management/router.sh complete*" and "bash
.opencode/skills/task-management/router.sh status*" entries) and remove or
change permission.bash["*"] to avoid global shell access; ensure each allowed
key uses the minimal glob required and set other bash entries to "deny" or omit
them to enforce least privilege.
- Around line 92-97: Remove the stale references to
".opencode/config/agent-metadata.json" in the coder-agent.md text (the two
blocks that currently point to that path); either delete those lines or replace
them with the current metadata guidance (e.g., a short note that agent metadata
config was removed and where to find/maintain metadata now), ensuring no
leftover mention of the deleted config file remains.

In `@agent/subagents/core/task-manager.md`:
- Around line 8-10: Update the TaskManager bash permission allowlist by changing
permission.bash["*"] from "ask" to "deny" and keep explicit allow entries for
the needed commands (e.g., the existing "npx ts-node*task-cli*" and "mkdir -p
.tmp/tasks*"); ensure the permission object (permission.bash) only lists those
explicit "allow" entries and defaults to "deny" so TaskManager follows
least-privilege behavior.

In `@context/core/task-management/guides/managing-tasks.md`:
- Around line 21-28: Two fenced code blocks in the "managing-tasks.md" guide
(the numbered task flow block and the directory tree block) are missing language
identifiers and trigger MD040; update both opening fences to include a language
tag (e.g., ```text) so the blocks become ```text ... ``` and ensure any other
similar fenced blocks in the same file (the directory tree example) are updated
likewise.

In `@context/core/workflows/external-context-integration.md`:
- Around line 254-270: The subagent_type value is using the wrong registered
string (subagent_type="TaskManager") which will cause unknown-agent failures;
locate the block that sets subagent_type="TaskManager" (the prompt/metadata
assignment for the task bundle) and change it to the exact registered string
"Task Manager" (or the canonical value defined in the invocation guide) so
delegation succeeds; also scan for any other occurrences of the incorrect
"TaskManager" token in the same metadata and replace them with "Task Manager".

---

Outside diff comments:
In `@agent/subagents/core/task-manager.md`:
- Around line 400-417: Replace the malformed code fence that begins with "`json"
and ends with a single backtick in the "context_files" JSON example (the block
containing the "context_files" object) with proper triple-backtick JSON fences
(```json ... ```); locate the example by searching for the "context_files" key
and the incorrect backtick delimiters in agent/subagents/core/task-manager.md
and apply the same fix to the other occurrences referenced (lines ~503-563 and
~565-612) so each example uses ```json at the start and ``` at the end.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 9e80e80c-76cd-47d5-b88f-985e9fc60e62

📥 Commits

Reviewing files that changed from the base of the PR and between cf5b6dd and 81b3c57.

📒 Files selected for processing (13)
  • AGENTS.md
  • README.md
  • agent/subagents/code/coder-agent.md
  • agent/subagents/core/task-manager.md
  • commands/commit.md
  • commands/pr.md
  • commands/spec.md
  • context/core/task-management/guides/managing-tasks.md
  • context/core/task-management/guides/splitting-tasks.md
  • context/core/task-management/navigation.md
  • context/core/workflows/external-context-integration.md
  • context/openagents-repo/guides/subagent-invocation.md
  • skills/task-management/SKILL.md
✅ Files skipped from review due to trivial changes (3)
  • context/core/task-management/navigation.md
  • skills/task-management/SKILL.md
  • README.md

Comment on lines +8 to 10
"*": "ask"
"bash .opencode/skills/task-management/router.sh complete*": "allow"
"bash .opencode/skills/task-management/router.sh status*": "allow"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Avoid broad wildcard bash permissions for this subagent.

Changing permission.bash["*"] to "ask" materially expands command surface. Prefer explicit allowlist-only commands for least-privilege hardening.

Based on learnings: Apply principle of least privilege for permissions.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@agent/subagents/code/coder-agent.md` around lines 8 - 10, The permission
entry permission.bash["*"] = "ask" is too broad; replace the wildcard with an
explicit allowlist of only the exact commands this subagent needs (e.g., the
existing "bash .opencode/skills/task-management/router.sh complete*" and "bash
.opencode/skills/task-management/router.sh status*" entries) and remove or
change permission.bash["*"] to avoid global shell access; ensure each allowed
key uses the minimal glob required and set other bash entries to "deny" or omit
them to enforce least privilege.

Comment on lines 92 to 97
# OpenCode Agent Configuration

# Metadata (id, name, category, type, version, author, tags, dependencies) is stored in:

# .opencode/config/agent-metadata.json

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Remove stale metadata path references to a deleted config file.

Both blocks point to .opencode/config/agent-metadata.json, but this PR removes agent metadata config as obsolete. Keeping these references leaves broken operator instructions.

Also applies to: 262-266

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@agent/subagents/code/coder-agent.md` around lines 92 - 97, Remove the stale
references to ".opencode/config/agent-metadata.json" in the coder-agent.md text
(the two blocks that currently point to that path); either delete those lines or
replace them with the current metadata guidance (e.g., a short note that agent
metadata config was removed and where to find/maintain metadata now), ensuring
no leftover mention of the deleted config file remains.

Comment on lines 262 to 266
# OpenCode Agent Configuration

# Metadata (id, name, category, type, version, author, tags, dependencies) is stored in:

# .opencode/config/agent-metadata.json
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Consolidate duplicated heading block.

# OpenCode Agent Configuration appears twice, which triggers MD024 and adds noise. Keep a single section.

🧰 Tools
🪛 markdownlint-cli2 (0.22.1)

[warning] 262-262: Multiple headings with the same content

(MD024, no-duplicate-heading)


[warning] 264-264: Multiple headings with the same content

(MD024, no-duplicate-heading)


[warning] 266-266: Multiple headings with the same content

(MD024, no-duplicate-heading)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@agent/subagents/code/coder-agent.md` around lines 262 - 266, There are two
identical top-level headings "# OpenCode Agent Configuration" causing MD024;
remove the duplicate heading so only a single "# OpenCode Agent Configuration"
remains and consolidate any content currently under both into that one section
(search for the exact heading string "# OpenCode Agent Configuration" and delete
the extra occurrence, keeping the metadata comments under the remaining
heading).

Comment on lines +8 to 10
"*": "ask"
"npx ts-node*task-cli*": "allow"
"mkdir -p .tmp/tasks*": "allow"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Keep TaskManager bash permissions allowlist-only.

permission.bash["*"] = "ask" broadens capability beyond required task-cli/mkdir/mv operations. Restrict wildcard to deny and keep explicit allows.

Based on learnings: Apply principle of least privilege for permissions.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@agent/subagents/core/task-manager.md` around lines 8 - 10, Update the
TaskManager bash permission allowlist by changing permission.bash["*"] from
"ask" to "deny" and keep explicit allow entries for the needed commands (e.g.,
the existing "npx ts-node*task-cli*" and "mkdir -p .tmp/tasks*"); ensure the
permission object (permission.bash) only lists those explicit "allow" entries
and defaults to "deny" so TaskManager follows least-privilege behavior.

Comment on lines 21 to 28
```
1. Initiation → TaskManager creates task.json + subtasks
2. Selection → Find eligible tasks (deps satisfied)
3. Execution → Working agent implements task
4. Verification → TaskManager validates completion
5. Archiving → Move to completed/ when done
0. Spec Generation → /spec loads TaskManager and creates spec.md + task bundle
1. Initiation → TaskManager creates task.json + subtasks
2. Selection → Find eligible tasks (deps satisfied)
3. Execution → Working agent implements task
4. Verification → TaskManager validates completion
5. Archiving → Move to completed/ when done
```
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Add language identifiers to fenced code blocks (MD040).

These fences are missing a language tag and can fail markdown lint in CI.

Suggested fix
-```
+```text
 0. Spec Generation → /spec loads TaskManager and creates spec.md + task bundle
 1. Initiation      → TaskManager creates task.json + subtasks
 2. Selection       → Find eligible tasks (deps satisfied)
 3. Execution       → Working agent implements task
 4. Verification    → TaskManager validates completion
 5. Archiving       → Move to completed/ when done
-```
+```

-```
+```text
 .tmp/tasks/{feature-slug}/
 ├── spec.md
 ├── task.json
 ├── subtask_01.json
 ├── subtask_02.json
 └── subtask_03.json
-```
+```

Also applies to: 48-55

🧰 Tools
🪛 markdownlint-cli2 (0.22.1)

[warning] 21-21: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@context/core/task-management/guides/managing-tasks.md` around lines 21 - 28,
Two fenced code blocks in the "managing-tasks.md" guide (the numbered task flow
block and the directory tree block) are missing language identifiers and trigger
MD040; update both opening fences to include a language tag (e.g., ```text) so
the blocks become ```text ... ``` and ensure any other similar fenced blocks in
the same file (the directory tree example) are updated likewise.

Comment on lines 254 to 270
subagent_type="TaskManager",
description="Break down Drizzle + Better Auth integration",
prompt="Load context from .tmp/sessions/2026-01-28-drizzle-auth/context.md
description="Generate spec and task bundle for Drizzle + Better Auth integration",
prompt="Use the plan below as the source of truth.

Read the context file for full requirements, standards, and external documentation.

Break down this feature into atomic subtasks:
Turn this feature into a spec.md file and atomic subtasks:
1. Drizzle schema setup with modular organization
2. Better Auth configuration with Drizzle adapter
3. Next.js App Router integration
4. Test suite

For each subtask, include:
- context_files: Standards from context.md
- reference_files: Project files to understand
- context_files: Standards only
- reference_files: Project files only
- external_context: External docs to reference

Create subtask files in tasks/subtasks/drizzle-auth-integration/"
Create the bundle in .tmp/tasks/drizzle-auth-integration/"
)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Use the registered subagent type string to avoid failed delegation.

This example still uses subagent_type="TaskManager" (Line 254), but the invocation guide defines "Task Manager" as valid and "TaskManager" as invalid. Update this block to prevent runtime “unknown agent type” failures.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@context/core/workflows/external-context-integration.md` around lines 254 -
270, The subagent_type value is using the wrong registered string
(subagent_type="TaskManager") which will cause unknown-agent failures; locate
the block that sets subagent_type="TaskManager" (the prompt/metadata assignment
for the task bundle) and change it to the exact registered string "Task Manager"
(or the canonical value defined in the invocation guide) so delegation succeeds;
also scan for any other occurrences of the incorrect "TaskManager" token in the
same metadata and replace them with "Task Manager".

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@opencode.json`:
- Around line 125-128: The build agent's "permission" block currently allows
read/edit/write broadly; update the build agent's permission object to
explicitly deny sensitive file patterns (e.g., add deny entries for "**/.env*",
"**/*.key", and "**/*.secret") alongside the existing allow rules so these
denies take precedence; modify the "permission" structure for the build agent
(the "permission" object under the build agent definition) to include those deny
patterns consistent with the root and plan agent permission formats.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 6c4f7669-2ea4-4124-9d41-af6e3099a829

📥 Commits

Reviewing files that changed from the base of the PR and between 81b3c57 and b571ce7.

📒 Files selected for processing (1)
  • opencode.json

Comment thread opencode.json
Comment on lines 125 to +128
"permission": {
"skill": {
"*": "allow"
"read": "allow",
"edit": "allow",
"write": "allow",
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Build agent lacks sensitive-file protections present in root and plan permissions.

The build agent grants blanket read, edit, and write without denying **/.env*, **/*.key, or **/*.secret. Root permissions (lines 8-14, 40-47) and the plan agent (lines 80-85) explicitly deny these patterns. If agent-level permissions override root—as the explicit bash restrictions suggest—the build agent can access and modify secrets/keys.

Since build is the default agent, this becomes the primary interaction path.

Suggested fix: add sensitive-file denials to build agent
       "permission": {
-        "read": "allow",
-        "edit": "allow",
+        "read": {
+          "*": "allow",
+          "**/.env*": "deny",
+          "**/.env.example": "allow",
+          "**/*.key": "deny",
+          "**/*.secret": "deny"
+        },
+        "edit": {
+          "*": "allow",
+          "**/.env*": "deny",
+          "**/.env.example": "allow",
+          "**/*.key": "deny",
+          "**/*.secret": "deny",
+          "**/node_modules/**": "deny",
+          ".git/**": "deny"
+        },
         "write": "allow",
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"permission": {
"skill": {
"*": "allow"
"read": "allow",
"edit": "allow",
"write": "allow",
"permission": {
"read": {
"*": "allow",
"**/.env*": "deny",
"**/.env.example": "allow",
"**/*.key": "deny",
"**/*.secret": "deny"
},
"edit": {
"*": "allow",
"**/.env*": "deny",
"**/.env.example": "allow",
"**/*.key": "deny",
"**/*.secret": "deny",
"**/node_modules/**": "deny",
".git/**": "deny"
},
"write": "allow",
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@opencode.json` around lines 125 - 128, The build agent's "permission" block
currently allows read/edit/write broadly; update the build agent's permission
object to explicitly deny sensitive file patterns (e.g., add deny entries for
"**/.env*", "**/*.key", and "**/*.secret") alongside the existing allow rules so
these denies take precedence; modify the "permission" structure for the build
agent (the "permission" object under the build agent definition) to include
those deny patterns consistent with the root and plan agent permission formats.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant