Documentation
¶
Overview ¶
Package claude is the Claude Code adapter: it starts sessions with claude -p and streamed JSON output, optionally under an id assigned by whoever starts them (--session-id, so the session keeps its log) or continuing one (--resume <id>, which works with -p, as claude --help shows, in the same directory the session ran in), and reads the result, the tokens and what the session cost from the stream. It warns when ANTHROPIC_API_KEY would take over the login, and names it when claude reports an invalid key. Its sessions' logs are read by claudelog.
Index ¶
Constants ¶
const Name = "claude-code"
Name is the agent's name as Physa records it.
Variables ¶
This section is empty.
Functions ¶
func InSession ¶
InSession reports whether the environment getenv reads marks the process as running inside a Claude Code session: CLAUDECODE or CLAUDE_CODE_SESSION_ID set to a non-empty value. The caller passes the environment's lookup, so the answer can be tested without the real environment.
func SettingsFile ¶ added in v0.0.17
SettingsFile is where Claude Code reads a person's own settings, under the person's home, including the hooks it runs at the start of every session. Like SkillFile, it does not follow CLAUDE_CONFIG_DIR.
Types ¶
type Adapter ¶
type Adapter struct {
// Command is the claude command to run; empty means "claude" on PATH.
Command string
// Getenv reads the environment sessions inherit; nil means os.Getenv.
Getenv func(string) string
}
Adapter runs sessions with the Claude Code command.
func (*Adapter) Start ¶
Start runs claude -p in s.Dir with the prompt on stdin. An assigned session id that is not a UUID, and a resume without one, are refused before anything runs.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package claudelog is the Claude Code adapter's reader of session logs: it finds a session's transcript under Claude Code's config directory and returns what learning needs from it and its subagents, redacted, never writing anything there.
|
Package claudelog is the Claude Code adapter's reader of session logs: it finds a session's transcript under Claude Code's config directory and returns what learning needs from it and its subagents, redacted, never writing anything there. |