Skip to content

feat(agents): add Freebuff agent support#1357

Draft
fortissolucoescontato-bit wants to merge 5 commits into
Gentleman-Programming:mainfrom
fortissolucoescontato-bit:feat/freebuff-agent-v2
Draft

feat(agents): add Freebuff agent support#1357
fortissolucoescontato-bit wants to merge 5 commits into
Gentleman-Programming:mainfrom
fortissolucoescontato-bit:feat/freebuff-agent-v2

Conversation

@fortissolucoescontato-bit

@fortissolucoescontato-bit fortissolucoescontato-bit commented Jul 17, 2026

Copy link
Copy Markdown

Description

Adds full support for the Freebuff agent (the free/ad-supported binary of Codebuff).

  • Detects freebuff on PATH and uses ~/.agents as the config directory.
  • Pin-installs freebuff@0.0.122 using npm with --ignore-scripts for security.
  • System prompt is injected into ~/.agents/knowledge.md, which Freebuff prioritizes over AGENTS.md.
  • MCP configuration is managed in ~/.agents/mcp.json.
  • Freebuff is registered as a solo-agent (no native subagent support).
  • Includes CodeGraph compatibility mapping.

Resolves npm supply-chain vulnerabilities from the original branch by enforcing pinned versions and blocking postinstall scripts.

Closes #1128

Summary by CodeRabbit

  • New Features

    • Added Freebuff as a fully supported agent.
    • Added Freebuff detection, configuration, skills, system-prompt, MCP, and automatic installation support.
    • Added Freebuff to the agent catalog, installation workflow, code graph compatibility, and SDD integrations.
  • Documentation

    • Documented Freebuff configuration paths, supported SDD modes, installation behavior, and capabilities.

@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown

Review Change Stack

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: c25fc17e-922c-4587-ab6d-60991e079e3a

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds 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.

Changes

Freebuff integration

Layer / File(s) Summary
Freebuff adapter contract
internal/model/types.go, internal/versions/versions.go, internal/agents/freebuff/*
Defines the Freebuff identifier, pinned package version, adapter capabilities, detection behavior, configuration paths, installation command, and unit tests.
Factory and installation wiring
internal/agents/factory.go, internal/agents/factory_test.go, internal/installcmd/resolver.go
Registers Freebuff in the default adapter registry and resolves its npm installation command with npm preflight checks.
Catalog and feature integrations
internal/catalog/agents.go, internal/components/communitytool/codegraph_contract.go, internal/components/sdd/*
Adds Freebuff to the supported-agent catalog, codegraph compatibility, and SDD adapter coverage and count assertions.
Freebuff documentation
docs/agents.md
Adds Freebuff to the agent matrix, SDD mode support table, and agent notes.

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
Loading

Possibly related PRs

Suggested labels: type:feature, size:exception

Suggested reviewers: alan-thegentleman

🚥 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 is concise and accurately describes the main change: adding Freebuff agent support.
Linked Issues check ✅ Passed The changes add Freebuff support across detection, install, default registration, docs, and tests, matching the linked issue's main requirements.
Out of Scope Changes check ✅ Passed The changes stay focused on Freebuff agent support, with related wiring, docs, and tests only.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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

📥 Commits

Reviewing files that changed from the base of the PR and between 055fd9f and 15e655d.

⛔ Files ignored due to path filters (1)
  • testdata/golden/engram-freebuff-mcp.golden is excluded by !testdata/**
📒 Files selected for processing (10)
  • docs/agents.md
  • internal/agents/factory.go
  • internal/agents/factory_test.go
  • internal/agents/freebuff/adapter.go
  • internal/agents/freebuff/adapter_test.go
  • internal/components/communitytool/codegraph_contract.go
  • internal/components/sdd/inject_test.go
  • internal/installcmd/resolver.go
  • internal/model/types.go
  • internal/versions/versions.go

Comment thread docs/agents.md
| 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` |

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 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.

Suggested change
| 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.

Comment on lines +83 to +91
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")
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 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: Update SystemPromptDir to return ConfigPath(homeDir) and SystemPromptFile to return filepath.Join(ConfigPath(homeDir), "knowledge.md").
  • internal/agents/freebuff/adapter_test.go#L47-L49: Update the test expectation from filepath.Join(homeDir, "knowledge.md") to filepath.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.

Comment on lines +174 to +180
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)
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 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.

Suggested change
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.

@fortissolucoescontato-bit
fortissolucoescontato-bit marked this pull request as draft July 17, 2026 17:24
@fortissolucoescontato-bit

Copy link
Copy Markdown
Author

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 size:exception if appropriate?

@fortissolucoescontato-bit
fortissolucoescontato-bit marked this pull request as ready for review July 17, 2026 18:33
@fortissolucoescontato-bit

Copy link
Copy Markdown
Author

Governance Checklist — Final State

All automated checks completed before marking as Ready for Review:

E2E

  • Ubuntu: PASSED (79/79 tests, 2 skipped opt-in tiers)
  • Arch: PASSED (79/79 tests)
  • Fedora: PASSED (79/79 tests)
  • Exit code: 0 across all 3 platforms

Unit tests
Pre-existing failure (TestInjectWindsurf_WorkflowsSkippedForNonProjectDir) confirmed identical on main and this branch via git worktree comparison — not a regression.

Build ✅ — go vet and go build clean.

Issue reference ✅ — Closes #1128 in PR body.


⚠️ Action required (maintainer): Please apply these labels manually — the bot token lacks labels:write scope on this repo:

  • type:feature
  • size:exception — diff is 434 lines (limit: 400); this PR is intentional scope, not scope creep.

@fortissolucoescontato-bit
fortissolucoescontato-bit marked this pull request as draft July 17, 2026 19:17
Gentle AI Bot added 5 commits July 21, 2026 09:21
- 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
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