feat(agents): add Freebuff agent support#1357
feat(agents): add Freebuff agent support#1357fortissolucoescontato-bit wants to merge 5 commits into
Conversation
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughAdds Freebuff as a supported agent with detection, configuration paths, MCP and system-prompt support, npm installation, registry and catalog wiring, codegraph compatibility, SDD coverage, tests, and documentation. ChangesFreebuff integration
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant AgentRegistry
participant FreebuffAdapter
participant PATH
participant FileSystem
participant NPM
AgentRegistry->>FreebuffAdapter: Detect(homeDir)
FreebuffAdapter->>PATH: Look up freebuff binary
FreebuffAdapter->>FileSystem: Stat ~/.agents
FileSystem-->>FreebuffAdapter: Return config state
FreebuffAdapter-->>AgentRegistry: Return detection details
AgentRegistry->>NPM: Install freebuff@0.0.124 globally
Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ 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.
Actionable comments posted: 3
🤖 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 `@docs/agents.md`:
- Line 27: Update the Freebuff row in the Agent Matrix so its Slash Commands
capability is marked “No,” matching Adapter.SupportsSlashCommands() and the
existing Agent Notes.
In `@internal/agents/freebuff/adapter.go`:
- Around line 83-91: Update SystemPromptDir and SystemPromptFile in
internal/agents/freebuff/adapter.go: use ConfigPath(homeDir) for the directory
and join the knowledge.md filename beneath it. Update the expectation in
internal/agents/freebuff/adapter_test.go to assert the .agents/knowledge.md
path.
- Around line 174-180: Remove the unused AgentNotInstallableError type and its
Error method from the adapter, leaving the existing SupportsAutoInstall and
InstallCommand behavior unchanged.
🪄 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: Repository UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: c1deefb5-8078-4cab-a761-40d7fb1607b6
⛔ Files ignored due to path filters (1)
testdata/golden/engram-freebuff-mcp.goldenis excluded by!testdata/**
📒 Files selected for processing (10)
docs/agents.mdinternal/agents/factory.gointernal/agents/factory_test.gointernal/agents/freebuff/adapter.gointernal/agents/freebuff/adapter_test.gointernal/components/communitytool/codegraph_contract.gointernal/components/sdd/inject_test.gointernal/installcmd/resolver.gointernal/model/types.gointernal/versions/versions.go
| | Trae | `trae-ide` | Yes | Yes | Solo-agent | No | No | `~/.trae` | | ||
| | Pi | `pi` | Yes | Yes | Full (package-managed subagents) | No | Yes | `~/.pi` | | ||
| | Hermes | `hermes` | Yes | Yes | Full (delegate_task ephemeral) | No | No | `~/.hermes` | | ||
| | Freebuff | `freebuff` | Yes | Yes | Solo-agent | No | Yes | `~/.agents` | |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Inconsistent capability documentation.
The Agent Matrix states that Freebuff supports Slash Commands (Yes), but the Adapter.SupportsSlashCommands() method returns false, and the Agent Notes below explicitly state "Output styles / slash commands: Not supported."
Please update the matrix to reflect that Slash Commands are not supported (No).
📝 Proposed fix
-| Freebuff | `freebuff` | Yes | Yes | Solo-agent | No | Yes | `~/.agents` |
+| Freebuff | `freebuff` | Yes | Yes | Solo-agent | No | No | `~/.agents` |📝 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.
| | Freebuff | `freebuff` | Yes | Yes | Solo-agent | No | Yes | `~/.agents` | | |
| | Freebuff | `freebuff` | Yes | Yes | Solo-agent | No | No | `~/.agents` | |
🤖 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 `@docs/agents.md` at line 27, Update the Freebuff row in the Agent Matrix so
its Slash Commands capability is marked “No,” matching
Adapter.SupportsSlashCommands() and the existing Agent Notes.
| func (a *Adapter) SystemPromptDir(homeDir string) string { | ||
| return homeDir | ||
| } | ||
|
|
||
| // SystemPromptFile returns the path to knowledge.md, which Freebuff reads | ||
| // first (highest priority) before AGENTS.md and CLAUDE.md. | ||
| func (a *Adapter) SystemPromptFile(homeDir string) string { | ||
| return filepath.Join(homeDir, "knowledge.md") | ||
| } |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Incorrect path for global system prompt. The SystemPromptDir and SystemPromptFile methods currently return paths in homeDir directly, which will pollute the user's home directory (e.g., ~/knowledge.md) instead of isolating them inside the .agents config directory as stated in the documentation.
internal/agents/freebuff/adapter.go#L83-L91: UpdateSystemPromptDirto returnConfigPath(homeDir)andSystemPromptFileto returnfilepath.Join(ConfigPath(homeDir), "knowledge.md").internal/agents/freebuff/adapter_test.go#L47-L49: Update the test expectation fromfilepath.Join(homeDir, "knowledge.md")tofilepath.Join(homeDir, ".agents", "knowledge.md")to match the corrected adapter logic.
📍 Affects 2 files
internal/agents/freebuff/adapter.go#L83-L91(this comment)internal/agents/freebuff/adapter_test.go#L47-L49
🤖 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 `@internal/agents/freebuff/adapter.go` around lines 83 - 91, Update
SystemPromptDir and SystemPromptFile in internal/agents/freebuff/adapter.go: use
ConfigPath(homeDir) for the directory and join the knowledge.md filename beneath
it. Update the expectation in internal/agents/freebuff/adapter_test.go to assert
the .agents/knowledge.md path.
| type AgentNotInstallableError struct { | ||
| Agent model.AgentID | ||
| } | ||
|
|
||
| func (e AgentNotInstallableError) Error() string { | ||
| return fmt.Sprintf("agent %q must be installed manually before Gentle AI can configure it", e.Agent) | ||
| } |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value
Remove unused error type.
AgentNotInstallableError is defined but never used in this file. Since SupportsAutoInstall returns true and InstallCommand provides an installation sequence, this error (likely carried over from a manual-install adapter like Hermes) is dead code and should be removed.
♻️ Proposed fix
-type AgentNotInstallableError struct {
- Agent model.AgentID
-}
-
-func (e AgentNotInstallableError) Error() string {
- return fmt.Sprintf("agent %q must be installed manually before Gentle AI can configure it", e.Agent)
-}📝 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.
| type AgentNotInstallableError struct { | |
| Agent model.AgentID | |
| } | |
| func (e AgentNotInstallableError) Error() string { | |
| return fmt.Sprintf("agent %q must be installed manually before Gentle AI can configure it", e.Agent) | |
| } |
🤖 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 `@internal/agents/freebuff/adapter.go` around lines 174 - 180, Remove the
unused AgentNotInstallableError type and its Error method from the adapter,
leaving the existing SupportsAutoInstall and InstallCommand behavior unchanged.
|
This PR changes 442 lines, exceeding the standard 400-line review budget by 42 lines. The additional scope is primarily the adapter registration and regression coverage required to integrate Freebuff safely across knowledge, skills, MCP, detection, and installation. Could a maintainer please review and apply |
Governance Checklist — Final StateAll automated checks completed before marking as Ready for Review: E2E ✅
Unit tests ✅ Build ✅ — Issue reference ✅ —
|
- Add AgentFreebuff constant to model/types.go
- Add freebuff adapter (internal/agents/freebuff/) with:
- Detection via freebuff binary on PATH and ~/.agents config dir
- InstallCommand uses pinned version (versions.Freebuff=0.0.122)
and --ignore-scripts to prevent supply-chain attacks
- sudo prefix on Linux with non-writable npm prefix
- SystemPromptFile: knowledge.md (Freebuff reads it first, before AGENTS.md)
- MCP config: ~/.agents/mcp.json (StrategyMCPConfigFile)
- Skills: ~/.agents/skills/
- SupportsSubAgents: false (solo-agent)
- Add resolveFreebuffInstall() to installcmd/resolver.go
- Register in npmBasedAgents map
- Register in factory.go defaultAgentIDs and NewAdapter switch
- Add to CodeGraph compatibility table
- Add to TestInjectTriggerRules_AllAdapters
- Add Freebuff version pin to versions.go
- Add MCP golden file (engram-freebuff-mcp.golden)
- Document in docs/agents.md
Fixes: npm install used unpinned version without --ignore-scripts
Ref: Gentleman-Programming#1128
- Ensure Freebuff is in the catalog so the installer recognizes it. - Fix SystemPromptDir and SystemPromptFile to point to ~/.agents instead of ~/
* SystemPromptFile now points to ~/.knowledge.md instead of ~/.agents/knowledge.md * Register freebuff natively in code-graph compatibility * Restore Freebuff installation resolver for standalone installcmd * Increment bounded review guard test Closes Gentleman-Programming#1128
7119ce2 to
3aacd58
Compare
Description
Adds full support for the Freebuff agent (the free/ad-supported binary of Codebuff).
freebuffon PATH and uses~/.agentsas the config directory.freebuff@0.0.122usingnpmwith--ignore-scriptsfor security.~/.agents/knowledge.md, which Freebuff prioritizes overAGENTS.md.~/.agents/mcp.json.Resolves npm supply-chain vulnerabilities from the original branch by enforcing pinned versions and blocking postinstall scripts.
Closes #1128
Summary by CodeRabbit
New Features
Documentation