The codex-sm wrapper lets you run Codex CLI while automatically loading and saving StackMemory context. It mirrors the opencode-sm and claude-sm workflows for a consistent experience.
Install via npm to get real binaries on your PATH. This is the preferred path for end users and CI.
# Install globally
npm i -g @stackmemoryai/stackmemory
# Verify
codex-sm --helpNotes:
- Uses the package
binentry (codex-sm) with a#!/usr/bin/env nodeshebang for portability. - No shell aliasing required. Uninstall with
npm rm -g @stackmemoryai/stackmemory.
If you are developing from a local clone, you can expose the CLI without publishing:
# Build and link locally
npm run build
npm link
# Or create a small shim (zsh shown) in ~/.stackmemory/bin
mkdir -p ~/.stackmemory/bin
cat > ~/.stackmemory/bin/codex-sm <<'EOF'
#!/usr/bin/env zsh
exec zsh "$HOME/Dev/stackmemory/scripts/codex-wrapper.sh" "$@"
EOF
chmod +x ~/.stackmemory/bin/codex-sm
# Ensure ~/.stackmemory/bin is on PATH (your ~/.zshrc)
export PATH="$HOME/.stackmemory/bin:$PATH"- Auto-initializes StackMemory in git repos without
.stackmemory - Loads recent context on startup
- Saves context on exit
- Optional Linear auto-sync with
--auto-syncand--sync-interval=<minutes>
# Start Codex with StackMemory context
codex-sm
# With Linear auto-sync (syncs every 5 minutes)
codex-sm --auto-sync
# Custom sync interval (10 minutes)
codex-sm --auto-sync --sync-interval=10If Codex supports MCP tooling in your setup, you can expose StackMemory tools similarly to OpenCode by running the StackMemory MCP server:
stackmemory mcp-serverThis provides tools like get_context, add_decision, start_frame, close_frame, and Linear sync helpers.
- The wrapper looks for
codexorcodex-cliin yourPATH. - Linear auto-sync requires
LINEAR_API_KEYto be set in the environment. - For a richer integration (worktree isolation and tracing), a TypeScript-based wrapper like
claude-smcan be added; ask if you want me to scaffold it.