feat: observer CLI — canonicalization, boundaries, hooks, setup - #816
Open
davidmiuraactualai wants to merge 18 commits into
Open
feat: observer CLI — canonicalization, boundaries, hooks, setup#816davidmiuraactualai wants to merge 18 commits into
davidmiuraactualai wants to merge 18 commits into
Conversation
Introduces an ephemeral OAuth flow that authenticates without storing a refresh token, then calls POST /repos/onboard-public to queue a public repository for architecture analysis. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…es 1C, 4A, 4C) Phase 1C: `actual observe` subcommand with 8 hook types (session-start, prompt, pre-tool, post-tool, post-tool-failure, stop, session-end, pre-compact). Deterministic canonicalization, JSONL session journal, typed hook payloads. Phase 4A: Evaluation boundary detection — PreToolUse(Edit|Write), PostToolUseFailure, Stop are boundaries. Hook output builder for silent/inform/warn/block dispositions with Claude Code hook contract. Phase 4C: `actual observe setup` installs 8 hooks into .claude/settings.json additively (preserves existing hooks, idempotent). `actual observe status` reports hook installation state. 50 tests across boundary, canonicalize, hook_output, journal, types, and setup modules. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Claude Code validates hooks as {matcher, hooks: [{type, command}]},
not flat {type, command} entries. Fixes settings validation error
on session start.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
At evaluation boundaries (file edits, tool failures, session stops), the observer now loads stored credentials, reads journal events, and POSTs to the advisor intervention API. Non-boundary hooks remain zero-latency. Any error degrades silently to empty hook output. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
When a JSONL line fails to parse, print a warning to stderr with the line number and error before skipping, so users know an event was lost. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The advisor intervention endpoint requires the observe:events scope, but the CLI login flow only requested adr:query and adr:review. Without this scope, observer boundary evaluations get 403 from the API. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add app_url parameter to loopback server success page - Thread base_url from config to both login_with and login_ephemeral - Show styled "Open web app" button on the signed-in callback page - Add reset command stub and CLAUDE.md updates Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The API only accepts HTTPS URLs, but users naturally pass SSH URLs (git@github.com:owner/repo.git). Convert at the CLI boundary so both formats work seamlessly. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The API's onboard-public endpoint now handles SSH URLs directly, so the CLI passes the user's URL as-is. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Checks service ports (Supabase, Temporal, Redis, API, Next.js), env files, .next cache health, Python venv, and key env vars. Outputs numbered copy-paste fix commands for any failures. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Check login status, token expiry, and permission scopes. Displays auth state before services section so users see credential issues first. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
UserPromptSubmit triggers advisor evaluation for substantial prompts (>= 20 chars), filtering out short confirmations like "yes" or "ok". Agent PreToolUse (launch) is a conditional boundary requiring a description or prompt. Agent PostToolUse (return) is unconditional. New AEWO codes: actual.event.agent.delegated and actual.event.agent.returned for orchestration classification. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The observe command loaded stored credentials but never checked if the access token was expired. When the token expired, the API returned 401 which degraded to silent — effectively disabling all boundary evaluations without any clear signal to the user. Add ensure_fresh() (matching the advisor command's existing pattern) to refresh the access token via the OAuth refresh flow before making the API call. When no refresh token is available, fail explicitly with NotLoggedIn so the error message tells the user to re-login. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace internal dev stack checks (Supabase ports, Redis, pnpm monorepo, .next cache, Python venv, env vars) with checks relevant to any user: - Authentication: signed in, token not expired, required scopes - Repository: inside a git repo with an origin remote - Observer: hooks installed (project or global .claude/settings.json) - Connectivity: configured API endpoint is reachable The command now works correctly from any repo, not just the sprintreview monorepo. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
CLI now chunks events into batches of 50 at evaluation boundaries, sends each chunk sequentially (blocking), and merges all non-silent responses ranked by severity (block > warn > inform) into a single combined hook_output. This prevents HTTP 413s, avoids Claude Code timeouts, and ensures no interjection is missed across chunks. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The advisor pipeline takes 2-4+ minutes for deep agent LLM round-trips. The 10s timeout was causing the CLI to give up before the workflow completed. Set to 480s (8min) to fit inside the 10min Claude Code hook timeout, with the API safety timeout at 7.5min nested inside. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Hook timeout 600s → 1200s to accommodate 15min API pipeline timeout - Add SubagentStart hook event and subagent-tool CLI subcommand - Inject hookEventName into hook output for Claude Code validation - Update tests for 9 hooks and 1200s timeout assertion Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
actual observesubcommand with 8 hook types, deterministic canonicalization via AEWO event codes, JSONL session journal at~/.actualai/actual/sessions/, typed hook payloads{}, inform/warn/block→hookSpecificOutput.additionalContext)actual observe setup— additive hook installation into.claude/settings.json(preserves existing hooks, idempotent, atomic writes).actual observe statusfor hook state reportingTest plan
cargo testall greencargo clippyclean🤖 Generated with Claude Code