Agents
Claude Code
Connect Claude Code through HASP as a brokered MCP surface.
Config Surface
- Prefer Claude Code's wrapper or launcher path when available; use HASP as the stdio MCP server underneath it.
- Canonical command:
hasp agent mcp claude-code
Config Example
{
"mcpServers": {
"hasp": {
"command": "hasp",
"args": ["agent", "mcp", "claude-code"]
}
}
}
Setup
- Bootstrap the local profile:
hasp bootstrap --profile claude-code --project-root <repo> --alias secret_01=<item> - Verify the broker:
printf '{"jsonrpc":"2.0","id":1,"method":"tools/list"}\n' | hasp agent mcp claude-code - Add the MCP entry shown above to Claude Code, or wire the same command into the wrapper or launcher path you already use.
Bootstrap may create a neutral repo alias such as secret_01, but daily
Claude Code usage should prefer the safe named ref form such as
@OPENAI_API_KEY. HASP resolves that named ref back to the repo binding
internally.
Design direction:
- the target top-level setup surface should be wrapper/launcher-first, with
hasp agent connect claudeas the desired top-level entry - profile bootstrap remains the current compatibility path for the shipped V1 runtime
Session Behavior
hasp agent mcp claude-codeauto-opens a daemon-backed session for the bound project when the caller does not provide one, and the wrapper or launcher path propagates the session token to subprocesses.- Use
hasp session openonly for debugging or when you intentionally want to inspect session state. - Long Claude Code runs should use broker-side
windowgrants, not repeated manual prompts.
Success Signal
- Claude Code lists
hasp_list,hasp_run,hasp_inject,hasp_capture,hasp_secret_add,hasp_secret_update,hasp_secret_delete,hasp_secret_get,hasp_secret_expose,hasp_secret_hide, andhasp_redact. hasp_listreturns only safe project-scoped metadata, including neutral aliases and named refs.
Safe Path
- Use
hasp_runfor command execution. - Use
hasp_injectfor broker-owned file materialization outside the repo. - Prefer named refs such as
@OPENAI_API_KEYor@GOOGLE_APPLICATION_CREDENTIALSwhen callinghasp_runorhasp_inject. - Use
hasp_secret_exposewhen the repo needs an existing personal-vault secret. - Use
hasp_secret_addwhen the user wants the agent to store a new secret and keep working in the same chat flow. - Connected Claude Code 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 Claude Code from
hasp agent shell claude-codeorhasp agent launch claude-code -- <command>soHASP_AGENT_SAFE_MODEandHASP_SESSION_TOKENreach the whole agent process tree.
Convenience Path
- Use
hasp write-envonly when a repo-visible env file is worth breaking the agent-safe guarantee. - Expect an explicit convenience approval and a warning when the destination is inside the bound project.
Failure Recovery
- If tools fail with a session error, restart the MCP server or rerun the Claude Code command so HASP can open a fresh session.
- If tools fail with an approval error, grant the project or secret window inside HASP and retry.
Known Caveats
- Raw
write-envoutput files are convenience materialization, not agent-safe broker flow. - Raw
hasp secret get --revealis blocked inside protected agent workflows unless the operator first grants one-time plaintext access withhasp session grant-plaintext. - V1 uses daemon-issued local sessions and local process-tree protection, not strong same-user local isolation.