# PoC: task-postflight

# PoC: task-postflight Refactor

**Source:** `/tmp/pillar4-99131-out/poc-task-postflight-tier1.md` + `~/system/specs/agentic-os-pillar4-skills-audit-2026-05-04.md` (§6)  
**MC:** [\#99131](https://boards.alai.no/tasks/99131) | [\#99176](https://boards.alai.no/tasks/99176)  
**Branch:** `feat/pillar4-skills-poc` (merged to master 2026-05-05 ef8536ad)  
**Date:** 2026-05-05

---

## Overview

The PoC refactor of `task-postflight/SKILL.md` validates the three-tier progressive disclosure pattern on the highest-priority target.

- **Target:** 541 LOC → ≤ 200 LOC core trigger skeleton
- **New references/ files:** `anomaly-decision-tree.md`, `proveo-rubric.md`, `memory-writer.md`
- **Existing references/ preserved:** `proveo-brief.md`, `learning-loop.md` (unchanged)

---

## Token Reduction Analysis

<table id="bkmrk-metric-before-after-"><thead><tr><th>Metric</th><th>Before</th><th>After (PASS path)</th><th>After (ANOMALY path)</th></tr></thead><tbody><tr><td>SKILL.md LOC</td><td>541</td><td>≤190</td><td>≤190</td></tr><tr><td>SKILL.md bytes</td><td>19,859</td><td>~8,200</td><td>~8,200</td></tr><tr><td>Tokens loaded</td><td>5,367</td><td>~2,216</td><td>~2,216</td></tr><tr><td>Additional refs loaded</td><td>0</td><td>0</td><td>~3,000 (anomaly-decision-tree)</td></tr><tr><td>Total tokens (PASS path)</td><td>5,367</td><td>2,216</td><td>N/A</td></tr><tr><td>**Reduction on PASS path**</td><td>—</td><td>**59%**</td><td>—</td></tr><tr><td>Bytes reduction check</td><td>—</td><td>11,659 bytes saved / 19,859 = 58.7% ≥ 40%</td><td>**PASS**</td></tr></tbody></table>

The ≥40% byte reduction target is met on the typical PASS path. On anomaly paths, the `anomaly-decision-tree.md` is loaded (~3,000 additional tokens) but this is appropriate because the anomaly path requires that content.

---

## PoC Target Rationale

**Selection: task-postflight**

Priority score comparison:

<table id="bkmrk-skill-tokens_est-inv"><thead><tr><th>Skill</th><th>tokens\_est</th><th>inv\_30d</th><th>priority\_score</th></tr></thead><tbody><tr><td>task-postflight</td><td>5,367</td><td>21</td><td>**82.054**</td></tr><tr><td>prompt-forge</td><td>2,372</td><td>20</td><td>70.877</td></tr><tr><td>doc-coauthoring</td><td>4,274</td><td>0</td><td>3.631</td></tr><tr><td>product-lifecycle</td><td>5,103</td><td>0</td><td>3.708</td></tr></tbody></table>

Petter's preference for `doc-coauthoring` (376L, clean three-stage structure) was overridden by frequency data. `task-postflight` fires on every H/BLOCKER closure — 21 times in 19 days. `doc-coauthoring` has 0 measured invocations. Frequency × size dominates structural elegance.

---

## Trigger-Map Table

Content migration plan (required before coding per D3 pre-refactor requirement):

<table id="bkmrk-current-skill.md-sec"><thead><tr><th>Current SKILL.md section</th><th>Lines</th><th>Always needed?</th><th>Move to</th></tr></thead><tbody><tr><td>Frontmatter (description)</td><td>8</td><td>YES — trigger</td><td>Keep in SKILL.md</td></tr><tr><td>§1 Preconditions</td><td>32</td><td>YES — fail fast</td><td>Keep in SKILL.md</td></tr><tr><td>§2 Proveo dispatch</td><td>40</td><td>YES — every invocation</td><td>Keep in SKILL.md</td></tr><tr><td>§3 Anomaly decision tree</td><td>38</td><td>NO — only after Proveo returns</td><td>→ references/anomaly-decision-tree.md</td></tr><tr><td>§4 Learning-opportunity dispatch template</td><td>62</td><td>NO — only on ANOMALY path</td><td>→ references/anomaly-decision-tree.md</td></tr><tr><td>§5 Memory writer procedure</td><td>38</td><td>NO — only if learning returns memory</td><td>→ references/memory-writer.md</td></tr><tr><td>§6 Postflight marker writer</td><td>72</td><td>PARTIAL — Section 6a-6b always needed, 6c-6f only on success path</td><td>6a-6b keep; 6c-6f → references/marker-writer.md</td></tr><tr><td>§7 mc.js ready writer</td><td>52</td><td>PARTIAL — format in SKILL.md; details → references/</td><td>Keep dispatch shape; move table → references/</td></tr><tr><td>§8 Failure modes table</td><td>30</td><td>NO — reference only</td><td>→ references/anomaly-decision-tree.md</td></tr><tr><td>§9 Audit trail</td><td>20</td><td>YES — always runs</td><td>Keep in SKILL.md</td></tr><tr><td>v0.1 TODO + References footer</td><td>30</td><td>NO</td><td>Drop from PoC (TODO deferred)</td></tr></tbody></table>

---

## Content Split

### Stage 1 content (stays in SKILL.md core)

- Preconditions (1a-1c)
- Proveo dispatch inputs and expected output format
- Anomaly routing decision (IF/THEN — 4 cases, each with "Read ./references/anomaly-decision-tree.md")
- Postflight marker check (6a-6b only)
- mc.js ready submission shape
- Audit trail append

### Stages 2-N content (moved to references/)

- Full anomaly class decision tree → `references/anomaly-decision-tree.md`
- Learning-opportunity invocation template → `references/anomaly-decision-tree.md` (same file, appended)
- Memory writer procedure → `references/memory-writer.md`
- Marker writer full procedure (6c-6f) → `references/marker-writer.md`
- Failure modes table → appended to `references/anomaly-decision-tree.md`

### Existing references/ files

- `references/proveo-brief.md` — keep as-is (already correct progressive disclosure)
- `references/learning-loop.md` — keep as-is

---

## Verification Commands

```
# 1. Branch exists
git -C /Users/makinja/.claude branch --list "feat/pillar4-skills-poc"

# 2. LOC check
wc -l /Users/makinja/.claude/skills/task-postflight/SKILL.md  # must be <= 200

# 3. Reference files exist
ls /Users/makinja/.claude/skills/task-postflight/references/anomaly-decision-tree.md
ls /Users/makinja/.claude/skills/task-postflight/references/proveo-rubric.md
ls /Users/makinja/.claude/skills/task-postflight/references/memory-writer.md

# 4. Before/after snapshots exist
ls /tmp/pillar4-99131-out/poc-task-postflight-before.md
ls /tmp/pillar4-99131-out/poc-task-postflight-after.md

# 5. Byte reduction >= 40%
python3 -c "
before=$(wc -c < /tmp/pillar4-99131-out/poc-task-postflight-before.md)
after=$(wc -c < /tmp/pillar4-99131-out/poc-task-postflight-after.md)
print(f'Reduction: {(before-after)/before*100:.1f}%')
print('PASS' if (before-after) >= 0.4*before else 'FAIL')
"

# 6. No section header permanently lost
# Proveo verifies headers in before.md appear in {after.md + 3 ref files}

```

---

## PR Merged

**Branch:** `feat/pillar4-skills-poc`  
**Merged:** 2026-05-05T09:17:35Z  
**Commit:** ef8536adba17  
**Status:** Merged to master  
**Result:** 541 LOC → 194 LOC (64.7% reduction)

---

[← Design Pattern](https://docs.alai.no/books/pillar-4-skills/page/design-pattern) | [Audit Summary](https://docs.alai.no/books/pillar-4-skills/page/audit-summary)