Rwb3n avatar

observation-triage-cycle

HAIOS Observation Triage Cycle for processing captured observations. Use when scanning archived work

提供方 Rwb3n|开源

Observation Triage Cycle

This skill defines the SCAN-TRIAGE-PROMOTE cycle for processing archived observations and routing them to actionable outcomes.

When to Use

Manual invocation: Skill(skill="observation-triage-cycle") when processing accumulated observations. Via recipe: just triage-observations for quick scan. Scheduled: Can be invoked during heartbeat or session-end.


The Cycle

SCAN --> TRIAGE --> PROMOTE
  |         |           |
  |         |           +-> spawn:INV, spawn:WORK, spawn:FIX
  |         |           +-> memory (store insight)
  |         |           +-> discuss (flag for operator)
  |         |           +-> dismiss (no action)
  |         |
  |         +-> Apply dimensions: category, action, priority
  |
  +-> Find archived observations with triage_status: pending

1. SCAN Phase

Goal: Find observations from both memory (retro-cycle outputs) and filesystem (legacy observations.md).

Actions:

1a. Memory Scan (retro-triage, WORK-143)

Query memory for retro-cycle outputs using MCP db_query tool:

K/S/S Directives:

mcp__haios-memory__db_query(sql="SELECT id, content FROM concepts WHERE type = 'Directive' AND (content LIKE 'KEEP-%' OR content LIKE 'STOP-%' OR content LIKE 'START-%') ORDER BY id")

Bug Candidates:

mcp__haios-memory__db_query(sql="SELECT id, content FROM concepts WHERE type = 'Critique' AND content LIKE 'BUG %' ORDER BY id DESC")

Feature Candidates:

mcp__haios-memory__db_query(sql="SELECT id, content FROM concepts WHERE type = 'Critique' AND content LIKE 'FEATURE %' ORDER BY id DESC")

Refactor Candidates:

mcp__haios-memory__db_query(sql="SELECT id, content FROM concepts WHERE type = 'Critique' AND content LIKE 'REFACTOR %' ORDER BY id DESC")

Upgrade Candidates:

mcp__haios-memory__db_query(sql="SELECT id, content FROM concepts WHERE type = 'Critique' AND content LIKE 'UPGRADE %' ORDER BY id DESC")

Report counts for each category.

1b. Filesystem Scan (legacy)

just triage-observations

Report count of items with pending observations.

Exit Criteria:

  • Memory scan completed (K/S/S, bugs, features, refactors, upgrades)
  • Filesystem scan completed
  • Counts reported for both sources

Tools: mcp__haios-memory__db_query, Bash(just triage-observations), Read


2. TRIAGE Phase

Goal: Process observations from both memory and filesystem sources.

2a. Retro-Triage (memory source, WORK-143)

K/S/S Frequency Aggregation: From K/S/S directive query results, group by directive text (normalized):

  • Count frequency of each Keep/Stop/Start directive across entries
  • Format: KEEP-N: prefix → category=keep, directive=text after prefix
  • Rank by frequency descending — high-frequency directives are strongest signals
  • Present aggregated K/S/S to operator with counts

Bug Candidate Surfacing: From bug query results, parse BUG (confidence): description format:

  • Extract confidence tag (high/medium/low) and description
  • Sort by confidence (high first)
  • Present to operator for disposition (spawn:WORK, spawn:FIX, dismiss)

Feature Candidate Surfacing: From feature query results, parse FEATURE (confidence): description format:

  • Extract confidence tag and description
  • Sort by confidence (high first)
  • Present to operator for epoch-level triage (spawn:WORK, discuss, dismiss)

Refactor Candidate Surfacing: From refactor query results, parse REFACTOR (confidence): description format:

  • Extract confidence tag and description
  • Sort by confidence (high first)
  • Refactors are typically bundled with related work — present to operator for bundling decision (spawn:WORK, bundle-with:{id}, discuss, dismiss)

Upgrade Candidate Surfacing: From upgrade query results, parse UPGRADE (confidence): description format:

  • Extract confidence tag and description
  • Sort by confidence (high first)
  • Upgrades are prioritised against capacity — present to operator for capacity triage (spawn:WORK, discuss, dismiss)

Suggested Priority Consumption: Retro-extract items now include suggested_priority: now|next|later with rationale. When surfacing candidates, display the suggested priority alongside confidence to give the operator a head start. Triage makes the final call — the suggestion is context from the agent that did the work, not a binding decision.

2b. Legacy Triage (filesystem source)

Triage Dimensions (Industry Standard):

DimensionQuestionValues
CategoryWhat type?bug, gap, debt, insight, question, noise
ActionWhat to do?spawn:INV, spawn:WORK, spawn:FIX, memory, discuss, dismiss
PriorityWhen?P0 (blocking), P1 (this session), P2 (next), P3 (backlog)

For each filesystem observation, prompt for dimensions:

  • Category: What type of observation is this?
  • Action: What should happen next?
  • Priority: How urgent is this?

Example Triage Prompt:

Observation: "commit-close recipe uses legacy patterns"
Section: Gaps Noticed
Source: E2-217

Category? [bug/gap/debt/insight/question/noise]: gap
Action? [spawn:INV/spawn:WORK/spawn:FIX/memory/discuss/dismiss]: spawn:FIX
Priority? [P0/P1/P2/P3]: P2

Exit Criteria:

  • Retro-triage: K/S/S aggregation presented, bug/feature/refactor/upgrade candidates surfaced
  • Legacy triage: All filesystem observations triaged with valid dimensions
  • Combined triaged list ready for promotion

Tools: AskUserQuestion (for dimension selection and disposition), triage_observation()


3. PROMOTE Phase

Goal: Execute the action for each triaged observation.

Action Handlers:

ActionExecution
spawn:INVCreate investigation via /new-investigation
spawn:WORKCreate work item via /new-work
spawn:FIXCreate quick fix work item (priority P1)
memoryStore insight via ingester_ingest
discussFlag for operator (report but no action)
dismissMark as noise (no action needed)

Actions:

  1. For each triaged observation, execute action
  2. Track results (spawned IDs, memory IDs)
  3. Update observations.md with triage log entry
  4. Set triage_status: triaged in frontmatter

Exit Criteria:

  • All actions executed
  • Observations.md updated with triage log
  • triage_status updated to triaged

Tools: /new-investigation, /new-work, ingester_ingest, Edit


Composition Map

PhasePrimary ToolOutput
SCAN (memory)mcp__haios-memory__db_queryK/S/S directives, bug/feature/refactor/upgrade candidates
SCAN (filesystem)Bash, ReadList of pending observations
TRIAGE (retro)AskUserQuestionKSS aggregation, candidate disposition
TRIAGE (legacy)AskUserQuestionTriaged observation list
PROMOTE/new-*, ingesterAction results

Quick Reference

PhaseQuestion to AskIf NO
SCANAny pending observations?Exit - nothing to triage
TRIAGEAll dimensions valid?Reprompt with validation error
PROMOTEAction executed?Report error, continue to next

Key Design Decisions

DecisionChoiceRationale
Standalone skillNot embedded in close-work-cycleKeeps closure lean; triage runs independently
Interactive triageAgent prompts per observationAvoids automated misclassification
triage_status fieldIn frontmatterEnables scan to skip processed files
Industry dimensionsbug/gap/debt/insight/question/noiseAligns with bug triage patterns
Dual-source scan (WORK-143)Memory + filesystemRetro-cycle stores to memory; legacy observations in files. Both sources feed triage.
Content-pattern queries (WORK-143)Query by type + content prefix, NOT source_adrA1 critique: ingester_ingest source_path not stored in source_adr. Content patterns verified against actual data.
MCP db_query for memory scan (WORK-143)Agent calls db_query directlyPython functions use db_query_fn injection for testability. Agent uses MCP tool at runtime.
4-type EXTRACT taxonomybug/feature/refactor/upgradeTypes route differently: bugs urgent, features backlog, refactors bundled, upgrades capacity-gated. Aligns with retro-cycle EXTRACT expansion.
Suggested priority consumptionDisplay retro-extract suggested_priorityAgent has freshest urgency context. Triage displays but overrides. Hybrid (Option C).

Related

  • E2-217: Observation Capture Gate (capture mechanism)
  • INV-047: Close Cycle Observation Phase Ordering (capture timing)
  • INV-023: ReasoningBank Feedback Loop Architecture (same pattern)
  • close-work-cycle skill: Captures observations during closure
  • retro-cycle skill: Produces typed outputs stored to memory (WORK-142)
  • observations.py: Core functions for scan, parse, triage, promote, and retro-triage (WORK-143)
  • WORK-143: Retro-triage consumer update for memory-based provenance tags
observation-triage-cycle - 适用于 Claude Code 与 Cursor 的 AI 智能体 Skill | Agent Skills