headless-claude: Additional Agent SDK improvements #3
Labels
No Label
ai-changes-requested
ai-failed
ai-pr-opened
ai-reviewed
ai-reviewing
ai-working
infra-audit
monitoring
operations
proxmox
script
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: cal/claude-home#3
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Context
Project:
/mnt/NV2/Development/headless-claude/After reviewing the updated Claude Code Agent SDK documentation, we identified several improvement opportunities beyond the two already implemented (
--json-schemafor structured output and tighter--allowedToolsprefix matching).Recommendations
1. Use
--append-system-promptfor role injectionRather than relying entirely on the skill's
SKILL.mdbeing auto-loaded, inject critical context directly into the system prompt:This ensures consistent behavior regardless of skill loading order and provides a safety net.
2. Session resumption for escalation workflows
Use
--resume <session_id>to continue diagnostic conversations across invocations. This enables:Pattern:
3. Evaluate the Python/TypeScript Agent SDK
The docs now offer native Python/TypeScript packages (
from claude_code import Claude) as an alternative to CLI invocation. If n8n's Code node or a custom n8n node is ever used, this would be cleaner than SSH-to-CLI shell invocation and offers:Reference: https://platform.claude.com/docs/en/agent-sdk/overview
Priority
Medium — current system works well. These are quality-of-life improvements for Phase 2/3.
Implementation Status
Recommendation 1:
--append-system-promptfor role injectionStatus: Already implemented ✅
This is already in production use across all live claude-scheduled scripts:
runner.sh:105— injects task name and date contextissue-poller.sh:299,674— injects autonomous worker rolepr-reviewer-dispatcher.sh:327— injects reviewer roleThe legacy n8n workflow has also been updated to include
--append-system-promptin the SSH invocation node.Recommendation 2: Session resumption with
--resumeStatus: Implemented ✅
runner.sh — Opt-in session persistence via two new
settings.jsonfields:session_resumable: true— enables session persistence and savessession_idto$LOG_DIR/last_session_idresume_last_session: true— resumes the previous session on the next run via--resume--no-session-persistence)issue-poller.sh — Captures
session_idfrom worker output and includes it in:session_id=...)pr-reviewer-dispatcher.sh — Same pattern: captures and logs
session_id.n8n workflow — Added two new nodes:
--resumefor deeper investigation when issues are foundRecommendation 3: Evaluate Python/TypeScript Agent SDK
Status: Evaluation complete ✅
Research document written at
scheduled-tasks/agent-sdk-evaluation.md.Recommendation: Stay with CLI invocation for now.
Key blocker: The SDK requires
ANTHROPIC_API_KEY(per-token billing), while our entire framework runs on Claude Max OAuth at zero marginal cost. The CLI now covers all our needs with--append-system-prompt,--resume,--json-schema, and--allowedTools.Revisit when: OAuth support is added to the SDK, or we need dynamic tool approval / in-process hooks.
Branch:
feature/3-agent-sdk-improvements