Skip to content

feat: add CHAINLOOP_AI_CODING_SESSION material type#2936

Merged
jiparis merged 5 commits intochainloop-dev:mainfrom
jiparis:jiparis/ai-coding-session-type
Mar 26, 2026
Merged

feat: add CHAINLOOP_AI_CODING_SESSION material type#2936
jiparis merged 5 commits intochainloop-dev:mainfrom
jiparis:jiparis/ai-coding-session-type

Conversation

@jiparis
Copy link
Member

@jiparis jiparis commented Mar 25, 2026

Summary

  • Add new CHAINLOOP_AI_CODING_SESSION material type (enum value 29) for capturing AI coding session telemetry
  • Includes JSON schema validation for session data (agent info, session timing, code changes, token usage, model info, raw conversation data)
  • Surfaces agent name and primary model as material annotations
  • Follows the same chainloop custom type wrapper pattern ({"chainloop.material.evidence.id": "...", "data": {...}}) used by CHAINLOOP_AI_AGENT_CONFIG
✗ cldev att add --kind CHAINLOOP_AI_CODING_SESSION --value /Users/jiparis/Downloads/chainloop-trace-3764001225\ \(2\).json
...
INF uploading chainloop-trace-3764001225 (2).json - sha256:474c5b7868c64b310a4f587a3a0025db7111c3cfe461721a8abfe17de5497b8e
...
INF material added to attestation
...
┌─────────────┬─────────────────────────────────────────────────────────────────────────┐
│ Name        │ material-1774468048181707000                                            │
├─────────────┼─────────────────────────────────────────────────────────────────────────┤
│ Type        │ CHAINLOOP_AI_CODING_SESSION                                             │
├─────────────┼─────────────────────────────────────────────────────────────────────────┤
│ Required    │ No                                                                      │
├─────────────┼─────────────────────────────────────────────────────────────────────────┤
│ Value       │ chainloop-trace-3764001225 (2).json                                     │
├─────────────┼─────────────────────────────────────────────────────────────────────────┤
│ Digest      │ sha256:474c5b7868c64b310a4f587a3a0025db7111c3cfe461721a8abfe17de5497b8e │
├─────────────┼─────────────────────────────────────────────────────────────────────────┤
│ Annotations │ ------                                                                  │
├─────────────┼─────────────────────────────────────────────────────────────────────────┤
│             │ chainloop.material.aiagent.name: claude-code                            │
├─────────────┼─────────────────────────────────────────────────────────────────────────┤
│             │ chainloop.material.aiagent.model: claude-opus-4-6                       │
├─────────────┼─────────────────────────────────────────────────────────────────────────┤
│             │ chainloop.material.size: 11265                                          │
└─────────────┴─────────────────────────────────────────────────────────────────────────┘

Test plan

  • Constructor tests (correct type, wrong type)
  • Schema validation tests (valid full, valid minimal, missing required fields, missing session, missing agent name)
  • Invalid JSON, invalid schema, file not found tests
  • Extra fields rejection test
  • Annotation extraction tests (with model, without model)
  • Full materials test suite passes with no regressions

Add a new material type for capturing AI coding session telemetry
including agent info, session timing, code changes, token usage, model
info, and raw conversation data. Follows the same chainloop custom
type wrapper pattern used by CHAINLOOP_AI_AGENT_CONFIG.

Signed-off-by: Jose I. Paris <jiparis@chainloop.dev>
Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 24 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="internal/schemavalidators/internal_schemas/aicodingsession/ai-coding-session-0.1.schema.json">

<violation number="1" location="internal/schemavalidators/internal_schemas/aicodingsession/ai-coding-session-0.1.schema.json:54">
P2: `session.ended_at` allows empty strings, so invalid timestamp values can pass validation.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

jiparis added 2 commits March 25, 2026 21:10
Signed-off-by: Jose I. Paris <jiparis@chainloop.dev>
Rename material.aicoding.model to material.aiagent.model for
consistency with the existing material.aiagent.name annotation.

Signed-off-by: Jose I. Paris <jiparis@chainloop.dev>
jiparis added 2 commits March 26, 2026 08:44
…erials

Extract the envelope schema field as a chainloop.material.evidence.schema
annotation, consistent with the evidence material type.

Signed-off-by: Jose I. Paris <jiparis@chainloop.dev>
Signed-off-by: Jose I. Paris <jiparis@chainloop.dev>
@jiparis jiparis force-pushed the jiparis/ai-coding-session-type branch from 19b5893 to 6ebc120 Compare March 26, 2026 08:16
@jiparis jiparis merged commit 300adaf into chainloop-dev:main Mar 26, 2026
14 checks passed
@jiparis jiparis deleted the jiparis/ai-coding-session-type branch March 26, 2026 10:13
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.

2 participants