Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

hstack

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hstack - npm Package Compare versions

Comparing version
0.3.0
to
0.4.0
+138
template/.claude/skills/hstack-flag/SKILL.md
---
name: hstack-flag
description: |
Use this skill when the engineer notices in-the-moment friction in the hstack workflow — a Skill loop that felt off, a subagent output that read wrong, a halt firing for an unexpected reason, a confirmation diff that revealed an unstated assumption — and wants to surface it for kernel-fit review without halting the current work. The Skill is the engineer-triggered side of the kernel-fit closed loop (ADR-0005). It drops a tiny frontmatter-only pin to `hstack/kernel-fit/flags/pending/` carrying session-id + transcript path + branch + HEAD + timestamp, completes in under a second, and exits. No interview, no confirmation, no commit. The next `/hstack:kernel-fit-scan` reads each pin, opens the referenced transcript, classifies the friction, and either folds the signal into an existing finding or emits a new one. Examples:
<example>
Context: Mid-implementation the engineer notices a Skill produced a confirmation diff that revealed an assumption the kernel does not name.
user: "/hstack:flag"
assistant: "📌 pinned at hstack/kernel-fit/flags/pending/flag-20260523T143208-a3f9.md — kernel-fit will review on next scan."
<commentary>
Zero-friction is load-bearing. No interview, no confirmation gate, no diff preview. The Skill captures session-id (from most-recently-modified jsonl under ~/.claude/projects/<encoded-cwd>/), branch, HEAD, timestamp, and writes the pin in under a second. The engineer continues working immediately.
</commentary>
</example>
<example>
Context: The engineer wants to leave a one-word hint so future-them remembers the rough shape of the friction when they re-read the transcript.
user: "/hstack:flag halt-loop"
assistant: "📌 pinned with hint 'halt-loop' — kernel-fit will review on next scan."
<commentary>
The optional positional hint argument is a one-word string. Multi-word hints are rejected (the Skill takes argv[0] and ignores the rest with a one-line note). The hint is for the engineer's future audit, not for the analyst — per ADR-0005, the analyst forms its classification from the transcript window, not from engineer-written hints, to preserve the no-contamination contract.
</commentary>
</example>
<example>
Context: The engineer flags from a workspace where the encoded-path directory under ~/.claude/projects/ does not exist (e.g., the harness is storing transcripts elsewhere or the workspace is brand-new).
user: "/hstack:flag"
assistant: "📌 pinned with session-id-source: fallback-cwd (no jsonl found under ~/.claude/projects/<encoded>; session-id may not resolve at scan-time). The analyst will classify as transcript-truncated if the transcript cannot be located. Re-flag in a session whose transcript is reachable if the friction is recurring."
<commentary>
The session-id capture is heuristic in v1 (per ADR-0005). The Skill does not halt when the heuristic fails — it writes the pin with whatever metadata it can capture and a note in `session-transcript-path` indicating the fallback. The analyst's `transcript-truncated` classification is the safety net. v2 substrate will replace the heuristic with a harness-exposed session-id.
</commentary>
</example>
tools:
- Bash
- Read
- Write
- Glob
---
## Purpose
`hstack-flag` is the engineer-triggered feeder into the kernel-fit closed loop (ADR-0005). It captures a *pointer to the moment* — session-id, transcript path, branch, HEAD, timestamp — so the `kernel-fit-analyst` can later read the surrounding transcript window and classify whatever friction prompted the flag. The Skill carries no engineer interpretation of the friction; the analyst forms its classification independently to preserve the no-contamination contract.
This Skill is mechanical per ADR-0001. No subagent is invoked. The values to write are determined entirely by the invocation context (git state, working directory, the active Claude Code session-id, current transcript message count) plus the optional one-word hint. There is no interview, no confirmation gate, no proposed-diff preview, and no commit — the pin is additive, immutable, and out-of-band from the lifecycle state machine.
## When to invoke
Invoke when:
- A Skill loop felt off — looped longer than expected, asked a question that revealed a wrong assumption, produced output that read strangely.
- A subagent's output read wrong — challenge prompts seemed to dodge real risk, evidence rows looked thin, a finding's category felt mis-categorized.
- A halt fired for an unexpected reason — the halt enum value did not seem to capture what actually happened, or the halt felt like it should have been routine.
- A confirmation diff revealed an unstated kernel assumption — the proposed write surfaced something the kernel does not name but probably should.
- Anything else where the engineer wants the transcript window remembered for later review, but cannot stop the current work to write a tech-debt item or an ADR.
Do NOT invoke for:
- Bugs in individual code changes (those are tech-debt items or revisits-change entries).
- Security gaps in a specific change (those are security-review concerns).
- Genuine emergencies — if the situation requires halting, halt and address it directly.
## Inputs
- Optional positional `<hint>` (one word, ≤ 32 characters). Multi-word arguments are truncated to the first whitespace-delimited token with a one-line note. The hint is for the engineer's future audit, not for the analyst.
## Preconditions
- Working directory is a git repository (`git rev-parse --git-dir` succeeds). If not, halt with "not in a git repo — flag only works inside hstack-governed code."
- The consuming repo has at least the `hstack/kernel-fit/flags/pending/` directory writable (the Skill creates it on demand if absent — no halt).
- No status check on any other artifact. The Skill is intentionally orthogonal to the lifecycle state machine; flagging is permitted in any branch, at any time, regardless of in-flight artifacts.
## Orchestration steps
1. **Capture git state.** Run in parallel:
- `git rev-parse HEAD` → `head`
- `git rev-parse --abbrev-ref HEAD` → `branch`
- `pwd` → `workspace`
2. **Resolve the session-id.** Heuristic per ADR-0005 (v2 substrate will replace this with a harness-exposed mechanism):
- Compute the encoded workspace path: replace `/` with `-` in the absolute cwd path, prefix with `-`. Example: `/Users/jane/code/moso` → `-Users-jane-code-moso`.
- Glob `~/.claude/projects/<encoded-cwd>/*.jsonl`.
- If at least one match: pick the most recently modified (`stat -f %m` on macOS, `stat -c %Y` on Linux) and extract its `session-id` from the filename (basename minus `.jsonl`). Set `session-transcript-path` to its absolute path.
- If zero matches: set `session-id` to `fallback-<short-uuid>` (generate a short random hex), set `session-transcript-path` to the literal string `fallback-cwd:<workspace>` so the analyst can detect the fallback at scan time. Do NOT halt — the pin still has audit value (timestamp + branch + HEAD), and the analyst's `transcript-truncated` classification is the safety net.
3. **Capture pre-compaction message count.** Count lines in `session-transcript-path` if it points at a real jsonl file (`wc -l < <path>`); else set to 0. The analyst compares this to the file's line count at scan-time to detect compaction.
4. **Read and normalize the hint.** If the engineer passed an argument: take the first whitespace-delimited token, truncate to 32 characters, store as `hint`. If multi-word was passed, note in stdout "hint truncated to first token: <hint>". If no argument: `hint: null`.
5. **Compose the pin id.** Format: `flag-<YYYYMMDD>T<HHMMSS>-<session-id-short>` where `<session-id-short>` is the first 4 characters of the session-id (or `fallback-<hex>`). Example: `flag-20260523T143208-a3f9`.
6. **Write the pin.** Ensure `hstack/kernel-fit/flags/pending/` exists (`mkdir -p`); write `<pin-id>.md` with the frontmatter-only content per `template/templates/kernel-fit-flag.md`. The body is intentionally empty (a single HTML comment from the template is acceptable, but no prose).
7. **Confirm to stdout.** Print one line: `📌 pinned at hstack/kernel-fit/flags/pending/<pin-id>.md — kernel-fit will review on next scan.` If the hint was set, mention it. If the session-id fell back, mention it. Exit 0.
## Outputs
- One new file at `hstack/kernel-fit/flags/pending/<pin-id>.md`.
- No git operations. No commits. No subagent invocations. No edits to any other file.
## Auto-commit triggers
None. Pins are gitignored per ADR-0005 (derivative signal, mirroring `.telemetry/` sidecars from ADR-0004). The flag is not a lifecycle event, so the kernel's auto-commit-at-status-transition rule does not apply.
## Idempotency contract
Each invocation produces a new pin with a unique id (timestamp granularity is one second; session-id-short is appended for collision safety across rapid re-flags). Re-running the Skill on the same friction produces a second pin — this is intentional. The analyst processes both and the duplication itself is signal (engineer felt strongly enough to flag twice). The Skill never overwrites or deduplicates.
## Stop conditions
Beyond the kernel's general stop conditions:
- Not inside a git repo. Halt with the explanation above. The Skill is meaningful only inside hstack-governed code where the analyst can correlate the pin to a finding surface.
The Skill explicitly does NOT halt on:
- Missing jsonl under `~/.claude/projects/<encoded-cwd>/` — falls back to `fallback-cwd` and writes the pin anyway.
- Branch mismatch with an in-flight change-spec — flagging is orthogonal to lifecycle.
- A `validate-spec.ts` failure on the pin frontmatter — until the validator ships, FL-01 and FL-02 are advisory only; the pin lands.
- Disk-write failure on the pin file. (If `mkdir -p` or `Write` errors, halt with the OS error — there is nothing useful the Skill can do.)
No halt sentinel is emitted by this Skill in the success path. The success path is a clean exit-0 with the one-line stdout confirmation.
## Failure modes
- **`~/.claude/projects/<encoded-cwd>/` does not exist or is empty.** Fall back as described in step 2; write the pin with `session-transcript-path: fallback-cwd:<workspace>`. The analyst will classify `transcript-truncated` at scan-time.
- **Multiple `.jsonl` files in the encoded directory.** Pick the most recently modified. This is the v1 heuristic; v2 will replace it with a harness-exposed session-id.
- **Engineer flags many times in rapid succession.** Each flag produces a distinct pin (timestamp granularity + session-id-short suffix prevents collisions). The high flag-rate itself becomes signal in the next scan's Slack tail summary.
- **Engineer flags from inside a subagent's session.** The encoded-cwd heuristic resolves to the main-session jsonl (subagents do not get their own jsonl under `~/.claude/projects/`), which is correct — the analyst wants the main session's transcript. No special handling required.
- **Engineer passes a quoted multi-word hint.** Truncate to the first token, note it in stdout, write the pin. Do not halt.
## Anti-patterns
- Never prompt the engineer for a description of the friction. The Skill is one-shot and silent. Asking for prose re-opens the contamination surface the analyst guards against and defeats the zero-friction goal.
- Never invoke a subagent. The pin's value is determined by invocation context; no subagent decision-making is needed.
- Never commit the pin. Pins are gitignored. Committing them would (a) defeat the cadence (every flag becomes a commit), (b) pollute git history with derivative-cache files, and (c) break the gitignore decision recorded in ADR-0005's Decision and Consequences.
- Never edit an existing pin to add context. Pins are immutable from the engineer's perspective; the only legal post-creation writes are by the analyst at processing time. To add context, re-flag in a follow-up turn.
- Never invoke a confirmation gate. The proposed-diff preview rule from the kernel's Mechanical operations section does not apply here because the pin is additive (not a state-machine write) and there is no risk to mitigate: the pin is immutable, gitignored, and out-of-band from every lifecycle gate.
- Never block the conversation on slow operations. The Skill's wall-clock budget is <1s. If `wc -l` against a multi-gigabyte jsonl is too slow, accept an approximate count (the field is for change-detection at scan-time, not exact accounting) — but `wc -l` on jsonl files in practice completes in tens of milliseconds and this concern is theoretical.
- Never escalate a flag into a tech-debt item, ADR, or research session automatically. Promotion is exclusively the analyst's call at scan-time, gated by the engineer via `/hstack:kernel-fit-triage` and `/hstack:kernel-fit-promote`. The Skill is a feeder, not a router.
---
id: flag-<YYYYMMDD>T<HHMMSS>-<session-id-short>
type: kernel-fit-flag
status: pending # pending | processed
session-id: <claude-code-session-uuid> # FL-01: non-null at pin-time
session-transcript-path: <abs-path-to-jsonl> # FL-01: non-null at pin-time
branch: <current-branch> # FL-01: non-null at pin-time
head: <current-HEAD-sha> # FL-01: non-null at pin-time
workspace: <abs-path-to-cwd> # FL-01: non-null at pin-time
timestamp: <ISO-8601 timestamp at pin> # FL-01: non-null at pin-time
pre-compaction-message-count: <integer> # FL-01: non-null at pin-time; analyst uses this to detect truncation between pin and scan
hint: null # one-word string from --hint arg; null when no arg given
classification: null # FL-02: non-null when status: processed; one of friction | missing-guardrail | kernel-vs-practice-mismatch | not-actionable | transcript-truncated
classification-rationale: null # FL-02: non-null when status: processed; one-line analyst note
folded-into: null # KF-NNNN-<slug> when the analyst folded the signal into an existing finding
emitted-as: null # KF-NNNN-<slug> when the analyst emitted a fresh finding from this pin
created: <YYYY-MM-DD>
updated: <YYYY-MM-DD>
schema-version: 1
---
<!--
A kernel-fit-flag is a frontmatter-only pin. There is no body. Engineer
interpretation of the friction is deliberately excluded — the analyst reads
the transcript window and forms its own classification at processing time.
Validator rules (enforced by the proposed-diff preview in v1; validate-spec.ts
is still a {{TODO-SCRIPT}} placeholder):
- FL-01: at pin-time (status: pending) every field marked above as
"non-null at pin-time" must be populated. `hint` may be null; the four
analyst-owned fields (classification, classification-rationale,
folded-into, emitted-as) must remain null until processing.
- FL-02: at processing-time (status: processed) `classification` and
`classification-rationale` must both be non-null. When the classification
produced a finding, exactly one of `folded-into` or `emitted-as` is non-null
(never both). When the classification did not produce a finding (closed as
`not-actionable` or `transcript-truncated`), both remain null.
Pins are immutable from the engineer's perspective. The only legal writes
after creation are by the kernel-fit-analyst at processing time, setting the
four analyst-owned fields and flipping status to processed. The engineer
cannot edit a pin to add commentary — that would re-open the contamination
surface the analyst guards against. To add context, re-flag in a follow-up
turn (a new pin with a different timestamp).
Pins live at hstack/kernel-fit/flags/pending/ before processing and at
hstack/kernel-fit/flags/processed/ after. The directory is gitignored in
the consuming repo — see ADR-0005 for the rationale and the trade-off
(provenance gap unique to this artifact type).
-->
+19
-0

@@ -9,2 +9,21 @@ # Changelog

## [0.4.0] - 2026-05-23
### Added
- **Engineer-triggered `/hstack:flag` Skill — phase-1 of ADR-0005.** A one-shot Skill that drops a frontmatter-only pin to `hstack/kernel-fit/flags/pending/` carrying session-id, transcript path, branch, HEAD, and timestamp. No interview, no confirmation, no commit, sub-second wall-clock. Optional one-word `<hint>` positional argument for engineer audit; the analyst forms its own classification from the transcript window at scan time (no contamination from engineer-written hints). Heuristic session-id capture via most-recently-modified jsonl under `~/.claude/projects/<encoded-cwd>/`; `fallback-cwd` path when no jsonl is found, with the analyst's `transcript-truncated` classification as the safety net.
- **New `kernel-fit-flag` artifact template** at `template/templates/kernel-fit-flag.md` — frontmatter-only schema with FL-01 (required fields at pin-time) and FL-02 (classification + rationale non-null when status: processed) documented in template commentary.
- **Kernel paragraph under `## How hstack improves itself`** documenting the engineer-trigger side of the loop and pointing to ADR-0005.
- **`hstack/kernel-fit/flags/` added to consumer `.gitignore`** via `GITIGNORE_KERNEL_FIT_FLAGS_LINE` in `src/lib/wire.ts`; appended at both `hstack init` and `hstack update`. Pins are derivative signal (mirroring `.telemetry/` from ADR-0004); the audit trail lives at the finding layer once the analyst processes them.
- **Pending Flags Processing in `kernel-fit-analyst` — phase-2 of ADR-0005.** The analyst now reads pending pins, opens each pin's session transcript, reads the ~50 turns immediately preceding the pin timestamp (never forward), and classifies the friction as one of `friction | missing-guardrail | kernel-vs-practice-mismatch | not-actionable | transcript-truncated`. Compaction detection compares `pre-compaction-message-count` against the current transcript line count to surface truncation. Fold-vs-emit-vs-close decision: fold when the friction maps onto an existing in-flight finding (append evidence row, increment count); emit when no existing finding maps (write a new finding with `detected-via: flag` and `pattern: KF-FLAG-<NNNN>`); close when classification is `not-actionable` or `transcript-truncated`. Counter-explanation discipline (KF-03) applies identically to flag-emit findings. The analyst is forbidden from re-processing pins already in `processed/`.
- **`detected-via: detector | flag` frontmatter field** on `templates/kernel-fit-finding.md` with default `detector` for backwards compatibility. No schema-version bump — the field has a safe default and existing findings remain valid. For folded-in findings (flag signal merged into an existing detector-finding by appending an evidence row), `detected-via` remains `detector` because the originating signal was the detector pattern.
- **Flag-processing extensions to `/hstack:kernel-fit-scan`.** New orchestration step (step 3) enumerates pending pins; step 4's no-fire path now requires both no patterns fired AND no pending flags before exiting clean; step 5 surfaces the pin list to the analyst; step 6 performs the `git mv` from `pending/` to `processed/` (filesystem-only since pins are gitignored); step 7 extends the commit message to name flag-processing counts; step 8's Slack body adds `[via: detector|flag]` and a tail summary "Flags processed: P total — FF folded, E emitted, NA not-actionable, TT transcript-truncated" (suppressed when every pin was classified `not-actionable` to avoid pure noise); step 10's report names per-classification counts.
### Notes
- v1 honesty (phase-1): session-id capture is heuristic (most-recently-modified jsonl under `~/.claude/projects/<encoded-cwd>/`). Interleaved sessions on the same workspace are a known edge case; v2 substrate will replace the heuristic with a harness-exposed session-id when Claude Code exposes one. The `transcript-truncated` classification is the safety net.
- v1 honesty (phase-2): the analyst's flag classification is LLM-strategized judgment, not measured truth — same framing rule that detector-side findings carry. The counter-explanation discipline (KF-03) is the false-positive mitigation for flag-emit findings, identical to detector-emit findings.
- The provenance gap (gitignored pins are not reproducible from git alone) is acknowledged in ADR-0005's Consequences challenge and accepted in exchange for the zero-friction-cadence invariant.
- Fold conservatism: when in doubt between fold and emit, the analyst prefers fold. The engineer's triage path is the same either way, and folding keeps the finding count bounded. Over-emit produces noise that erodes the loop's signal.
See [ADR-0005](adr/ADR-0005-engineer-triggered-flag-feeds-kernel-fit.md) for the design rationale and the complementary relationship with ADR-0004's detector-side loop.
## [0.3.0] - 2026-05-22

@@ -11,0 +30,0 @@

@@ -8,2 +8,3 @@ import fs from "fs-extra";

export const GITIGNORE_TELEMETRY_LINE = "**/.telemetry/";
export const GITIGNORE_KERNEL_FIT_FLAGS_LINE = "hstack/kernel-fit/flags/";
/**

@@ -56,2 +57,12 @@ * Compute the full plan for `hstack init` against `consumerRoot`,

});
// 5b. Append kernel-fit flags gitignore line (per ADR-0005 — pins are
// derivative signal, mirroring the `.telemetry/` decision in ADR-0004).
// Findings under hstack/kernel-fit/findings/ remain committed; only the
// flags/ subtree is gitignored.
actions.push({
kind: "append-line",
file: resolve(consumerRoot, ".gitignore"),
line: GITIGNORE_KERNEL_FIT_FLAGS_LINE,
createIfMissing: true,
});
// 6. Stamp the installed-version marker so update can compare later.

@@ -128,2 +139,9 @@ actions.push({

});
// 5b. .gitignore kernel-fit flags line — idempotent re-check (per ADR-0005).
actions.push({
kind: "append-line",
file: resolve(consumerRoot, ".gitignore"),
line: GITIGNORE_KERNEL_FIT_FLAGS_LINE,
createIfMissing: true,
});
// 6. VERSION marker.

@@ -130,0 +148,0 @@ actions.push({

+1
-1

@@ -1,1 +0,1 @@

{"version":3,"file":"wire.js","sourceRoot":"","sources":["../../src/lib/wire.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,UAAU,CAAC;AAC1B,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACvD,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC7E,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEjD,MAAM,CAAC,MAAM,kBAAkB,GAC7B,qGAAqG,CAAC;AAExG,MAAM,CAAC,MAAM,wBAAwB,GAAG,gBAAgB,CAAC;AAyBzD;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,QAAQ,CAC5B,YAAoB,EACpB,WAAmB,EACnB,cAAsB;IAEtB,MAAM,OAAO,GAAa,EAAE,CAAC;IAE7B,4DAA4D;IAC5D,OAAO,CAAC,IAAI,CAAC;QACX,IAAI,EAAE,eAAe;QACrB,IAAI,EAAE,WAAW;QACjB,EAAE,EAAE,OAAO,CAAC,YAAY,EAAE,QAAQ,CAAC;KACpC,CAAC,CAAC;IAEH,gEAAgE;IAChE,OAAO,CAAC,IAAI,CAAC;QACX,IAAI,EAAE,SAAS;QACf,IAAI,EAAE,0BAA0B;QAChC,EAAE,EAAE,OAAO,CAAC,YAAY,EAAE,SAAS,EAAE,QAAQ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K,eAAe;gBAClB,MAAM,EAAE,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;gBAClC,MAAM,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,OAAO,GAAG,IAAI,CAAC,CAAC;gBAC3C,MAAM;QACV,CAAC;IACH,CAAC;AACH,CAAC;AAED,KAAK,UAAU,oBAAoB,CACjC,IAAY,EACZ,IAAY,EACZ,eAAwB,EACxB,OAAgB;IAEhB,MAAM,MAAM,GAAG,MAAM,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;IACzC,IAAI,CAAC,MAAM,IAAI,CAAC,eAAe;QAAE,OAAO;IACxC,MAAM,QAAQ,GAAG,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAC/D,MAAM,KAAK,GAAG,OAAO,IAAI,IAAI,CAAC;IAC9B,IAAI,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC;QAAE,OAAO;IACrC,MAAM,GAAG,GAAG,QAAQ,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;IACxE,MAAM,EAAE,CAAC,SAAS,CAAC,IAAI,EAAE,QAAQ,GAAG,GAAG,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC;AACzD,CAAC"}
{
"name": "hstack",
"version": "0.3.0",
"version": "0.4.0",
"description": "A spec-driven engineering workflow that ships as Claude Code Skills and subagents.",

@@ -5,0 +5,0 @@ "keywords": [

@@ -65,2 +65,3 @@ ---

- Every module-spec at `hstack/specs/<module>/spec.md` — for module-wide context.
- Every pending engineer flag at `hstack/kernel-fit/flags/pending/*.md` — frontmatter only. The Pending Flags Processing section below documents the per-pin classification loop. The analyst opens each pin's `session-transcript-path` at processing time (not at session start) to keep the session-start load bounded.

@@ -96,3 +97,50 @@ Explicitly NOT loaded:

- **Provenance attestation.** Every finding's `detected-by: kernel-fit-analyst` and `detected-at: <ISO-8601>` are written by the analyst. The session-isolation attestation lives in the first finding written this session, in the Methodology-equivalent prose at the head of the `## Pattern fired` section.
- **`detected-via` provenance.** Every finding the analyst writes carries `detected-via: detector | flag` per ADR-0005. Set to `detector` when the finding originates from a fired `kernel_fit.py` pattern; set to `flag` when the finding originates from a `/hstack:flag` pin via the Pending Flags Processing loop below. For folded-in findings (flag signal merged into an existing detector-finding by appending an evidence row), `detected-via` remains `detector` because the originating signal was the detector pattern — the flag contributed an evidence row, not a new finding.
## Pending Flags Processing
`/hstack:flag` drops frontmatter-only pins at `hstack/kernel-fit/flags/pending/*.md` carrying session-id, transcript path, branch, HEAD, timestamp, and pre-compaction-message-count. Per ADR-0005, the analyst processes these pins on every scan invocation, treating them as a complementary input source to the detector patterns. The pin carries no engineer interpretation of the friction — the analyst forms its classification independently by reading the transcript window around the pin's timestamp.
**Processing loop**, executed once after the detector-pattern synthesis is complete and the new finding files have been written but before the calling Skill stages them for commit:
1. **Glob pending pins, ordered by `timestamp` ascending.** Iterate `hstack/kernel-fit/flags/pending/*.md` oldest-first. If the directory is empty or does not exist, the loop is a no-op — skip to the report step.
2. **Per pin, attempt to open `session-transcript-path`.**
- If the path begins with `fallback-cwd:` (the v1 heuristic could not resolve a session-id at pin-time), classify `transcript-truncated` immediately and skip transcript reading. Set `classification-rationale: "session-id not resolved at pin-time; v1 heuristic fallback."`
- If the file does not exist on disk (the transcript was deleted or moved since the pin), classify `transcript-truncated`. Set `classification-rationale: "transcript no longer at <session-transcript-path>."`
- If the file exists, count its current line count and compare against `pre-compaction-message-count`. If current count is **lower**, compaction has dropped context — classify `transcript-truncated`. Set `classification-rationale: "transcript compacted between pin and scan (was N, now M lines)."`
- Otherwise: the transcript is readable and bounded. Proceed to step 3.
3. **Read the ~50 turns immediately preceding `timestamp`.** Each line in the jsonl is one message. Locate the closest message whose recorded time is ≤ `timestamp` and read backwards up to 50 prior messages (or until the file start). This is the friction window. The analyst is NOT permitted to read forward of `timestamp` — the pin captures a moment, and the engineer's downstream messages may include unrelated work.
4. **Classify the friction.** Choose exactly one of:
- **`friction`** — the transcript shows a Skill or subagent producing an output that felt off (looped, dodged, mis-categorized, took too long, asked a question that revealed a wrong assumption). The friction is real but does not necessarily map onto a kernel gap.
- **`missing-guardrail`** — the transcript shows the workflow allowing something the kernel probably should refuse (an unsafe write, a status flip without the right gate, a halt that should have been an enforcement). The kernel surface implicated is a missing or under-specified rule.
- **`kernel-vs-practice-mismatch`** — the transcript shows the engineer (or the agent) doing something the kernel does not name but probably should, OR doing something the kernel does name but in a way the kernel's rule does not actually fit. The kernel surface implicated is a named contract that needs revision or extension.
- **`not-actionable`** — the transcript shows friction that is real but does not point at any kernel surface. Common causes: engineer was unfamiliar with an existing rule (training gap, not kernel gap); the friction was a one-time external factor (slow network, MCP timeout); the friction was an engineer-error that the kernel cannot reasonably guard against.
- **`transcript-truncated`** — set per step 2 above. The pin's transcript was unreachable or compacted.
5. **Decide fold-vs-emit-vs-close.**
- **Fold** when classification is `friction`, `missing-guardrail`, or `kernel-vs-practice-mismatch` AND the friction maps onto an in-flight finding's pattern AND kernel surface. Find the matching open or acknowledged finding from this session's writes or from the prior-findings load. Append an evidence row to that finding's `evidence-rows` array (one new entry) and increment `evidence-row-count`. Update the finding's prose `## Evidence` section by appending a 2–3 sentence summary of the flag's contribution with a citation back to the pin id. Set `folded-into: <KF-id>` on the pin. The fold edit on the finding lands in the same write sequence as the pin transition to processed/.
- **Emit** when classification is `friction`, `missing-guardrail`, or `kernel-vs-practice-mismatch` AND no existing finding's pattern + kernel surface maps the friction. Write a new finding at `hstack/kernel-fit/findings/KF-<NNNN>-<slug>.md` with `detected-via: flag`, `pattern: KF-FLAG-<NNNN>` (or a fresh pattern slug derived from the friction; document the pattern slug in the `## Pattern fired` section as "flag-originated, no detector pattern yet"), and a single evidence row pointing at the pin id. The finding's body fields are populated per the standard template (Title, Pattern fired, Evidence, Kernel surface implicated, Proposed direction, Counter-explanations, Confidence rationale, Triage Log). Set `emitted-as: <KF-id>` on the pin.
- **Close** when classification is `not-actionable` or `transcript-truncated`. No finding is written. Leave `folded-into: null` and `emitted-as: null` on the pin.
6. **Move the pin file** from `pending/` to `processed/`. The Skill orchestrator performs the `git mv` as part of step 5's same atomic commit; the analyst's responsibility is to update the pin's frontmatter (set `status: processed`, set `classification`, set `classification-rationale`, set `folded-into` or `emitted-as` as appropriate, set `updated: <today>`) in-place. The Skill moves the file. The analyst is **not permitted** to re-process pins already in `processed/` — re-evaluation requires a fresh flag from the engineer.
7. **Report the flag-processing counts.** Return to the calling Skill: a small object `{ "processed": <int>, "folded": <int>, "emitted": <int>, "not_actionable": <int>, "transcript_truncated": <int> }`. The Skill uses these for the Slack-nudge tail summary.
**Discipline rules specific to flag processing.**
- **No forward reading.** The analyst reads up to 50 turns BEFORE `timestamp`, never after. The pin captures a moment; downstream messages may include unrelated work.
- **No engineer hint reliance.** If `hint` is set on the pin, the analyst MAY read it but MUST NOT let it short-circuit classification reasoning. The hint is for the engineer's future audit, not for the analyst. The classification rationale must defend itself against the transcript window, not against the hint.
- **No re-processing of processed pins.** Once a pin lands in `processed/`, the analyst does not re-classify it. If the same friction recurs, the engineer re-flags and a new pin is created.
- **No emit when the pattern is genuinely vague.** If the analyst cannot point at a specific kernel surface (template, section, Skill line, validator rule) for an emit, classify `not-actionable` instead of writing a vague finding. The kernel-surface specificity rule from the detector-side findings applies identically here.
- **Counter-explanation discipline for emit.** Emitted findings carry the same mandatory two-bullet counter-explanation as detector-originated findings. If two honest counter-explanations cannot be produced, the finding lands at `confidence: low` and does not nudge Slack — same KF-03 discipline.
- **Fold conservatism.** When in doubt between fold and emit, prefer fold — the engineer's triage path (`/hstack:kernel-fit-triage`) is the same either way, and folding keeps the finding count bounded. Over-emit produces noise that erodes the loop's signal.
## Stop conditions

@@ -108,2 +156,3 @@

- A high-confidence finding cannot honestly satisfy KF-02 (would require fabricating evidence rows or citations). Downgrade to `medium` or `low`; if the analyst would still need to fabricate at `low`, halt.
- A pending flag's `session-transcript-path` field is missing or malformed (the pin frontmatter was tampered with). Classify the pin as `transcript-truncated` with a rationale naming the missing field; this is a graceful degradation, not a halt — the loop must continue processing the remaining pins.

@@ -133,2 +182,6 @@ Halting is not failure. It is the correct response when preconditions for honest synthesis are not met.

- Never claim the analyst's output is measured truth. Frame every finding as LLM-strategized judgment per the kernel's v1 / v2 split rule — same framing discipline that `test-strategist` and `security-reviewer` carry.
- Never read forward of a pin's `timestamp` when processing flags. The window is strictly preceding turns. Reading post-pin content contaminates classification with work the engineer did after the friction was captured.
- Never re-process a pin already in `processed/`. Re-evaluation requires a fresh flag.
- Never let a pin's `hint` field short-circuit classification. The hint is engineer-audit metadata, not analyst input. Classification rationale must defend itself against the transcript window.
- Never emit a flag-originated finding without a specific kernel-surface pointer. Vague emit produces noise; classify `not-actionable` instead.

@@ -135,0 +188,0 @@ ## Confirmation discipline

@@ -81,10 +81,14 @@ ---

3. **Decide whether to invoke the subagent.** Parse the JSON. If every pattern has `fired: false`, exit clean: print "kernel-fit-scan: no patterns fired in window — kernel is consistent with shipped practice in current corpus" to stdout, write nothing, do not invoke the subagent, do not nudge Slack, do not commit. This is the most common outcome on a healthy repo.
3. **Enumerate pending engineer flags.** Glob `hstack/kernel-fit/flags/pending/*.md`. Capture the list (may be empty). The analyst processes these per ADR-0005's Pending Flags Processing loop documented in `template/.claude/agents/kernel-fit-analyst.md`; this Skill is responsible for surfacing the list to the analyst and for the post-analyst pin-file moves at step 5.
4. **Invoke `kernel-fit-analyst`.** When at least one pattern fired, invoke via Task tool with `subagent_type: kernel-fit-analyst`. The prompt includes (a) the JSON evidence blob verbatim, (b) the canonical reminder of session-isolation (no implementer transcripts loaded), (c) the explicit instruction "one file per fired pattern; mandatory two-bullet counter-explanation; never write outside `hstack/kernel-fit/findings/`". The subagent's writes land in the working tree before the subagent returns.
4. **Decide whether to invoke the subagent.** Parse the detector JSON. If every pattern has `fired: false` **and** no pending flags exist, exit clean: print "kernel-fit-scan: no patterns fired in window, no pending flags — kernel is consistent with shipped practice in current corpus" to stdout, write nothing, do not invoke the subagent, do not nudge Slack, do not commit. If patterns fired OR pending flags exist (or both), proceed to step 5.
5. **Stage and commit findings.** Compute the set of newly-written or modified finding files (analyst may have superseded a prior finding atomically with a new one). Print the proposed diff for engineer confirmation (per the kernel's "AI writes, humans confirm" mechanical-operations adaptation). On Y/n confirmation `Y` (default Yes), `git add` the finding files and commit with message `kernel-fit: <N> finding(s) detected` (or `kernel-fit: <N> finding(s) detected, <M> superseded` when supersession edits also landed). One commit per scan run, atomic across all new/edited findings.
5. **Invoke `kernel-fit-analyst`.** Invoke via Task tool with `subagent_type: kernel-fit-analyst`. The prompt includes (a) the JSON evidence blob verbatim, (b) the list of pending flag paths from step 3 (or "no pending flags" when empty), (c) the canonical reminder of session-isolation (no implementer transcripts loaded), (d) the explicit instruction "one file per fired pattern; mandatory two-bullet counter-explanation; never write outside `hstack/kernel-fit/findings/`; process pending flags per the Pending Flags Processing section of the analyst prompt". The subagent's writes land in the working tree before the subagent returns. The analyst's response object reports the flag-processing counts (`processed`, `folded`, `emitted`, `not_actionable`, `transcript_truncated`).
6. **Notification — Slack nudge (best-effort).** Compute the notification set:
6. **Move processed pin files.** For each pin the analyst updated to `status: processed`, `git mv hstack/kernel-fit/flags/pending/<pin>.md hstack/kernel-fit/flags/processed/<pin>.md`. Create the `processed/` directory if missing. This move lands in the same commit as the finding writes at step 7 — the analyst's pin frontmatter updates (classification, classification-rationale, folded-into, emitted-as, status) plus the file move must be atomic from git's perspective. **Note**: pin files are gitignored per ADR-0005, so `git mv` operates only on the filesystem (git will not stage either side). The "atomicity" here is filesystem-only — the analyst's in-place frontmatter update and the directory move complete together before stdout reports flag-processing counts. If the gitignore is later relaxed (would require an ADR amendment), this step's `git mv` becomes a real staged operation.
7. **Stage and commit findings.** Compute the set of newly-written or modified finding files (analyst may have superseded a prior finding atomically with a new one, or appended evidence rows to existing findings via fold). Print the proposed diff for engineer confirmation (per the kernel's "AI writes, humans confirm" mechanical-operations adaptation). On Y/n confirmation `Y` (default Yes), `git add` the finding files and commit with message `kernel-fit: <N> finding(s) detected` (or `kernel-fit: <N> finding(s) detected, <M> superseded` when supersession edits landed; or `kernel-fit: <N> finding(s) detected (<F> from flags), <M> superseded` when flag-emit landed). One commit per scan run, atomic across all new/edited findings. When patterns did not fire and only pending flags were processed, the commit message reads `kernel-fit: <F> flag(s) processed (<E> emit, <FF> fold, <NA> not-actionable, <TT> transcript-truncated)`.
8. **Notification — Slack nudge (best-effort).** Compute the notification set:
```

@@ -101,4 +105,4 @@ notify = [f for f in newly_written_findings

• KF-NNNN — <title> [confidence: high|medium]
Pattern: <KF-P1|KF-P2|KF-P3>
• KF-NNNN — <title> [confidence: high|medium] [via: detector|flag]
Pattern: <KF-P1|KF-P2|KF-P3|KF-FLAG-NNNN>
Kernel surface: <one-line>

@@ -112,8 +116,14 @@ hstack/kernel-fit/findings/KF-NNNN-<slug>.md

Bundle multiple findings into a single message when more than one fires in this scan.
Bundle multiple findings into a single message when more than one fires in this scan. When flag-processing occurred, append the **flag tail summary** as the last line of the same Slack message:
7. **Graceful degradation when Slack is unreachable.** If the MCP call raises (tool not configured, network failure, channel-not-found, etc.), log to stderr: `kernel-fit: Slack MCP unreachable; <N> finding(s) written to disk without notification. Triage via /hstack:help to discover open findings.` Exit 0. The disk write from step 5 is the load-bearing action; Slack is a side-channel pointer. This is a deliberate carve-out from the kernel's general MCP-unreachable stop condition — Slack is not load-bearing for kernel-fit (the canonical state lives on disk and is reachable via `/hstack:help`). The carve-out is documented here and in the kernel's `## How hstack improves itself` section.
```
Flags processed: <P> total — <FF> folded, <E> emitted, <NA> not-actionable, <TT> transcript-truncated.
```
8. **Report.** Print to stdout: the count of patterns fired, the count of new findings written, the count of supersessions, the count of Slack notifications fired (or "skipped — Slack unreachable" / "skipped — within dedup window for all findings"). Done.
The tail is included only when at least one pin was processed AND at least one of `folded` or `emitted` is non-zero, OR when `transcript_truncated > 0` (the transcript-truncated count is operationally interesting because it surfaces v1-heuristic edge cases the engineer should know about). When every processed pin was classified `not-actionable` the tail is suppressed — it would otherwise be pure noise. When the scan produces zero detector findings AND only `not-actionable` pin processing, the Slack message is suppressed entirely (no findings, no tail-worthy signal).
9. **Graceful degradation when Slack is unreachable.** If the MCP call raises (tool not configured, network failure, channel-not-found, etc.), log to stderr: `kernel-fit: Slack MCP unreachable; <N> finding(s) written to disk without notification. <P> flag(s) processed; triage via /hstack:help to discover open findings.` Exit 0. The disk write from step 7 is the load-bearing action; Slack is a side-channel pointer. This is a deliberate carve-out from the kernel's general MCP-unreachable stop condition — Slack is not load-bearing for kernel-fit (the canonical state lives on disk and is reachable via `/hstack:help`). The carve-out is documented here and in the kernel's `## How hstack improves itself` section.
10. **Report.** Print to stdout: the count of patterns fired, the count of new findings written, the count of supersessions, the count of flags processed broken down by classification (`folded`, `emitted`, `not-actionable`, `transcript-truncated`), and the count of Slack notifications fired (or "skipped — Slack unreachable" / "skipped — within dedup window for all findings" / "skipped — no signal worth surfacing"). Done.
## Outputs

@@ -123,15 +133,19 @@

- Zero or more supersession edits (status flip + `superseded-by` set) on prior finding files.
- Zero or one git commits.
- Zero or one Slack messages (bundled when multiple findings notify).
- Zero or more evidence-row appends to existing findings (from flag fold).
- Zero or more pin transitions from `hstack/kernel-fit/flags/pending/` to `hstack/kernel-fit/flags/processed/` with `status: processed` and the analyst-owned classification fields populated. Pins are gitignored per ADR-0005, so the moves are filesystem-only — not staged in git.
- Zero or one git commits (covering finding writes only; pin moves are not staged).
- Zero or one Slack messages (bundled when multiple findings notify, with the flag tail summary appended when applicable).
## Auto-commit triggers
- One commit at the writing of finding files (per the kernel's auto-commit-at-status-transition rule applied at the artifact-creation moment). No commit when no patterns fire.
- One commit at the writing of finding files (per the kernel's auto-commit-at-status-transition rule applied at the artifact-creation moment). No commit when no patterns fire AND no flag-emit or flag-fold landed (i.e., only `not-actionable` / `transcript-truncated` flag processing occurred). Pin file moves are filesystem-only (pins are gitignored) and do not require a commit.
## Idempotency contract
- Re-running the Skill when no patterns fire: zero new disk artifacts, no commit, no Slack message. Pure no-op.
- Re-running the Skill when no patterns fire AND no pending flags exist: zero new disk artifacts, no commit, no Slack message. Pure no-op.
- Re-running when no patterns fire but pending flags exist: the analyst is invoked to process flags only. Outcomes depend on classification — fold/emit may produce finding writes and a commit; not-actionable/transcript-truncated produce only pin moves (no commit).
- Re-running when patterns fire that already have open findings within the dedup window: the analyst is invoked, sees existing findings, and may skip-write or supersede; Slack notification is suppressed by the dedup gate.
- Re-running when the same patterns fire with new evidence: the analyst may produce supersession edits; the dedup gate still suppresses Slack (already-notified within the window).
- Re-running with `--no-slack`: identical to a run with Slack unreachable — findings land on disk, no Slack message.
- Re-running with `--no-slack`: identical to a run with Slack unreachable — findings land on disk, flags are processed normally, no Slack message.
- Re-running after pending flags were processed in a prior scan: the prior pins are now in `processed/` and the analyst is forbidden from re-processing them (per the kernel-fit-analyst's discipline rules). Only newly-flagged pins (added to `pending/` since the last scan) are processed this run.

@@ -185,1 +199,4 @@ ## Stop conditions

- Never bundle a Slack notification across scan runs. One scan, one message (or zero, when the dedup gate suppresses or Slack is unreachable).
- Never re-process a pin already in `hstack/kernel-fit/flags/processed/`. The analyst's discipline rule (no re-processing) is mirrored here: the Skill globs only `pending/`, never `processed/`. If the engineer believes a processed pin was mis-classified, the path is to re-flag (creating a fresh pin), not to move the prior pin back.
- Never include the flag tail summary in the Slack message when every pin was classified `not-actionable`. The tail's purpose is to surface actionable signal — the all-not-actionable case is pure noise and the suppression is deliberate.
- Never commit a pin move. Pins are gitignored per ADR-0005; the `git mv` from `pending/` to `processed/` is filesystem-only and produces no staged change.

@@ -408,4 +408,6 @@ ---

The loop is the smallest expression of the kernel reasoning about itself without auto-modifying itself. v1 honesty: the analyst's output is an LLM-strategized judgment, not measured truth; the counter-explanation challenge is the false-positive mitigation. Same framing rule as `test-strategist` and `security-reviewer`. See ADR-0004 for the rationale; see `template/templates/kernel-fit-finding.md` for the artifact schema.
- **Engineer-triggered flags feed the loop with in-the-moment friction signal.** `/hstack:flag [hint]` is a one-shot Skill that drops a tiny frontmatter-only pin to `hstack/kernel-fit/flags/pending/` carrying session-id, transcript path, branch, HEAD, and timestamp. No interview, no confirmation, no commit, sub-second wall-clock. The next `/hstack:kernel-fit-scan` reads each pin, opens the referenced Claude Code session transcript, classifies the friction (`friction | missing-guardrail | kernel-vs-practice-mismatch | not-actionable | transcript-truncated`), then folds the signal into an existing finding or emits a new one with `detected-via: flag`. The pin carries no engineer interpretation of the friction — the analyst forms its classification from the transcript window, preserving the no-contamination contract. Pins are gitignored in the consuming repo (derivative signal, mirroring `.telemetry/` sidecars); the audit trail lives at the finding layer once the analyst processes them. Phase-1 of ADR-0005 ships the Skill and pin template; phase-2 ships the analyst processing extension — until phase-2 lands, pins accumulate harmlessly on disk. See ADR-0005 for the rationale and the trade-offs.
The loop is the smallest expression of the kernel reasoning about itself without auto-modifying itself. v1 honesty: the analyst's output is an LLM-strategized judgment, not measured truth; the counter-explanation challenge is the false-positive mitigation. Same framing rule as `test-strategist` and `security-reviewer`. See ADR-0004 for the detector-side rationale, ADR-0005 for the engineer-trigger side; see `template/templates/kernel-fit-finding.md` and `template/templates/kernel-fit-flag.md` for the artifact schemas.
---

@@ -412,0 +414,0 @@

@@ -9,2 +9,3 @@ ---

detected-by: kernel-fit-analyst
detected-via: detector # detector | flag — `detector` (default) when the finding came from kernel_fit.py pattern matching; `flag` when the finding originated from a /hstack:flag pin (ADR-0005). For folded-in findings (flag signal merged into an existing detector-finding), `detected-via` remains `detector` because the originating signal was the detector pattern.
detected-at: <ISO-8601 timestamp>

@@ -11,0 +12,0 @@ evidence-row-count: 0 # integer; must equal len(evidence-rows) per KF-01

@@ -1,1 +0,1 @@

0.3.0
0.4.0