Skip to content

feat(cli): remove prompt subcommand + add agentv import claude#880

Merged
christso merged 6 commits intomainfrom
feat/import-claude
Mar 31, 2026
Merged

feat(cli): remove prompt subcommand + add agentv import claude#880
christso merged 6 commits intomainfrom
feat/import-claude

Conversation

@christso
Copy link
Copy Markdown
Collaborator

Summary

  • Remove prompt subcommand: Deletes agentv prompt / agentv eval prompt and all associated code, tests, and references
  • Add agentv import claude: New transcript import pipeline that reads Claude Code session JSONL files (~/.claude/projects/) and converts them to AgentV's Message[] format for offline grading without re-running the agent

New modules

  • packages/core/src/import/types.tsTranscriptEntry, TranscriptSource interfaces + readTranscriptFile helper
  • packages/core/src/import/claude-parser.ts — Claude Code JSONL parser (user/assistant events, tool_use/tool_result extraction, usage aggregation, streaming dedup)
  • packages/core/src/import/session-discovery.tsdiscoverClaudeSessions() scans ~/.claude/projects/ with filtering by session ID, project path, and latest
  • apps/cli/src/commands/import/claude.ts — CLI handler with --session-id, --discover latest, --project-path, --output, --list
  • apps/cli/src/commands/import/index.ts — subcommand registration

CLI usage

# List available sessions
agentv import claude --list

# Import the most recent session
agentv import claude --discover latest

# Import a specific session
agentv import claude --session-id <uuid>

# Filter by project path
agentv import claude --discover latest --project-path /home/user/myproject

Ref: #872

Test plan

  • bun run build — clean compilation
  • bun test — all 1301 core tests pass, 9 preprocess-argv tests pass
  • agentv import claude --help — shows expected options
  • agentv import claude --discover latest — discovers and imports a real session
  • agentv prompt — fails with "Not a valid subcommand name"
  • agentv eval prompt — falls through to eval run (expected)

🤖 Generated with Claude Code

christso and others added 3 commits March 31, 2026 08:52
The `prompt` subcommand (agentv prompt / agentv eval prompt) is no
longer used. Remove the command, its tests, and all references from
the CLI registration and preprocessArgv logic.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add a transcript import pipeline that reads Claude Code session JSONL
files (~/.claude/projects/) and converts them to AgentV's Message[]
format for offline grading without re-running the agent.

New modules:
- packages/core/src/import/types.ts — TranscriptEntry, TranscriptSource
- packages/core/src/import/claude-parser.ts — Claude JSONL parser
- packages/core/src/import/session-discovery.ts — session discovery
- apps/cli/src/commands/import/claude.ts — CLI handler
- apps/cli/src/commands/import/index.ts — subcommand registration

Supports --session-id, --discover latest, --project-path, --list,
and --output flags.

Ref: #872

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Fix biome lint/format issues: import ordering, template literals,
non-null assertion, and describe block indentation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages bot commented Mar 31, 2026

Deploying agentv with  Cloudflare Pages  Cloudflare Pages

Latest commit: 756f090
Status: ✅  Deploy successful!
Preview URL: https://0e8b282c.agentv.pages.dev
Branch Preview URL: https://feat-import-claude.agentv.pages.dev

View logs

christso and others added 3 commits March 31, 2026 11:13
…de parser

Fix three critical bugs found during code review:

1. tool_result blocks appear in user events, not assistant events —
   restructure parser to pair tool_use IDs from assistant events with
   tool_result blocks in subsequent user events
2. Token usage is cumulative per requestId — only keep the last value
   per requestId instead of summing all streaming updates
3. User events containing only tool_result content were silently
   dropped — now properly processed

Also fixes: subagent filtering (isSidechain), timestamp tracking from
all events for accurate duration, and requestId added to ClaudeEvent
interface (removing unsafe cast).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Remove all `agentv prompt eval` / `agentv eval prompt` references
  from running-evals.mdx, agent-skills-evals.mdx, and
  skill-improvement-workflow.mdx
- Add tools/import.mdx documenting the new `agentv import claude`
  command with all flags and output format
- Update code-graders.mdx: replace deprecated field names
  (output_text → output, input_text → input, expected_output_text →
  expected_output) in contract, examples, and advanced fields table
- Update defineCodeGrader SDK examples to use current API (output
  as Message[], not outputText string)
- Add examples/features/import-claude/ with README, eval YAML, and
  transcript-quality code grader

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- running-evals.mdx: add "Offline Grading" section pointing to
  agentv import + transcript workflow
- skill-improvement-workflow.mdx: remove stale bun scripts/prompt-eval.ts
  block (scripts never existed)
- agentv-eval-writer/SKILL.md: replace agentv prompt eval commands
  with agentv eval assert and agentv import claude
- migrating-from-skill-creator.md: replace agentv prompt eval and
  stale bun scripts references

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@christso christso marked this pull request as ready for review March 31, 2026 12:31
@christso christso merged commit c00eceb into main Mar 31, 2026
4 checks passed
@christso christso deleted the feat/import-claude branch March 31, 2026 12:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant