-
Notifications
You must be signed in to change notification settings - Fork 5
feat(opencode): auto-load aidevops AGENTS.md via instructions config #266
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
Conversation
OpenCode's 'instructions' field in opencode.json automatically includes specified files in every session context. This ensures the full aidevops framework documentation is available without relying on the LLM to follow 'read this file' instructions in the global AGENTS.md stub. Previously, ~/.config/opencode/AGENTS.md contained a short stub telling the LLM to read ~/.aidevops/agents/AGENTS.md, but OpenCode doesn't automatically follow file references - the LLM would need to use its Read tool, which was unreliable. Now: - instructions: [~/.aidevops/agents/AGENTS.md] auto-loads full framework docs - Global AGENTS.md still provides version check + pre-edit instructions - Both work together for complete aidevops integration Ref: https://opencode.ai/docs/rules/#using-opencodejson
Summary of ChangesHello @marcusquinn, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the OpenCode environment by automating the inclusion of critical Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
WalkthroughA shell script change configures the framework to auto-load Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request improves OpenCode configuration by automatically loading the AGENTS.md file, which makes the AI DevOps framework context reliably available. The change modifies generate-opencode-agents.sh to add the file path to the instructions field in opencode.json. My review includes a suggestion to make this change more robust by checking if the file exists before adding it to the configuration.
| config['instructions'] = [ | ||
| os.path.expanduser("~/.aidevops/agents/AGENTS.md") | ||
| ] | ||
| print(" Added instructions: ~/.aidevops/agents/AGENTS.md (auto-loaded every session)") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The script currently assumes ~/.aidevops/agents/AGENTS.md exists. If it doesn't (e.g., if setup.sh hasn't been run), a path to a non-existent file will be added to opencode.json, which could cause issues in OpenCode. It would be more robust to check for the file's existence before adding it to the instructions. This prevents potential errors and provides a helpful warning to the user if the file is missing.
Note that with this change, the summary message at the end of the script might be slightly misleading if the file is not found. A more advanced solution could involve passing state from the python script to the shell script to conditionally print the 'Instructions' line.
| config['instructions'] = [ | |
| os.path.expanduser("~/.aidevops/agents/AGENTS.md") | |
| ] | |
| print(" Added instructions: ~/.aidevops/agents/AGENTS.md (auto-loaded every session)") | |
| instructions_path = os.path.expanduser("~/.aidevops/agents/AGENTS.md") | |
| if os.path.exists(instructions_path): | |
| config['instructions'] = [instructions_path] | |
| print(" Added instructions: ~/.aidevops/agents/AGENTS.md (auto-loaded every session)") | |
| else: | |
| print(" [!] Warning: ~/.aidevops/agents/AGENTS.md not found. Skipping instructions. Run ./setup.sh to create it.") |
🔍 Code Quality Report�[0;35m[MONITOR]�[0m Code Review Monitoring Report �[0;34m[INFO]�[0m Latest Quality Status: �[0;34m[INFO]�[0m Recent monitoring activity: 📈 Current Quality Metrics
Generated on: Sat Jan 31 19:26:47 UTC 2026 Generated by AI DevOps Framework Code Review Monitoring |
Address Gemini Code Assist review feedback - avoid adding non-existent file path to opencode.json if setup.sh hasn't been run yet.
🤖 Augment PR SummarySummary: Ensures the aidevops framework docs are reliably present in OpenCode sessions by adding an Changes:
🤖 Was this summary useful? React with 👍 or 👎 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| # This ensures the full aidevops framework docs are available without | ||
| # relying on the LLM to follow "read this file" instructions. | ||
| # See: https://opencode.ai/docs/rules/#using-opencodejson | ||
| config['instructions'] = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
config['instructions'] is set unconditionally here, which will overwrite any existing user-configured instructions already present in opencode.json (despite the log message saying it was “Added”). Consider whether clobbering prior entries is intended, since it could unexpectedly remove other instruction files a user relies on.
🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.
| echo " Subagents: $subagent_count auto-discovered from subfolders (@mentionable)" | ||
| echo " AGENTS.md: ~/.config/opencode/AGENTS.md" | ||
| echo " Instructions: ~/.aidevops/agents/AGENTS.md (auto-loaded every session)" | ||
| echo " Global rules: ~/.config/opencode/AGENTS.md (version check + pre-edit)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This summary line describes ~/.config/opencode/AGENTS.md as “version check + pre-edit”, but the script still writes a top-line instruction to load ~/.aidevops/agents/AGENTS.md, which is now redundant/confusing with the new instructions auto-load behavior.
🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.
|
🔍 Code Quality Report�[0;35m[MONITOR]�[0m Code Review Monitoring Report �[0;34m[INFO]�[0m Latest Quality Status: �[0;34m[INFO]�[0m Recent monitoring activity: 📈 Current Quality Metrics
Generated on: Sat Jan 31 19:29:31 UTC 2026 Generated by AI DevOps Framework Code Review Monitoring |



Summary
instructionsconfig toopencode.jsonviagenerate-opencode-agents.sh~/.aidevops/agents/AGENTS.mdin every sessionProblem
The global
~/.config/opencode/AGENTS.mdcontained:This relied on the LLM using its Read tool to follow the instruction, which was unreliable.
Solution
OpenCode's
instructionsfield inopencode.jsonautomatically includes specified files in every session context. Now both work together:instructions: [~/.aidevops/agents/AGENTS.md]~/.config/opencode/AGENTS.mdTesting
setup.shruns successfullyopencode.jsoncontains"instructions": ["/Users/.../AGENTS.md"]Ref
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.