A Claude Code-style CLI coding agent written in PHP, powered by Symfony AI and the brand-new Symfony TUI component.
__ _
___ / _| ___ ___ __| | ___
/ __| |_ / __/ _ \ / _` |/ _ \
\__ \ _| (_| (_) | (_| | __/
|___/_| \___\___/ \__,_|\___|
- 🔁 Agentic loop hand-rolled and explicit, no framework hiding the magic.
- 🛠️ 7 built-in tools:
read,write,edit,bash,ls,glob,skill. - 🖥️ Full TUI built on
symfony/tui(live activity bar, streaming Markdown, modal permission overlays, loader spinner between LLM iterations). - 🔐 Three-layer permissions: per-tool rule, global mode, modal confirmation.
- 💬 Slash commands inside the prompt:
/help,/clear,/auto,/tools,/cost,/model,/skills,/exit. - 📚 Claude Code-compatible skills: drop your
SKILL.mdfiles into.sfcode/skills/and they just work. - 🧠 Dynamic system prompt injecting CWD, OS, tools, skills, and the
project's
AGENTS.md(withCLAUDE.mdas a fallback). - 💾 Auto session persistence under
.sfcode/sessions/. - ⚡ True async HTTP via
amphp/http-client, so Ctrl+C is instant and the spinner actually spins while the LLM thinks. - 🔌 Multi-provider via
symfony/ai-platform(OpenAI by default, Ollama available viaSFCODE_PROVIDER=ollama).
git clone https://github.com/yoanbernabeu/sfcode
cd sfcode
composer install
cp .env.example .env.local && $EDITOR .env.local # paste OPENAI_API_KEY
alias sfcode="$PWD/bin/sfcode"
sfcode- PHP 8.4.1+
- Composer 2.x
- ext-ctype, ext-curl, ext-iconv, ext-json, ext-mbstring
- Linux / macOS / WSL2 (Windows native is not supported because of
sttyandpcntldependencies) - An OpenAI API key (or a local Ollama instance via
SFCODE_PROVIDER=ollama)
composer cs # php-cs-fixer dry-run
composer cs-fix # apply style fixes
composer phpstan # phpstan level 8
composer qa # cs + phpstanbin/sfcode # entrypoint
src/
├── Kernel.php # Symfony 8.1 standard DI kernel
├── Agent/
│ ├── AgentLoop # the agentic loop (turn + turnStream)
│ └── MessageHistory # wrapper over Symfony AI MessageBag
├── Command/ChatCommand # `chat` command (TUI entrypoint)
├── Exception/ # custom exceptions
├── Permission/ # three-mode permission system
├── Platform/PlatformFactory # picks OpenAI / Ollama from env
├── Prompt/SystemPromptBuilder # runtime system-prompt composer
├── Session/SessionStore # JSON session persistence
├── Skill/ # cascade project > user skill loader
├── Tool/ # built-in tools
└── Tui/
├── TurnRunner # one-turn UI choreography
├── TuiPermissionRequester # modal overlay for permissions
├── TuiSlashHandler # slash command dispatcher
└── Widget/ # custom Tui widgets
prompts/system.txt # system prompt template
.sfcode/skills/ # bundled skills (committed)
MCP, subagents, hooks, OS sandbox, advanced context compaction, cross-session
memory. These are tracked as future work in CHANGELOG.md.
MIT.