Skip to content

Repository files navigation

HOANGSA

A context engineering system for Claude Code

License: MITClaude CodeBuilt with Rust


HOANGSA is a context engineering system for Claude Code that solves a fundamental problem: Claude's output quality degrades as the context window fills up. The fix is structural — HOANGSA splits work into discrete tasks, each running in a fresh context window with only the files it actually needs. The orchestrator never writes code; it dispatches workers with bounded context and assembles results.


Installation

HOANGSA ships four binaries: three CLIs you invoke directly (hoangsa-cli, hoangsa-memory, hsp) plus one MCP server (hoangsa-memory-mcp) that Claude Code spawns on your behalf.

Supported platforms

TripleStatusNotes
darwin-arm64✅ SupportedApple Silicon (M1 / M2 / M3 / M4)
linux-x64✅ Supportedglibc-based distros (Ubuntu, Debian, Fedora, RHEL, …)
linux-arm64✅ Supportedglibc-based distros
linux-* (musl / Alpine)❌ Not supportedONNX Runtime binaries link glibc — build from source
Windows❌ Not yetUse WSL2 (Ubuntu)

Prerequisites on the target machine: curl or wget, tar, and one of sha256sum / shasum. No Node, no Python, no Docker, no cargo needed for the release tarball.

For contributors building from source you additionally need Rust 1.91+ (rustup toolchain install stable) and a C toolchain (build-essential on Debian/Ubuntu, Xcode Command Line Tools on macOS).


Option A — release installer (recommended)

One command pulls the latest release, verifies the SHA-256 checksum, drops all four binaries into ~/.hoangsa/bin/, registers the hoangsa-memory MCP server in Claude Code, and pre-downloads the fastembed ONNX weights.

curl -fsSL https://github.com/pirumu/hoangsa/releases/latest/download/install.sh | sh

Flags (pass after sh -s --):

FlagEffect
--globalInstall globally for this user (default) — writes to the resolved Claude config dir
--localInstall for the current project only — writes to ./.claude/
--target claude|codex|bothSelect the install target. Default is claude; codex configures Codex memory MCP, skills, guidance, and hooks.
--codex-memory-root <path>Pin Codex memory to a specific root. Valid only with --local --target codex or --local --target both; writes only to <project>/.codex/config.toml.
--no-embedSkip pre-downloading the multilingual-e5-small weights (~118 MB). They will fetch lazily on first index / query / archive ingest. Useful on bandwidth-constrained links.
--dry-runPrint actions without writing files — good for auditing
--helpShow the installer help

Examples:

# Global install (default)
curl -fsSL https://github.com/pirumu/hoangsa/releases/latest/download/install.sh | sh
# Project-local install
curl -fsSL https://github.com/pirumu/hoangsa/releases/latest/download/install.sh | sh -s -- --local
# Dry-run to see what would happen
curl -fsSL https://github.com/pirumu/hoangsa/releases/latest/download/install.sh | sh -s -- --dry-run
# Codex memory MCP only
hoangsa-cli install --target codex --global
hoangsa-cli install --target codex --local
# Pin a specific version
HOANGSA_VERSION=v0.2.2 curl -fsSL https://github.com/pirumu/hoangsa/releases/download/v0.2.2/install.sh | sh

Environment overrides:

VariableDefaultPurpose
HOANGSA_VERSIONlatestRelease tag to install (e.g. v0.2.2)
HOANGSA_REPOpirumu/hoangsaGitHub repo slug to download from
HOANGSA_INSTALL_DIR$HOME/.hoangsaRoot for all binaries and cache
HOANGSA_CLI_DIR$HOANGSA_INSTALL_DIR/binOverride just the CLI bin dir
HOANGSA_NO_PATH_EDITSet to 1 to skip ~/.zshrc / ~/.bashrc edits (export PATH manually)
CLAUDE_CONFIG_DIRauto-detectedPin a specific Claude profile (~/.claude, ~/.zclaude, …)

The installer honours CLAUDE_CONFIG_DIR if it is already set, and otherwise detects multiple Claude profile dirs (~/.claude, ~/.zclaude, …). With more than one it prompts; pass the env var explicitly in non-TTY installs.


Option B — build from source (contributors)

Clone the repo and run the local install helper — builds the workspace in release mode, installs the four binaries, and wires Claude Code the same way the release installer does:

git clone https://github.com/pirumu/hoangsa.git
cd hoangsa
scripts/install-local.sh --global # or --local for per-project

Flags: --global / --local, --dry-run, --no-embed, --skip-build (re-run the post-build steps without recompiling).

Just one CLI? Each binary can be installed standalone via cargo:

cargo install --path crates/hoangsa-cli # installs `hoangsa-cli`
cargo install --path crates/hoangsa-memory # installs `hoangsa-memory`
cargo install --path crates/hoangsa-memory-mcp # installs `hoangsa-memory-mcp`
cargo install --path crates/hoangsa-proxy # installs `hsp`

This drops binaries into ~/.cargo/bin/. Note that cargo install alone does not register MCP servers, copy templates, or wire Claude Code hooks — run hoangsa-cli install --global afterwards to finish setup.


Codex memory mode

Codex support uses Codex-native files instead of writing Claude-only surfaces. It does not install Claude slash commands or Claude agent templates. Codex workflow commands are installed as skills, with optional custom-prompt shortcuts for the Codex slash menu.

hoangsa-cli install --target codex --global
hoangsa-cli install --target codex --local
hoangsa-cli install --target both --local
hoangsa-cli install --target codex --local --codex-memory-root "$PWD/.hoangsa/memory"

Global Codex installs write ~/.codex/config.toml; local installs write <project>/.codex/config.toml:

[mcp_servers.hoangsa-memory]
command = "/ABSOLUTE/PATH/TO/hoangsa-memory-mcp"args = []
startup_timeout_sec = 20tool_timeout_sec = 120
[mcp_servers.hoangsa-memory.env]
RUST_LOG = "info"

Do not set global HOANGSA_MEMORY_ROOT; the MCP server resolves the right Hoangsa memory project from the Codex session working directory. Use --codex-memory-root <path> only with a local Codex install when intentionally pinning one project. The override is written only to the project-local .codex/config.toml.

Codex TOML merges preserve unrelated settings and MCP servers semantically after parse/write. They do not preserve comments or original formatting.

After installing, start Codex in the project and run /mcp to confirm that hoangsa-memory tools are listed.

The installer also routes memory skills to .agents/skills/hoangsa/, installs Codex-native command workflow skills such as $hoangsa-menu, syncs Hoangsa guidance into AGENTS.md, and writes conservative Codex hook entries under .codex/hooks.json. Global Codex installs also write managed prompt shortcuts into ~/.codex/prompts/, which Codex exposes as /prompts:hoangsa-menu style slash-menu entries. hsp shell-output rewriting is not enabled for Codex unless explicitly opted in by a later release.

Codex command examples:

$hoangsa-menu
use hoangsa menu
/prompts:hoangsa-menu

Claude Code keeps the original command shape:

/hoangsa:menu

The Codex command player can also be used directly:

hoangsa-cli codex commands --json
hoangsa-cli codex render menu --arguments "design the billing screen"
hoangsa-cli codex install-prompts --global

Codex support is intentionally scoped:

  • Codex installs configure memory MCP, memory skills, guidance, and project/global hook files; they do not install Claude slash commands or Claude agent templates.
  • Global Codex installs never write HOANGSA_MEMORY_ROOT. Local Codex installs preserve an existing project-local HOANGSA_MEMORY_ROOT when --codex-memory-root is omitted.
  • Hoangsa UI/API config edits are constrained to validated Hoangsa config files only: global config.json or project .hoangsa/config.json. Project paths must resolve to existing directories; selected files are rejected before registration, switching, diffing, or applying config.
  • Codex plugin hook bundling is not enabled yet. Direct CLI install is the supported path for Codex hooks until the Codex plugin hook schema is validated against the target Codex release.

Codex plugin package

This repo also includes a local Codex plugin package for Desktop/App testing:

plugins/hoangsa-codex/
.agents/plugins/marketplace.json

The plugin packages the Codex-safe memory skills, Codex-native Hoangsa command workflow skills, and a hoangsa-memory MCP server entry. The MCP command expects hoangsa-memory-mcp to be on PATH, usually from the release installer or a source build.

To test the repo-local marketplace:

codex plugin marketplace add .
codex plugin add hoangsa-codex@hoangsa-local

Hooks are not bundled through the plugin yet. Use hoangsa-cli install --target codex --local for full project-local Codex wiring, including hooks, until Codex plugin hook packaging is validated against the target Codex release.


Post-install: PATH and verification

The installer appends a managed block to the first existing rc file it finds (~/.zshrc~/.bashrc) containing:

# hoangsa:managed startexport PATH="$HOME/.hoangsa/bin:$PATH"# hoangsa:managed end

If the block was skipped (non-TTY install, declined prompt, HOANGSA_NO_PATH_EDIT=1, no rc file found), add it yourself:

echo'export PATH="$HOME/.hoangsa/bin:$PATH"'>>~/.zshrc
source~/.zshrc

Verify the install:

hoangsa-cli --version # e.g. hoangsa-cli 0.2.2
hoangsa-memory --version # e.g. hoangsa-memory 0.2.2
hoangsa-memory-mcp --version # e.g. hoangsa-memory-mcp 0.2.2
hsp --version # e.g. hsp 0.2.2

Then run the per-CLI self-checks:

hsp doctor # verifies hsp hooks + handlers
hoangsa-memory memory show # prints MEMORY.md + LESSONS.md for cwd

Per-CLI install notes

hoangsa-cli — HOANGSA orchestrator

Drives the /hoangsa:* slash commands, owns the rule engine, wires Claude Code hooks, manages project preferences.

  • Binary location:~/.hoangsa/bin/hoangsa-cli
  • Per-project config:.hoangsa/config.json (created by hoangsa-cli install --local or /hoangsa:init)
  • Templates: staged to ~/.hoangsa/templates/ on global install
  • First-run setup:/hoangsa:init from inside Claude Code, or hoangsa-cli install --local from the shell

No separate install step — bundled with the release installer.

hoangsa-memory — long-term memory + code intelligence

Indexes your source tree, serves recall queries, runs blast-radius analysis, and manages the verbatim conversation archive.

  • Binary:~/.hoangsa/bin/hoangsa-memory
  • Companion daemon:~/.hoangsa/bin/hoangsa-memory-mcp (spawned by Claude Code via MCP — you never start it manually)
  • Per-project data:.hoangsa/memory/ (or ~/.hoangsa/memory/projects/<slug>/)
  • Shared model cache:~/.hoangsa/cache/fastembed/ (~4xx MB on disk once warm)
  • First run:hoangsa-memory init && hoangsa-memory index .

If you passed --no-embed and want to prefetch weights later:

hoangsa-memory prefetch-embed

hsp — CLI output compressor

Wraps Claude Code's Bash tool calls and trims verbose output (cargo/npm/git log/curl JSON) before the model reads it. 60–90% token savings on the noisiest commands.

  • Binary:~/.hoangsa/bin/hsp
  • Global hook:hsp init — writes PreToolUse hook into ~/.claude/settings.json
  • Per-project hook:hsp init -p — writes into ./.claude/settings.local.json
  • Self-check:hsp doctor

Full reference: crates/hoangsa-proxy/README.md.


Uninstall

From a checkout of the repo:

scripts/uninstall.sh --global # remove global install
scripts/uninstall.sh --local # remove project-local install
scripts/uninstall.sh --global --purge # also delete ~/.hoangsa entirely

Without --purge, the uninstaller leaves your memory data, fastembed cache, and staged templates under ~/.hoangsa/ in place — so you can reinstall without re-indexing or re-downloading model weights.

To remove a single cargo install-ed binary:

cargo uninstall hoangsa-cli
cargo uninstall hoangsa-memory
cargo uninstall hoangsa-memory-mcp
cargo uninstall hoangsa-proxy # binary name is `hsp`

Troubleshooting

SymptomFix
command not found: hoangsa-cli after installPATH not updated in current shell. source ~/.zshrc or open a new terminal.
musl libc detected on AlpineRelease tarballs are glibc-only. Use scripts/install-local.sh from a checkout on Alpine — requires rustc + cargo.
MCP tools missing in Claude CodeCLAUDE_CONFIG_DIR mismatch. Set it explicitly before install: CLAUDE_CONFIG_DIR=~/.zclaude curl -fsSL …| sh.
vector_store failed to start on first indexfastembed weights missing or corrupted. Run hoangsa-memory prefetch-embed or delete ~/.hoangsa/cache/fastembed/ and retry.
Installer stalls on prompt under curl|shstdin is piped. Pass flags explicitly: sh -s -- --global and set HOANGSA_NO_PATH_EDIT=1.
GitHub API rate limit exceededPin a tag: HOANGSA_VERSION=v0.2.2 curl … — skips the /releases/latest API call.

Quick Start

Prerequisites: the Claude Code CLI.

curl -fsSL https://github.com/pirumu/hoangsa/releases/latest/download/install.sh | sh
/hoangsa:init # Initialize project — detect codebase, set preferences
/hoangsa:menu # Design your first task → DESIGN-SPEC + TEST-SPEC

After /hoangsa:menu, run /hoangsa:prepare to plan, then /hoangsa:cook to execute.


Commands

Core Workflow

CommandDescription
/hoangsa:brainstormExplore a vague idea → BRAINSTORM.md (feeds into menu)
/hoangsa:menuDesign — interview → DESIGN-SPEC + TEST-SPEC
/hoangsa:preparePlan — specs → executable task DAG (plan.json)
/hoangsa:cookExecute — wave-by-wave, fresh context per worker task
/hoangsa:tasteTest — run acceptance tests per task
/hoangsa:plateCommit — stage + generate conventional commit message
/hoangsa:shipShip — code + security review, then push or create PR
/hoangsa:serveSync — bidirectional sync with connected task manager
/hoangsa:fixHotfix — cross-layer root cause tracing + minimal fix
/hoangsa:auditAudit — 8-dimension codebase scan (security, debt, coverage…)
/hoangsa:researchResearch — codebase analysis + external research → RESEARCH.md

Utility

CommandDescription
/hoangsa:ruleRules — add, remove, or list project enforcement rules
/hoangsa:addonAddons — list, add, or remove framework-specific worker rule addons
/hoangsa:initInitialize — detect codebase, configure preferences, first-time setup
/hoangsa:checkStatus — show current session progress and pending tasks
/hoangsa:indexIndex — rebuild hoangsa-memory code intelligence graph
/hoangsa:updateUpdate — upgrade HOANGSA to the latest version
/hoangsa:helpHelp — show all available commands

Memory & Code Intelligence

HOANGSA ships with hoangsa-memory, a local MCP server that gives Claude persistent memory (facts, lessons, preferences) and code-graph awareness (impact analysis, symbol context, change detection) across sessions.

  • Auto-installed by the installer: binaries land in ~/.hoangsa/bin/ and the MCP server is registered in your project's .mcp.json.
  • State per project lives under ~/.hoangsa/memory/projects/<slug>/ (MEMORY.md, LESSONS.md, USER.md + index).
  • Hooks installed into Claude Code settings: pre-edit rule enforcement, pre-edit lesson recall, post-tool event logging, and PreCompact / SessionEnd archive ingest for conversation recall.
  • Archive search (full conversation history) uses the in-process fastembed vector store — no sidecar required. The installer pre-downloads the multilingual-e5-small weights (~4xx MB) into ~/.hoangsa/cache/fastembed/; pass --no-embed to skip and fetch lazily on first use.

Manual reindex: /hoangsa:index or ~/.hoangsa/bin/hoangsa-memory --json index .


Configuration

Config lives in .hoangsa/config.json. Manage preferences with /hoangsa:init or hoangsa-cli pref set.

Preferences

KeyValuesDescription
langen, viLanguage for output
spec_langen, viLanguage for generated specs
tech_stackarrayProject technology stack
review_stylestrict, balanced, light, whole_documentCode review thoroughness
interaction_levelminimal, quick, standard, detailedHow much the orchestrator asks
auto_tastetrue, falseAuto-run tests after cook
auto_platetrue, falseAuto-commit after cook
auto_servetrue, falseAuto-sync to task manager

Model Profiles

Select a profile (quality / balanced / budget) to control the model at each of 8 roles. Switch with /hoangsa:init or by editing profile in config.json.

Rolequalitybalancedbudget
researcheropussonnethaiku
designeropusopussonnet
planneropussonnethaiku
orchestratoropusopushaiku
workeropussonnethaiku
revieweropussonnethaiku
testersonnethaikuhaiku
committersonnethaikuhaiku

License

MIT — Copyright (c) 2026 Zan

Author: Zan — @pirumu


Tiếng Việt

About

This fork to upgrade HOANGSA to support Codex AI Agent

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages