Skip to content

About

The funniest moments, catchphrases and plot twists from your AI coding sessions.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

Β 

History

112 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Agent Wrapped

Turn long AI coding sessions into a playful highlight reel.

Instead of only counting tokens and tool calls, Agent Wrapped looks for the parts people actually remember:

  • πŸ† Memorable quotes β€” dramatic lines such as β€œMajor discovery!!! Our whole approach was wrong!”
  • πŸ“’ Catchphrases β€” repeated phrases and verbal habits across a session
  • 🀑 Boomerangs β€” confident claims that get reversed later
  • 🐺 Called-it-too-early moments β€” repeated declarations that the root cause was found
  • 🧠 Plot twists β€” sudden changes of direction, realizations, and self-corrections
  • 🍾 Premature celebrations β€” victory laps that get overturned a few messages later
  • 🎬 Story + session persona (experimental) β€” grounded multi-step stories and a session-scoped character read from observable behavior
  • πŸ“Š Session / weekly / monthly Wrapped β€” later, compare patterns across sessions and agents

Goal

Agent Wrapped is intentionally entertainment-first. It should feel more like an awards show for your AI sessions than another productivity dashboard.

P0–P7 remain the local quote/moment pipeline. Experimental P8 adds a second, event-first story route so a hilarious tool sequence can be discovered even when no individual assistant sentence was ranked as a Moment:

Host session logs
  ↓
Session ingestion
  ↓
Observable SessionEvent[] ───────────────────────────────┐
  β”‚                                                     β”‚
  β”œβ”€ text route                                         β”œβ”€ story route
  β”‚   ↓                                                 β”‚   ↓
  β”‚ TranscriptMessage[]                                 β”‚ bounded story windows
  β”‚   ↓                                                 β”‚   ↓
  β”‚ P0 EventExtractor                                   β”‚ redact secrets / identity
  β”‚   ↓                                                 β”‚   ↓
  β”‚ P1 MomentGraph                                      β”‚ LLM-A: Story Miner
  β”‚   ↓                                                 β”‚ structure only
  β”‚ P2 MomentBuilder                                    β”‚   ↓
  β”‚   ↓                                                 β”‚ local grounding / validation
  β”‚ P3 MomentRanker                                     β”‚   ↓
  β”‚   ↓                                                 β”‚ VerifiedStoryArc[]
  β”‚ P3.5 AwardComposer                                  β”‚   ↓
  β”‚   ↓                                                 β”‚ deterministic Persona Aggregator
  β”‚ P4 WrappedReport                                    β”‚   ↓
  β”‚                                                     β”‚ LLM-B: Narrator
  β”‚                                                     β”‚ editorial language only
  └──────────────────────────→ final presentation β†β”€β”€β”€β”€β”€β”€β”˜
                                  ↓
                       πŸ† awards + 🎬 story + 🎭 persona

A P3 Moment can help P8 choose context, but it is only a secondary hint. It is no longer the gate that decides what the story model is allowed to see.

Architecture status

  • βœ… P0 β€” Event model + EventExtractor: unified multi-label text events, topics, claims/stance, verbal families, drama and standalone-quality signals.
  • βœ… P1 β€” Moment Graph: repeats, similar_to, same_topic, contradicts, retracts, followed_by, and celebrates_before relations.
  • βœ… P2 β€” MomentBuilder: composes graph structure into one_liner, repeated_pattern, boomerang, false_dawn, plot_twist, and correction_arc moments.
  • βœ… P3 β€” MomentRanker: ranks complete moments with separate funScore and confidence, plus standalone quality, context payoff, surprise, rarity, readability, and structural strength.
  • βœ… P3.5 β€” AwardComposer: protects the core quote/repetition/boomerang slots, fills remaining slots with strong side moments, deduplicates overlapping views, and does not force weak cards.
  • βœ… P4 β€” WrappedReport / output: runs P0β†’P3.5 end to end and preserves original source wording.
  • βœ… P5 β€” Session ingestion: host-neutral IngestedSession; current DeepSeek Harness JSONL/Zstandard support. DSH now also recovers observable tool/call, tool/result, and turn/end records into a host-neutral SessionEvent[] stream.
  • βœ… P6 β€” Real-session evaluation / calibration: bounded human-review cases, deterministic A/B comparisons, keep/drop/skip, fun ratings and missed moments.
  • βœ… P7 β€” Local Evaluation Runner: resumable workspace/CLI with review-protocol + locale isolation and language-bias safeguards.
  • πŸ§ͺ P8 v2 β€” Story + session persona: opt-in, event-first, two-pass semantic architecture. Story Miner proposes structure, local code validates it, persona signals are aggregated deterministically, and a second narrator may only write editorial titles/commentary/nicknames.

P7 quick start

npm run build

# Prepare newest real DSH sessions.
node dist/cli.js dsh --latest 30

# Review one session at a time, or use --all.
node dist/cli.js review
node dist/cli.js review --all

# Inspect progress/calibration.
node dist/cli.js status
node dist/cli.js calibration

When installed as a package/bin:

agent-wrapped dsh --latest 30
agent-wrapped review
agent-wrapped calibration

The default workspace is $AGENT_WRAPPED_HOME/review-workspace.json, falling back to ~/.agent-wrapped/review-workspace.json. It stores evaluation cases and human review data, not copies of full DSH transcripts.

P7 protocol v2 binds judgments to both the review protocol and presentation locale. Changing the candidate set, protocol, or locale invalidates incompatible labels rather than mixing them. In zh-CN, an incompletely localized English A/B pair is automatically skipped instead of measuring English-reading friction.

See docs/p7-local-review-runner.md for the review protocol and storage behavior.

Experimental P8 v2: story + session persona

P8 accepts that β€œε‰§ζƒ… + 人格” is genuinely semantic, but it does not hand the entire transcript to an LLM and hope for a funny summary.

1. Observable event stream first

Host adapters normalize what actually happened into SessionEvent[]:

user_message
assistant_text
tool_call
tool_result / tool_error
turn_end

For DSH, tool/call, tool/result, and turn/end are now read from the durable session log. This lets P8 see stories such as:

attempt delete
β†’ permission error
β†’ switch to another tool
β†’ success

That story can be discovered even if P0–P3 found no funny assistant quote.

2. Bounded story windows, not the full transcript

Local code selects a small set of event windows around structural signals such as tool failures, user pushback, assistant corrections and turn failures. A small number of coverage windows is also sampled so Story Discovery is not entirely gated by hand-written cues.

P3 Moments are included only as secondary attention hints.

Before a remote semantic call, common secrets and identity-bearing text are redacted, including bearer tokens, common API-key/token forms, email addresses and home-directory usernames. Evidence is also capped by event count, per-event characters and total characters.

3. LLM-A: Story Miner outputs structure only

The first semantic pass may propose only a controlled structure such as:

{
  "arcKind": "failure_then_workaround",
  "beats": [
    { "kind": "attempt", "evidenceIds": ["event:..."] },
    { "kind": "failure", "evidenceIds": ["event:..."] },
    { "kind": "workaround", "evidenceIds": ["event:..."] }
  ],
  "confidence": "high"
}

It is not allowed to write the story title, comedy copy, persona, or 0–100 scores.

4. Local grounding validates more than β€œthe ID exists”

Before any generated story can reach presentation, local code verifies:

  • every cited event exists;
  • beats are in chronological order;
  • the cited actor/event type can support that beat (user_pushback must cite a user event, failure must cite a failure-like event, etc.);
  • the requested arc shape is actually present, for example failure before workaround.

Candidates that fail these checks are dropped instead of being narrated.

5. Persona is aggregated locally

Persona does not come from an LLM inventing β€œε†…εΏƒζˆ 82/100”. Agent Wrapped derives coarse observed signals from verified stories + grounded Moments, for example:

ε†…εΏƒζˆ        high Β· 3
θ‡ͺζˆ‘ηΊ ι”™      medium Β· 2
执着程度      high Β· 4
δΈ΄εœΊε˜ι€š      low Β· 1

The exact thresholds are local and reproducible. These are session behavior signals, not claims that a model has an inherent personality.

6. LLM-B: Narrator does editorial language only

After structure and persona signals are fixed, the second optional pass may write only:

  • a title for each verified story;
  • clearly labeled θ΅›εŽθ§£θ―΄ editorial commentary;
  • a session-scoped persona nickname/tagline such as ζœ¬εœΊθ‘¨ηŽ°εƒβ€¦β€¦.

It cannot add another tool result, user reaction, accident or source quote. Story facts stay in the verified structure.

Try the newest DSH session

No endpoint is assumed. Configure any OpenAI-compatible endpoint explicitly:

export AGENT_WRAPPED_LLM_BASE_URL="https://your-endpoint.example/v1"
export AGENT_WRAPPED_LLM_MODEL="your-model"
export AGENT_WRAPPED_LLM_API_KEY="..."   # optional for local endpoints

npm run story:latest

Optional knobs:

export AGENT_WRAPPED_LOCALE=zh-CN
export AGENT_WRAPPED_TOP_MOMENTS=6
export AGENT_WRAPPED_LLM_JSON_MODE=1
# Only when the host actually exposed reasoning to the user:
export AGENT_WRAPPED_INCLUDE_REASONING=1

story:latest prints the number of bounded events/windows, secondary Moment hints, redaction count and truncation state before semantic generation. A normal P8 v2 run may make two semantic calls: Story Miner, then Narrator after local validation. The full DSH transcript is not included in either request.

P8 is still experimental and is not part of P7 calibration yet.

Public APIs

Analysis-only Moment Engine:

const moments = analyzeMoments(messages);

Complete local Wrapped:

const report = createWrappedReport(messages, {
  awards: { maxAwards: 5 },
});

console.log(renderWrappedText(report));

Current DeepSeek Harness local sessions:

const sessions = await loadDshSessions({ maxSessions: 20 });
const report = createWrappedReport(sessions[0].messages);

P6/P7 calibration:

const refreshed = await refreshLocalDshReviewWorkspace({
  ingest: { maxSessions: 50 },
  evaluation: { topMoments: 8, maxPairwiseTasks: 12 },
  reviewLocale: "zh-CN",
});

const calibration = calibrateReviewWorkspace(refreshed.workspace);

P8 v2:

const { narrator } = createOpenAICompatibleNarratorFromEnv();
const { report, evidence } = await generateSemanticStoryPersona(
  session,
  narrator,
  { topMoments: 6 },
);

console.log(renderSemanticStoryPersonaText(report, evidence));

Existing QuoteScorer, CatchphraseClusterer, BoomerangDetector, FacetScorer, and SessionAnalyzer APIs remain compatibility surfaces while new work uses the Moment Engine.

Host coverage

  • βœ… DeepSeek Harness β€” current durable JSONL/Zstandard format, including tool calls/results and turn outcomes
  • ⏭️ Claude Code β€” next adapter
  • ⏭️ OpenAI Codex β€” next adapter
  • ⏭️ OpenCode β€” later

The host-neutral boundaries are now both TranscriptMessage[] for the local text/Moment route and SessionEvent[] for observable story behavior. A new host adapter should normalize into those shared contracts instead of leaking host-specific event semantics into P8.

Design principles

  1. Local-first by default. P0–P7 work without another LLM call. P8 is explicit opt-in and has no default network endpoint.
  2. Use only exposed / observable session data. Agent Wrapped does not attempt to recover hidden chain-of-thought.
  3. Original wording matters. Source quotes stay source quotes; editorial narration is visibly labeled as narration.
  4. Fun before analytics. Token charts are optional; memorable moments are the product.
  5. Cross-agent core. Core event, moment, story and evaluation concepts stay independent from any single runtime.
  6. Fun score and confidence are different. Entertainment value never substitutes for factual confidence.
  7. No parser sprawl. New ideas should first fit Event β†’ Relation β†’ Moment/Story β†’ Presentation rather than becoming another one-off detector.
  8. Do not force a Wrapped. Weak or ungrounded material may legitimately produce no card/story.
  9. Calibrate on people. P6/P7 remain the source of truth for whether local Moments are useful; P8 needs its own real-session evaluation before becoming default.
  10. Labels must match candidates and presentation. P7 protocol/locale isolation remains intact.
  11. Story Discovery is not P3-gated. P3 Moments may hint, but observable event windows get independent coverage.
  12. LLMs interpret structure and write copy; local code owns evidence boundaries. Story Miner output is validated before Narrator sees it.
  13. No fake persona precision. Persona magnitude is deterministic and coarse, never an LLM-generated 0–100 number.
  14. Remote evidence is bounded and redacted. Full transcripts stay local unless a future explicit mode says otherwise.

Development

Run the full regression suite:

npm test

Stages can also be checked separately:

npm run test:event
npm run test:graph
npm run test:moment-builder
npm run test:moment-ranker
npm run test:award-composer
npm run test:wrapped
npm run test:ingest
npm run test:evaluation
npm run test:review
npm run test:p5-p6
npm run test:p7
npm run test:p8

Status

🚧 Early prototype. P0–P7 are implemented. P8 v2 is an opt-in architecture experiment. The next evidence should come from side-by-side real-session review: does event-first Story Discovery recover the β€œε‰§ζƒ… + 人格” people actually enjoy, and is the added value worth its cost/latency/privacy tradeoff? If yes, the next engineering work is richer host adapters and explicit P8 human evaluation β€” not more award-specific regex detectors.

License

MIT

About

The funniest moments, catchphrases and plot twists from your AI coding sessions.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages