Freebuff is a free-only variant of the Codebuff CLI, distributed as a separate npm package (freebuff). It reuses the entire cli/ package but builds with a compile-time flag that strips out paid features, subscription logic, credits display, and mode switching — leaving only the FREE mode experience.
FREEBUFF_MODE=true— set during the build to produce a Freebuff binary.- Injected via
--define process.env.FREEBUFF_MODE="true"inbun build, following the same pattern asCODEBUFF_IS_BINARYandCODEBUFF_CLI_VERSION.
Create a shared constant in cli/src/utils/constants.ts:
export const IS_FREEBUFF = process.env.FREEBUFF_MODE === 'true'This enables dead-code elimination in production builds — all if (!IS_FREEBUFF) branches are removed by the bundler.
| Area | Codebuff | Freebuff |
|---|---|---|
| Terminal title prefix | Codebuff: |
Freebuff: |
| CLI commander name | codebuff |
freebuff |
| npm package name | codebuff |
freebuff |
| Binary name | codebuff |
freebuff |
| App header text | "Codebuff will run commands on your behalf to help you build." | "Freebuff will run commands on your behalf to help you build." |
| ASCII logo | CODEBUFF block letters |
FREEBUFF block letters (new logo) |
| Description | "AI coding agent" | "Free AI coding assistant" |
| Homepage | codebuff.com | codebuff.com/free (or same) |
WEBSITE_URL usage |
Points to codebuff.com | Same (login, feedback, etc. stay on codebuff.com) |
cli/src/utils/terminal-title.ts— ChangeTITLE_PREFIXfrom'Codebuff: 'to'Freebuff: 'whenIS_FREEBUFF.cli/src/login/constants.ts— Add aLOGO_FREEBUFFASCII art variant, select based onIS_FREEBUFF.cli/src/app.tsx— Conditional header text ("Freebuff will run commands...").cli/src/index.tsx— Change commander.name('freebuff')and.description(...)whenIS_FREEBUFF.
Freebuff only supports FREE mode. All mode-related features are stripped.
agentModeis always'FREE'and never changes.- The initial mode flag (
--free,--max,--plan) CLI options are removed in Freebuff; mode is hardcoded. - No mode divider messages are ever inserted into chat history.
cli/src/utils/constants.ts— WhenIS_FREEBUFF, export a single-elementAGENT_MODES = ['FREE']andAGENT_MODE_TO_IDwith only the FREE entry. Or: the mode toggle component simply never renders.cli/src/components/agent-mode-toggle.tsx— ReturnnullwhenIS_FREEBUFF(hide entirely).cli/src/components/build-mode-buttons.tsx— ReturnnullwhenIS_FREEBUFF(hides mode-switching buttons in message UI).cli/src/components/mode-divider.tsx— ReturnnullwhenIS_FREEBUFF(no mode transition markers).cli/src/utils/input-modes.ts— SetshowAgentModeToggle: falsefor all input mode configs whenIS_FREEBUFF.cli/src/index.tsx— Remove--free,--max,--plan,--liteCLI flags whenIS_FREEBUFF; hardcodeinitialMode = 'FREE'.cli/src/state/chat-store.ts— DefaultagentModeto'FREE'; makesetAgentModea no-op whenIS_FREEBUFF.
| Command | Reason |
|---|---|
/subscribe (+ /strong, /sub, /buy-credits) |
No subscription model |
/usage (+ /credits) |
No credits display |
/ads:enable |
Ads always on, not toggleable |
/ads:disable |
Ads always on, not toggleable |
/connect:claude (+ /claude) |
Claude subscription not available |
/refer-friends (+ /referral, /redeem) |
Referrals earn credits, not applicable |
/mode:* (all mode commands) |
Only FREE mode |
/agent:gpt-5 |
Premium agent, not available in free tier |
/review |
Uses thinker-gpt under the hood |
/publish |
Agent publishing not available in free tier |
/image (+ /img, /attach) |
Image attachments unavailable with free model (MiniMax M2.7) |
| Command | Notes |
|---|---|
/help |
Modified help content (see §6) |
/new (+ /clear, /reset, /n, /c) |
Clear conversation |
/history (+ /chats) |
Browse past conversations |
/feedback (+ /bug, /report) |
Share feedback |
/bash (+ /!) |
Bash mode |
/theme:toggle |
Light/dark toggle |
/logout (+ /signout) |
Sign out |
/exit (+ /quit, /q) |
Quit |
/login (+ /signin) |
Already-logged-in message |
Skill commands (/skill:*) |
Keep if skills are loaded |
cli/src/data/slash-commands.ts— FilterSLASH_COMMANDSbased onIS_FREEBUFF. Remove mode commands, subscription commands, credits commands, ads commands, referral, review, publish, and gpt-5 agent commands.cli/src/commands/command-registry.ts— FilterCOMMAND_REGISTRYsimilarly. Wrap removed commands in!IS_FREEBUFFguards.
Freebuff never displays credits, usage, subscription info, or out-of-credits states.
| Component | File | Behavior |
|---|---|---|
UsageBanner |
components/usage-banner.tsx |
Never rendered |
OutOfCreditsBanner |
components/out-of-credits-banner.tsx |
Never rendered |
SubscriptionLimitBanner |
components/subscription-limit-banner.tsx |
Never rendered |
BottomStatusLine |
components/bottom-status-line.tsx |
Never rendered (Claude subscription status) |
Credits in MessageFooter |
components/message-footer.tsx |
Remove CreditsOrSubscriptionIndicator — no credits or "✓ Strong" shown |
ClaudeConnectBanner |
components/claude-connect-banner.tsx |
Never rendered |
When IS_FREEBUFF, these input modes should be unreachable:
outOfCredits— never triggeredsubscriptionLimit— never triggeredusage— no/usagecommandconnect:claude— no/connect:claudecommandreferral— no/refer-friendscommand
use-usage-monitor.ts— Return early whenIS_FREEBUFF(no credits to monitor).use-subscription-query.ts— Return empty/disabled whenIS_FREEBUFF.use-claude-quota-query.ts— Return empty/disabled whenIS_FREEBUFF.use-usage-query.ts— Still needed for server-side billing, but UI never shows it.
sessionCreditsUsedinchat-store.tsstill accumulates (server tracks usage), but the UI never displays it.- The
chat.tsxad banner continues to passisFreeMode={true}(hardcoded).
The /help banner in Freebuff should be simplified. Remove the Credits section entirely.
Shortcuts
Ctrl+C / Esc stop
Ctrl+J / Opt+Enter newline
↑↓ history
Ctrl+T collapse/expand agents
Features
/ commands
@files mention
@agents use agent
!bash run command
No "Credits" section. No /subscribe, /usage, or /ads:enable references.
cli/src/components/help-banner.tsx— Conditionally hide the Credits section whenIS_FREEBUFF.
In Freebuff, ads are always enabled and cannot be disabled.
- The ad banner always renders (when an ad is available).
- The "Hide ads" link in the info panel is replaced with "Ads are required in Free mode." (this already exists in
ad-banner.tsxwhenisFreeModeis true). - The
/ads:enableand/ads:disablecommands are removed (see §4). getAdsEnabled()always returnstruewhenIS_FREEBUFF.
cli/src/commands/ads.ts—getAdsEnabled()returnstrueunconditionally whenIS_FREEBUFF.cli/src/chat.tsx— Skip the!hasSubscriptionguard for ads whenIS_FREEBUFF; always show.
The freebuff/ directory is organized as a product-level directory with subdirectories for each surface (CLI, web, etc.):
freebuff/
├── SPEC.md # This file (product-level spec)
├── README.md # Product-level documentation
├── cli/ # CLI build & release infrastructure
│ ├── build.ts # Build script that sets FREEBUFF_MODE=true
│ └── release/
│ ├── package.json # npm package metadata (name: "freebuff")
│ ├── index.js # Entry point (finds/runs binary)
│ ├── postinstall.js# Downloads platform binary on install
│ └── README.md # npm package README
└── web/ # (Future) Freebuff website code
This structure allows freebuff/web/ (or other surfaces) to be added alongside the CLI without restructuring.
Wraps cli/scripts/build-binary.ts with:
FREEBUFF_MODE=true bun cli/scripts/build-binary.ts freebuff <version>The existing build-binary.ts already supports a custom binary name argument and passes NEXT_PUBLIC_* env vars. We add FREEBUFF_MODE to the defineFlags array in build-binary.ts.
Mirrors cli/release/package.json but with:
"name": "freebuff""description": "Free AI coding assistant""bin": { "freebuff": "index.js" }- Same
postinstall.jspattern (downloads platform-specific binary from GitHub releases) - Binary stored at
~/.config/manicode/freebuff(orfreebuff.exeon Windows)
New file: .github/workflows/freebuff-release.yml
Mirrors cli-release-prod.yml with these changes:
- Trigger:
workflow_dispatch(manual) or scheduled - Binary name:
freebuff - Version source:
freebuff/cli/release/package.json - Git tags:
freebuff-v<version> - npm publish:
freebuffpackage - Environment overrides:
{"FREEBUFF_MODE": "true", "NEXT_PUBLIC_CB_ENVIRONMENT": "prod"} - GitHub Release: Creates releases in
CodebuffAI/codebuff-community(or a separate repo)
Add FREEBUFF_MODE to the define flags so it's available at compile time:
const defineFlags = [
['process.env.NODE_ENV', '"production"'],
['process.env.CODEBUFF_IS_BINARY', '"true"'],
['process.env.CODEBUFF_CLI_VERSION', `"${version}"`],
['process.env.CODEBUFF_CLI_TARGET', `"${targetInfo.platform}-${targetInfo.arch}"`],
// Freebuff mode flag
['process.env.FREEBUFF_MODE', `"${process.env.FREEBUFF_MODE ?? 'false'}"`],
...nextPublicEnvVars,
]These features work identically in Freebuff:
- Authentication — Login/logout flow, API key storage
- Chat — Message history, streaming, agent spawning
- File mentions (
@files) — Browse and attach files - Agent mentions (
@agents) — Use available agents (free-tier agents only) - Bash mode — Run terminal commands
- Image attachments — Attach and paste images
- Knowledge files —
knowledge.md - Chat history —
/history, resume conversations - Feedback —
/feedbackcommand - Theme — Light/dark toggle
- Skills — Loaded from
.agents/skills - Local agents — Loaded from
.agents/directory
When IS_FREEBUFF:
APP_LAUNCHEDevent includesisFreebuff: true- All existing analytics events continue to fire (helps understand free vs paid usage)
- No new analytics events needed initially
The server already handles FREE mode correctly:
isFreeMode(costMode)incommon/src/constants/free-agents.tsrecognizes the'free'cost modeAGENT_MODE_TO_COST_MODE.FREE === 'free'is already set- Free-mode-allowed agent+model combos cost 0 credits
- Ad impressions in FREE mode already don't grant credits
No server-side changes are needed for Freebuff, except the release download API (/api/releases/download/) must be configured to serve freebuff-* binary tarballs. This may require updating the download route to recognize Freebuff release tags (freebuff-v*).
- Test that
IS_FREEBUFFguards correctly hide/show components - Test filtered slash commands list
- Test filtered command registry
- Test help banner content
- Build a Freebuff binary and verify:
- Title says "Freebuff"
- No mode toggle visible
/subscribe,/usagecommands not found- Help menu has no Credits section
- Ads always show
- Use
codebuff-local-cliagent withFREEBUFF_MODE=trueto verify visual output
- Add
IS_FREEBUFFconstant - Update
build-binary.tsto pass throughFREEBUFF_MODE - Conditional branding (title, logo, app header, CLI name)
- Filter slash commands and command registry
- Hide agent mode toggle
- Suppress credits/subscription UI components
- Disable usage monitor hook
- Simplify help banner
- Always-on ads behavior
- Disable unreachable input modes
- Hide
BuildModeButtonsandModeDividercomponents
- Create
freebuff/cli/release/package files - Create
freebuff/cli/build.tsscript - Create
.github/workflows/freebuff-release.yml
- Add unit tests for IS_FREEBUFF guards
- Add integration/E2E tests
- Manual QA of built binary