claude-devtools:chatgroup-architecture

A technical guide to how conversation records move from raw JSONL files—one JSON object per line—to the chat groups shown in the app.

In plain words
What is it for?
Use it when working on user, AI, system, or compact groups; message chunks; tool links; display items; or the rendering hierarchy.
Why use it?
It removes guesswork when changing conversation parsing or display code by showing how messages are classified, combined, linked to tools, and rendered.

Command for Claude Code

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/matt1398/claude-devtools/chatgroup-architecture
Clone the repo
git clone --depth 1 https://github.com/matt1398/claude-devtools

Made for: Claude Code.

Per session 53 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,983 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00053 $0.02983
Opus 5 $0.00026 $0.01491
Sonnet 5 $0.00011 $0.00597
Haiku 4.5 $0.00005 $0.00298

Measured yesterday against content hash 5eca85da99a7, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

claude-devtools:chatgroup-architecture scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/commands/devtools/chatgroup-architecture.md · 390 lines

How it starts

The opening of the file, as written. The whole thing — 390 lines — stays where its author put it; the contents beside it link to each section on GitHub.

ChatGroup Architecture

How conversation data flows from raw JSONL messages to rendered chat groups.

Core Design Principle

Chat groups are independent items in a flat chronological list, not paired turns. There is no UserTurn/AITurn pairing — each group stands alone.

// src/renderer/types/groups.ts
export type ChatItem =
  | { type: 'user'; group: UserGroup }
  | { type: 'system'; group: SystemGroup }
  | { type: 'ai'; group: AIGroup }
  | { type: 'compact'; group: CompactGroup };

export interface SessionConversation {
  sessionId: string;
  items: ChatItem[];  // Flat chronological list
  totalUserGroups: number;
  totalSystemGroups: number;
  totalAIGroups: number;
  totalCompactGroups: number;
}

Pipeline Overview

Raw JSONL messages
  → MessageClassifier (classify into user/system/ai/hardNoise)
  → ChunkBuilder (buffer AI messages, flush on user/system boundary)
  → ChunkFactory (build EnhancedAIChunk with SemanticSteps)
  → groupTransformer (chunks → flat ChatItem[] conversation)
  → aiGroupEnhancer (AIGroup → EnhancedAIGroup with displayItems, linkedTools, lastOutput)
  → React components render

Primary source files:

  • src/main/services/parsing/MessageClassifier.ts
  • src/main/services/analysis/ChunkBuilder.ts
  • src/main/services/analysis/ChunkFactory.ts
  • src/renderer/utils/groupTransformer.ts
  • src/renderer/utils/aiGroupEnhancer.ts
  • src/renderer/utils/displayItemBuilder.ts
  • src/renderer/types/groups.ts
  • src/main/types/chunks.ts

Data Models

UserGroup

// src/renderer/types/groups.ts
interface UserGroup {
  id: string;
  message: ParsedMessage;
  timestamp: Date;
  content: UserGroupContent;
  index: number;  // Ordering index within session
}

interface UserGroupContent {
  text?: string;                 // Plain text (commands removed)
  rawText?: string;              // Original text
  commands: CommandInfo[];       // Extracted /commands
  images: ImageData[];           // Attached images
  fileReferences: FileReference[]; // @file.ts mentions
}

Read the full file on GitHub · 390 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 390 lines · 53 tokens per session scan A 5eca85da99a7

Subscribe to this mod's changes

claude-devtools:chatgroup-architecture is a command published in the GitHub repository matt1398/claude-devtools (3,885 stars, last pushed 3mo ago), licensed MIT. It adds 53 tokens to every session and 2,983 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.