Skip to content

fix: complete work session intelligence port#26

Merged
Steffen025 merged 2 commits intomainfrom
fix/24-work-session-filtering
Feb 21, 2026
Merged

fix: complete work session intelligence port#26
Steffen025 merged 2 commits intomainfrom
fix/24-work-session-filtering

Conversation

@Steffen025
Copy link
Copy Markdown
Owner

@Steffen025 Steffen025 commented Feb 20, 2026

Summary

Fixes #24 — Work sessions were empty shells: no assistant responses, always-empty ISC.json, truncated user messages, no effort classification.

This PR ports the work session intelligence from Daniel Miessler's original PAI system to PAI-OpenCode.

Changes (5 Phases)

Phase 1: Trivial Message Filtering

  • Added isTrivialMessage() — regex-based filtering for greetings, acknowledgments, ratings, farewells
  • Both session creation paths gated (min 25 chars + pattern matching)
  • Commands (/) and code snippets bypass filtering

Phase 2: Assistant Response Capture

  • Full assistant responses now appended to THREAD.md as **Assistant:** {content}
  • Gated by active session check — no writes without a session

Phase 3: ISC Criteria Bridge

  • algorithm-tracker.ts now calls updateISC() from work-tracker.ts when TodoWrite fires
  • Criteria automatically separated into criteria and anti_criteria based on ISC-A naming
  • ISC.json now tracks total, completed, and updated_at

Phase 4: Effort Level in META

  • Detects effort level on session creation using existing detectEffortLevel()
  • Writes effort_level: and effort_budget: to session META.yaml
  • Example: effort_level: Standard / effort_budget: <2min

Phase 5: Full User Messages

  • Removed .substring(0, 200) truncation from both THREAD.md append sites
  • User messages now captured in full

Before vs After

Data Before After
User messages Truncated to 200 chars Full content
Assistant responses Not captured Full response in THREAD.md
ISC criteria Always empty [] Populated from Algorithm's TodoWrite
Effort level Not recorded Written to META.yaml
Trivial filtering No filtering (empty sessions) Greetings/ratings/farewells skipped

Files Changed

  • .opencode/plugins/pai-unified.ts — Phases 1, 2, 4, 5
  • .opencode/plugins/handlers/work-tracker.ts — Phase 1 (isTrivialMessage) + Phase 3 (updateISC enhancement)
  • .opencode/plugins/handlers/algorithm-tracker.ts — Phase 3 (ISC bridge)

Testing

All changes are non-blocking (try/catch with fileLog). Bun build passes clean for all 3 files. No new dependencies added.

Thanks to @Deezinor for the detailed issue report and phased proposal.

Adds isTrivialMessage() to work-tracker.ts that detects:
- Greetings (hi, hello, hey, guten morgen, etc.)
- Acknowledgments (ok, thanks, sure, etc.)
- Ratings (8, 9/10, etc.)
- Farewells (bye, ciao, tschüss, etc.)
- Short messages (<25 chars) unless they are commands

Gates both session creation paths in pai-unified.ts:
- chat.message handler (line ~362)
- event handler message.updated (line ~644)

Phase 1 of #24 — filtering only. Future phases:
- Phase 2: Full conversation capture (assistant responses)
- Phase 3: ISC population and items/ structure

Fixes #24
Phase 2: Capture full assistant responses to THREAD.md
Phase 3: Bridge ISC criteria from algorithm-tracker to session ISC.json
Phase 4: Write effort level + budget to META.yaml on session creation
Phase 5: Remove 200-char truncation from user messages in THREAD.md

Work sessions now capture complete conversation threads, ISC criteria
from the Algorithm's TodoWrite, and effort level classification.

Fixes #24
@Steffen025 Steffen025 changed the title fix: filter trivial messages from creating empty work sessions fix: complete work session intelligence port Feb 21, 2026
@Steffen025 Steffen025 merged commit 81d7d93 into main Feb 21, 2026
@Steffen025 Steffen025 deleted the fix/24-work-session-filtering branch February 21, 2026 01:29
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.

Empty work sessions created for every chat interaction - needs filtering and full conversation capture

1 participant