Skip to content

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

@Deezinor

Description

@Deezinor

Problem Description

The PAI-OpenCode plugin is creating work sessions for every single user interaction, including trivial messages like greetings ("hello"), acknowledgments ("thanks"), and ratings ("8/10"). This results in hundreds of empty work sessions with no valuable content.

Current Behavior

  • 97 work sessions created in just 48 hours of normal usage
  • All sessions contain only empty templates:
    • ISC.json: {"criteria": [], "anti_criteria": []}
    • THREAD.md: Just header template, no conversation
    • META.yaml: Status "COMPLETED" with no context
  • Zero learning captured from assistant responses or user feedback

Expected Behavior (Per PAI Specification)

Per PAI/SKILL.md, work sessions should only be created based on conversation depth:

Depth Content Create Session?
FULL Problem-solving, implementation, design ✅ Yes
ITERATION Continuing existing work ✅ Yes
MINIMAL Greetings, ratings, acknowledgments ❌ No

Root Cause

File: plugins/handlers/work-tracker.ts:139 - createWorkSession()

// Currently creates session unconditionally
export async function createWorkSession(prompt: string) {
// No filtering - creates session for EVERY prompt
const isc = { criteria: [], anti_criteria: [] }; // Always empty!
}

Triggers: Both chat.message and event handlers call createWorkSession() without checking message content or depth.

Additional Issues

Beyond the filtering problem, there are missing features compared to original PAI:

  1. Assistant responses never captured - Only user messages (truncated to 200 chars) are written to THREAD.md
  2. No items/ subdirectory - Original PAI creates structured work items at items/001/
  3. ISC never populated - Empty criteria arrays, no extraction from algorithm output
  4. No effort tier detection - Missing QUICK/STANDARD/DEEP classification
  5. Ratings not linked to sessions - Ratings go to ratings.jsonl but not to the work session thread

Proposed Solutions

Phase 1: Trivial Message Filtering

Add isTrivialMessage() function to detect and skip:

  • Greetings: "hello", "hi", "hey", "good morning"
  • Acknowledgments: "ok", "thanks", "got it", "sounds good"
  • Ratings: "8", "8/10", "9 - great work"
  • Short messages: <20 characters

Phase 2: Full Conversation Capture

  • Capture full user messages (not truncated)
  • Add appendAssistantToThread() to capture assistant responses
  • Link ratings to work sessions with context

Phase 3: Original PAI Structure

  • Create items/001/ subdirectory with META.yaml, ISC.json, RESPONSE.md
  • Detect effort tier (QUICK/STANDARD/DEEP) from prompt
  • Extract ISC criteria from algorithm output patterns
  • Add YAML frontmatter to all files

Acceptance Criteria

  • Trivial messages (greetings, ratings, acknowledgments) do NOT create work sessions
  • Meaningful work creates sessions with full directory structure
  • Assistant responses captured in THREAD.md
  • Full conversation preserved (not truncated)
  • Ratings linked to work sessions
  • ISC.json populated with criteria from algorithm output
  • Effort tier detected and stored in META.yaml

References

Environment

  • OpenCode: v1.1.x
  • PAI-OpenCode: Current main branch
  • OS: Linux (tested on WSL2)

Labels

bug, memory-system, performance, enhancement

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions