Agents
Codex CLI
Connect Codex CLI to HASP as a brokered MCP surface so it can run with project secrets without ever reading their plaintext values.
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 default tool surface lists
hasp_list,hasp_targets,hasp_target_explain,hasp_run,hasp_inject,hasp_secret_get, 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. - When
.hasp.manifest.jsondefines targets, callhasp_targetsfirst and preferhasp_runorhasp_injectwithtargetover raw broad mappings. - If the repo has no manifest yet, create a value-free template with
hasp template add <target> --env NAME=@NAME -- <command>when local edits are allowed. Do not put raw values in.hasp.manifest.json. - Before first use of a repo-controlled target command, inspect with
hasp run --target <target> --explain --dry-run, then runhasp template review <target>. Brokered target execution fails until the local review signature exists and is current. - Prefer named refs such as
@OPENAI_API_KEYor@GOOGLE_APPLICATION_CREDENTIALSin those tool calls instead of recallingsecret_01. - Default Codex CLI MCP cannot auto-expose existing vault items. Ask the
operator to run
hasp secret expose NAME --project-root <repo>, or use a trusted local harness with unsafe tools enabled andhasp session grant-mutation. - 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.