Skip to content

feat: add Cline parser - #68

Open
Aryan1092raj wants to merge 14 commits into
Entelligence-AI:mainfrom
Aryan1092raj:feat/cline-parser
Open

Aryan1092raj wants to merge 14 commits into
Entelligence-AI:mainfrom
Aryan1092raj:feat/cline-parser

Conversation

@Aryan1092raj

@Aryan1092raj Aryan1092raj commented Nov 2, 2026 •

Copy link
Copy Markdown

Summary

Adds a Cline parser, so agentplay agents lists Cline and agentplay view shows its sessions. Closes #23.

The issue points at globalStorage/saoudrizwan.claude-dev/tasks/<id>/api_conversation_history.json. Current Cline keeps sessions in ~/.cline/data/sessions/<id>/ instead, for the CLI and the VS Code extension alike (the session metadata records source: "cli" or "vscode"). On my machine the old tasks/ folder holds only settings.json. I could check only the new layout against real data, so the old one is not supported.

 parsers/
+├── cline.py           # <id>.messages.json -> Session, Turn and tool spans
 _sources/local/
 ├── source.py          # + _index_cline_file: <home>/data/sessions/*/<id>.messages.json,
 │                      #   cwd from the sibling <id>.json
 tool_taxonomy.py       # + _CLINE: run_commands, shell -> Bash; read_files -> Read;
 │                      #   editor, edit -> Edit (Write when it creates a file);
 │                      #   search_codebase -> Grep; fetch_web_content -> WebFetch
 discover.py            # + Cline home ~/.cline, AGENTPLAY_CLINE_HOMES

Things a reviewer might trip on:

  • <id>.messages.json is one pretty-printed JSON document, not JSONL, so detect_agent cannot sniff it. The indexer checks the shape itself, as it does for Copilot-in-VS-Code .json sessions. detect_agent is unchanged.
  • agent_*.messages.json (spawned subagents) are skipped, not folded into the parent session.
  • inputTokens includes cache reads. Summed over a session, the message metrics equal the session metadata's usage.
  • A tool result is an error when is_error is set or any item has success: false.
  • A shell call can run several commands (18% of mine do), with one result item each. Each command becomes its own span with its own verb and status, and the call's time is split between them. Otherwise git add, git commit and git push in one call would show as git add.

Test plan

Before: agentplay agents has no Cline. After, on my own ~/.cline (70 sessions), agentplay build --agents cline builds 70 maps with 0 failures and skips 4 empty sessions. The maps hold 5,001 tool events (988 reads, 962 edits, 762 searches, 2,121 shell commands, 61 verify, 43 web, 10 subagent, 54 other) with 315 errors.

  • make check passes: ruff, tsc, 1,492 pytest, 354 vitest, check_clean.

  • New tests cover the parser (including a wrong-typed-field fuzz), indexing, discovery and map classification. There are two leak tests: one over the three fixtures, and one over a session seeded with secrets in prompts, command arguments, env assignments, paths, outputs and errors.

  • The fixtures are real sessions with every prompt, reply, thought, path, file content, command argument and output replaced by a placeholder. Ids, timestamps, models, token metrics, tool names, shell program names and success flags stay.

  • Not tested: the old tasks/ layout, Windows and macOS paths, and agentplay view in a browser (I checked the built maps and agentplay list).

  • make check passes

  • No prompt text, model output, tool input/output, file contents or command arguments can reach a map, a log line or the viewer (redaction contract)

  • No new network calls or Python runtime dependencies

@entelligence-ai-pr-reviews entelligence-ai-pr-reviews Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Entelligence: code quality 5/5 — Excellent.

@entelligence-ai-pr-reviews

entelligence-ai-pr-reviews Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

EntelligenceAI PR Summary

Adds Cline to agent discovery and session viewing, reading conversations from ~/.cline/data/sessions/<id>/ and using sibling metadata for the working directory. The parser converts prompts, assistant replies, tool calls, per-request token metrics, and failures into session spans; multi-command shell calls become individual events, and spawned-agent files are skipped.

flowchart TD
    classDef newBehavior fill:#dcfce7,stroke:#16a34a,color:#14532d;
    A["Cline session files"] --> B["Discover and index sessions"]
    A --> C["Read sibling metadata for cwd"]
    B --> D["Parse messages and pair tool results"]
    C --> D
    D --> E["Build session spans and tool events"]
    E --> F["List and view Cline sessions"]
    class A,B,C,D,E,F newBehavior;
Loading

🟢 Green = new or changed in this PR


Review Scorecard

Dimension Rating Basis
Code Quality ●●●●● 5/5 — Excellent no critical/significant findings — rated Excellent
Blast Radius Low changed symbols are referenced only within their own file(s); no high-impact surface touched, 7 file(s) / ~588 line(s) changed (size only — not a blast signal)
Merge Confidence ●●●●● 5/5 — Safe to Merge equals code quality; blast radius is shown for context only
Test Coverage — unavailable dependencies failed to install
Security Scan No findings on changed lines SonarQube · Semgrep · TruffleHog on 2 changed files

Safe to merge with a low blast radius; code quality rated Excellent (5/5): the review found nothing to flag.

Key Findings:

  • No critical or significant issues found
Evaluated against
  • 2/2 changed files reviewed
  • criteria: correctness, security & access control, robustness & error handling, concurrency & data integrity, repo conventions / steering docs
  • steering docs: none found in repo
  • PR checks: unit tests (unavailable) · security scan (SonarQube, Semgrep, TruffleHog on 2 changed files)

@entelligence-ai-pr-reviews

entelligence-ai-pr-reviews Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Walkthrough

Adds end-to-end support for ingesting Cline coding-agent sessions, from configurable home discovery and session indexing through parsing and tool classification. Documents the supported source and adds fixtures and tests for parsing, event generation, metadata propagation, and error handling.

Changes

Files

  • README.md
  • python/src/agentplay/discover.py

Documents Cline session locations, parsing and error behavior, and the AGENTPLAY_CLINE_HOMES configuration. Adds Cline to supported transcript sources and discovers configured homes, defaulting to ~/.cline.

Files

  • python/src/agentplay/_core/ingestion/coding_agent/_sources/local/parsers/__init__.py
  • python/src/agentplay/_core/ingestion/coding_agent/_sources/local/parsers/base.py
  • python/src/agentplay/_core/ingestion/coding_agent/_sources/local/parsers/cline.py
  • python/src/agentplay/_core/ingestion/coding_agent/_sources/local/source.py
  • python/src/agentplay/_core/ingestion/coding_agent/tool_taxonomy.py

Adds the Cline agent type and exports a parser that builds session, turn, and tool spans with timestamps, token usage, metadata, and edit evidence. Local source discovery indexes valid Cline sessions, excludes spawned-agent files, propagates metadata-derived working directories, and uses Cline tool aliases to normalize tools for downstream classification.

Files

  • python/tests/core/fixtures/cline/edit_and_read.messages.json
  • python/tests/core/fixtures/cline/failed_shell.messages.json
  • python/tests/core/fixtures/cline/read_search_edit.messages.json

Adds sanitized session fixtures covering image input, file reads and edits, searches, multi-command shell calls, tool failures, timestamps, model metadata, and token metrics.

Files

  • python/tests/core/test_cline_parser.py
  • python/tests/core/test_local_source_cline.py
  • python/tests/core/test_tool_taxonomy.py

Adds parser, source integration, and taxonomy coverage for span structure, tool normalization, shell command status and timing, token accounting, malformed input, event generation, redaction, discovery, metadata propagation, and failure handling.

Comment thread python/tests/core/test_cline_parser.py Resolved

@entelligence-ai-pr-reviews entelligence-ai-pr-reviews Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Entelligence: code quality 5/5 — Excellent.

Comment thread python/tests/core/test_cline_parser.py Resolved

@entelligence-ai-pr-reviews entelligence-ai-pr-reviews Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Entelligence: code quality 5/5 — Excellent.

This branch has not been deployed

No deployments
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.

Add a parser for Cline

1 participant