Agents
Codex CLI
Connect Codex CLI through HASP as a brokered MCP surface.
Config Surface
- Prefer the wrapper or launcher path for Codex-style local agent workflows; use HASP as the generic stdio MCP server underneath it.
- Canonical command:
hasp agent mcp codex-cli
Config Example
{
"mcpServers": {
"hasp": {
"command": "hasp",
"args": ["agent", "mcp", "codex-cli"]
}
}
}
Setup
- Bootstrap the local profile:
hasp bootstrap --profile codex-cli --project-root <repo> --alias secret_01=<item> - Verify the tool surface:
printf '{"jsonrpc":"2.0","id":1,"method":"tools/list"}\n' | hasp agent mcp codex-cli - Register the MCP command in the Codex CLI config or launch wrapper you use locally.
Bootstrap may create a neutral repo alias such as secret_01, but day-to-day
usage should prefer safe named refs such as @OPENAI_API_KEY with
hasp_run or hasp_inject.
Session Behavior
hasp agent mcp codex-climanages daemon-backed sessions internally when no explicit token is supplied, and wrapper or launcher paths propagate the token into the whole process tree.- Use manual
hasp session openonly for debugging or controlled reuse outside the default flow.
Success Signal
- The tool surface lists
hasp_list,hasp_run,hasp_inject,hasp_capture, andhasp_redact. hasp_listreturns only safe project-scoped metadata, including neutral aliases and named refs.
Safe Path
- Use
hasp_runfor env-style command execution. - Use
hasp_injectwhen the workflow needs a real file path outside the repo root. - Prefer named refs such as
@OPENAI_API_KEYor@GOOGLE_APPLICATION_CREDENTIALSin those tool calls instead of recallingsecret_01. - Connected Codex CLI setups enable HASP agent-safe mode by default when
launched through a HASP wrapper or launcher, so
hasp secret get --revealand--copyare blocked inside protected workflows unless the operator first grants one-time plaintext access withhasp session grant-plaintext. - For stronger subprocess coverage, prefer launching Codex from
hasp agent shell codex-cliorhasp agent launch codex-cli -- <command>soHASP_AGENT_SAFE_MODEandHASP_SESSION_TOKENreach the whole agent process tree.
Convenience Path
- Use
hasp write-envonly for explicit repo-visible materialization. - Reuse depends on the same destination and the same canonical secret set. Alias names alone are not enough.
Failure Recovery
- Restart
hasp mcpif the stdio session stalls. - Rebind the repo if the project root changed and the daemon reports a root mismatch.
Known Caveats
- V1 uses local process-tree protection to prevent accidental exposure, not malicious same-user local processes.