@chrono-meta/fh-gate 1.4.16 → 1.4.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CATALOG.md CHANGED
@@ -8,6 +8,11 @@ AI reads this file first when searching past work. Open individual files for det
8
8
 
9
9
  <!-- Add entries in reverse date order (newest at top) -->
10
10
 
11
+ ### 2026-06-13 | forge-harness | #sidecar-eol-proofing, #agy, #liveness-probe, #rubber-stamp-guard, #upstream-report
12
+ **File:** plugins/fh-meta/skills/{steel-quench,sim-conductor}/SKILL_detail.md + templates/.git-hooks/pre-commit (commit 4693d00)
13
+ Completion sweep of all currently-unblocked carries. FP3: agy joins the sidecar panel as T5 (argument form `agy -p` only — stdin pipe prints help, measured; 60s timebox+1 retry hard rule; trusted-artifacts caution since -p auto-approves tools) and gemini detection becomes a dispatch-form stdin liveness probe (EOL 2026-06-18 leaves the binary alive, backend dead — bare `command -v` goes silently stale). Ack hardening: `below-floor-ack:` now requires a verbatim-quoted operator utterance (unquoted reason = agent-self-writable = blocked; residuals — quote fabrication, out-of-context quoting — named as weekly-audit targets). Challenger round: 1S/4A fixed (cross-fence tb() self-containment, probe-form/dispatch-form mismatch, T1~T5, empty-team synthesis gate, comment overclaim); B1 curly-quote locale block refuted by live test. FP1 closed upstream: increment comment (auto-compact non-recovery + 76% non-repro control) posted to anthropics/claude-code#65359 with operator approval. Knowledge orphans resolved: 3 gitignored paper files de-orphaned (unique framework rescued to companion store, stale dupes deleted).
14
+ - Decision: probe must exercise the same invocation form the dispatch uses (forms diverge on one binary — agy proved it); hook enforces ack form, weekly audit owns genuineness.
15
+
11
16
  ### 2026-06-11 | forge-harness | #readme-dedup, #commoditization-defense, #b1-boundary, #seed-vetting, #field-routing
12
17
  **File:** README.md (PR #93) + fh-be signals/handoffs (PR #24+) + field project v0.14 (private track)
13
18
  Cloud session #4 (Mode D, remote-doable batch): README stale duplicate "Measured, not asserted" block removed (pre-tier-floor copy contradicted default-Sonnet stance) + "Where this sits (2026)" positioning para (gate+loop are the asset — plumbing commoditizes). fh-be: B1 scope boundary (AW2 simple-vs-complex import), SC1–4 seed vetting (SC1 phantom arXiv fixed → 2509.19349; SC3 commoditization threat to bet ID), gstack positioning-triangle line. Field: private-track companion handoff verified+executed — DefectPatternMatcher+Bug Mode implemented UTF-8-clean in the field repo (25 tests PASS, 0 regressions); its OpenCode(sLLM) lane's downgrade triage hardened to 2-tier (keep/block) with free-tier 80/20 split — β/SC2 field case logged.
@@ -153,7 +158,7 @@ Added canonical §Sidecar Engine Resolution Protocol — Tier1 subscription-CLI
153
158
  ### 2026-06-09 | forge-harness | #onboarding, #greeting, #3-axis-scaffold, #returning-user
154
159
  **File:** knowledge/shared/harness-core/fh_detail_protocols.md
155
160
  Returning-user greeting (Step 2): single free-form e.g. line → fixed 3-axis entry scaffold (① connect new → auto_project_mapping · ② resume existing → filled live from CATALOG · ③ jump to work), plus a "keep axes fixed, compose contents per situation" note. PR #80.
156
- - Decision: axis ② read live from CATALOG each session so the menu can't go stale — qasp-style clarity without rigidity.
161
+ - Decision: axis ② read live from CATALOG each session so the menu can't go stale — field-harness-style clarity without rigidity.
157
162
 
158
163
  ### 2026-06-05 | _audit | sister-asset, gstack, field-harness, garry-tan
159
164
  **File:** tracks/_audit/session_2026_06_05_gstack-sister.md (private companion mirror)
package/CHEATSHEET.md CHANGED
@@ -98,7 +98,7 @@ git config core.hooksPath templates/.git-hooks
98
98
  chmod +x templates/.git-hooks/pre-commit
99
99
  ```
100
100
 
101
- After running `/steel-quench` and `/phantom-quench` in your session, Claude creates the Axes 2+3 pass marker automatically. The marker must carry machine-readable floor fields — the hook validates them (a bare `touch` marker no longer passes; below-floor passes block unless an explicit `below-floor-ack:` line records operator acceptance). If Claude doesn't create it (e.g., session interrupted), create it manually:
101
+ After running `/steel-quench` and `/phantom-quench` in your session, Claude creates the Axes 2+3 pass marker automatically. The marker must carry machine-readable floor fields — the hook validates them (a bare `touch` marker no longer passes; below-floor passes block unless an explicit `below-floor-ack:` line records operator acceptance, **quoting the operator's approval utterance verbatim** — an unquoted reason is rejected as agent-self-writable). If Claude doesn't create it (e.g., session interrupted), create it manually:
102
102
 
103
103
  ```bash
104
104
  cat > "tracks/_meta/.axes_23_passed_$(git rev-parse --abbrev-ref HEAD | tr '/' '_')_$(date +%Y-%m-%d).marker" <<'EOF'
package/CLAUDE.md CHANGED
@@ -101,7 +101,7 @@ Simplification guard: trivial denials with one obvious fix → state block + sin
101
101
 
102
102
  **Triggers**: greetings (`hi`/`hello`/`hey`/`안녕` — and the same word in any language; FH is English-based but language-agnostic, a bare greeting in any tongue fires this) · start intent (`resume`, `continue`, `where were we`) · new task (`new project`, `new task`) · discovery (`what is this`, `what can you do`, `first time here`)
103
103
 
104
- **4-step summary**: ① Auto-read CLAUDE.md + CATALOG + session card + registry scan → ② One-line proposal (new user / exploratory / returning branches) → ③ 5-skill cascade (plugin-recommender → synergy → .claudeignore → model → verify) → ④ Approval + setup
104
+ **4-step summary**: ① Auto-read CLAUDE.md + CATALOG + session card + registry scan + UAP (`tracks/_meta/user_adaptation_profile.md`, if present — apply user-tuned defaults: preferred tier, suppressed proposals, muted nags; see §Operational Adaptation Loop) → ② One-line proposal (new user / exploratory / returning branches) → ③ 5-skill cascade (plugin-recommender → synergy → .claudeignore → model → verify) → ④ Approval + setup
105
105
 
106
106
  **Greeting branch + door skeleton (summary-level — applies even if the detail file read is skipped)**: the branch test is **mechanical local state — session files under `tracks/`** — never git log / CATALOG residue (a fresh clone carries full history but zero session files: it is a NEW install — origin: a fresh-clone sonnet sim rendered the returning menu off commit messages, `fh_signal_2026-06-11` FP8). Every variant opens with **🐿️ on its own line as the skeleton's first line** — the marker is part of the skeleton, one salience unit with the menu, not a separate rule.
107
107
 
@@ -333,7 +333,7 @@ Proposal format: `"I see [X]. Want me to run /[skill] to [one-line description]?
333
333
  | "memory feels bloated", "clean up memory", "memory too large", "memory hygiene" | `/memory-hygiene` |
334
334
  | "ready to PR", "about to push", "merge this", "PR 올려줘", FH asset changed in session | 4-axis auto-gate (see above — runs automatically, no proposal needed) |
335
335
 
336
- **Guard**: Do not propose a skill that is already running. One signal = one-line proposal (no pressure).
336
+ **Guard**: Do not propose a skill that is already running. One signal = one-line proposal (no pressure). Before proposing, consult the UAP (§Operational Adaptation Loop): a skill the user has rejected 3+ times is **suppressed**, not re-proposed.
337
337
  For per-skill utterance patterns, see the relevant `SKILL.md §Trigger Phrases` section.
338
338
 
339
339
  ### Cadence Rules — Check at Session Start
@@ -345,6 +345,19 @@ At session start, determine the last run time from history files and auto-propos
345
345
  | `/frontier-digest` | `tracks/_meta/frontier_digest_*.md` | Propose at session start if 7+ days since last run |
346
346
  | `/harness-doctor` | `tracks/_meta/*harness_doctor*.md` | Propose at session start if 30+ days since last run |
347
347
 
348
+ > A cadence reminder the user has repeatedly declined is **muted** per the UAP (see the loop below) — don't re-nag.
349
+
350
+ ## Operational Adaptation Loop — User-Tuned Self-Optimization
351
+
352
+ > Detail: `.claude/rules/operational_adaptation.md`
353
+
354
+ Self-healing is not only FH-self-dev (Mode D 4-axis) and reactive (`verify-bidirectional`). A **standing, per-user operational loop** tunes FH behavior to the individual during normal field use, and escalates **only generalizable** learnings to the `field-harvest` → FH-origin PR funnel — idiosyncratic taste stays local (drift guard).
355
+
356
+ - **User Adaptation Profile (UAP)** — `tracks/_meta/user_adaptation_profile.md` (local/gitignored; **behavioral prefs only, never domain content**). Records skill-proposal outcomes (`accepted`/`rejected`/`sustained` — same vocabulary as `operations.md`), preferred tier/language/cadence, recurring friction, muted nags.
357
+ - **Pass** — rides `field-harvest` Mode B at field-session close (no new trigger, one per session): READ to apply (suppress a 3×-rejected proposal, default to preferred tier, mute declined cadence nags), WRITE to update outcomes.
358
+ - **Generalization gate** — idiosyncratic → UAP local; generalizable (any user benefits; `≥40%` reject = redefine candidate / `≥60%` accept = reinforce, per `operations.md` gate) → `field-harvest` Mode A → FH PR (HITL).
359
+ - **Ephemeral guard** — UAP is gitignored, wiped on cloud reclaim; in ephemeral sessions operate from defaults, do not fabricate it.
360
+
348
361
  ## Agent Dispatch Operation (FH cwd-Based)
349
362
 
350
363
  Default operation is a **standard interactive session**. Agent dispatch (single or parallel) is used when the task warrants it — not as a default mode. Three execution paths:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chrono-meta/fh-gate",
3
- "version": "1.4.16",
3
+ "version": "1.4.18",
4
4
  "description": "FH runtime adapters — run FH governance, skills, and agents via Claude or Codex with machine-parseable gates.",
5
5
  "license": "MIT",
6
6
  "keywords": [
@@ -25,22 +25,12 @@ Diagnoses the 3 main causes of session token waste and prescribes immediate reme
25
25
 
26
26
  ### Step 1. `.claudeignore` Diagnosis + Generation
27
27
 
28
- ```bash
29
- # Check whether .claudeignore exists in current project root
30
- ls -la .claudeignore 2>/dev/null || echo "MISSING"
31
- ```
28
+ Check whether `.claudeignore` exists in the project root (bash in §Step-Bash).
32
29
 
33
30
  **If absent**: Scan project structure and auto-generate.
34
31
 
35
32
  **If already present**: Keep existing content + suggest additional patterns only (no overwrite). Check for sentinel comment (`# context-doctor:`) and add to first line if absent.
36
33
 
37
- ```bash
38
- # Project type detection
39
- ls package.json pyproject.toml build.gradle pom.xml 2>/dev/null | head -5
40
- # Top-level directory list
41
- ls -d */ 2>/dev/null | head -20
42
- ```
43
-
44
34
  Generation criteria — by project type:
45
35
 
46
36
  | Detected type | Additional patterns |
@@ -58,25 +48,13 @@ Automatically add sentinel comment to first line when generating/updating:
58
48
  ```
59
49
  → Suppresses auto-invocation in subsequent sessions.
60
50
 
61
- ### Step 2. Large File Detection + Split Strategy Guidance
51
+ > **Detail**: See `SKILL_detail.md §Step-Bash` — detection bash for Steps 1/2/4/5, large-file warning format, audit report format — read when executing any step's commands.
62
52
 
63
- ```bash
64
- # Detect files exceeding 500 lines (top 10)
65
- find . -name "*.py" -o -name "*.ts" -o -name "*.tsx" -o -name "*.js" -o -name "*.java" -o -name "*.kt" \
66
- | grep -v node_modules | grep -v .git \
67
- | xargs wc -l 2>/dev/null | sort -rn | head -11 | tail -10
68
- ```
53
+ ### Step 2. Large File Detection + Split Strategy Guidance
69
54
 
70
- When files exceeding 500 lines are found:
55
+ Detect files exceeding 500 lines (top 10 — bash in §Step-Bash) and output the split-read guidance per file (offset + limit, section by section).
71
56
 
72
- ```
73
- ⚠️ Large file detected: {filename} ({N} lines)
74
- Full read cost: ~{token count} tokens
75
- Recommended: split reads with offset + limit
76
- Example: Read({filename}, offset=0, limit=100) → proceed section by section
77
- ```
78
-
79
- **Repeated full-read pattern** (burst pattern) detection criteria:
57
+ **Repeated full-read pattern** (burst pattern) detection criteria (behavioral):
80
58
  - 3+ files over 500 lines exist and `.claudeignore` was absent
81
59
  - User mentions "read it all at once" / "re-read the whole thing every time"
82
60
 
@@ -119,49 +97,15 @@ When context is near the limit and you want to *preserve state* rather than rese
119
97
 
120
98
  ### Step 4. harvest-loop Integration (burst pattern recording)
121
99
 
122
- When burst pattern is detected (if `tracks/_audit/` exists):
123
-
124
- ```bash
125
- # Check latest weekly_audit file
126
- ls -1t tracks/_audit/weekly_audit_*.md 2>/dev/null | head -1
127
- ```
100
+ When burst pattern is detected and `tracks/_audit/` exists: locate the latest weekly_audit file and suggest adding the Token Efficiency Check items to it (bash + checklist block in §Step-Bash).
128
101
 
129
- If found: Suggest adding the following to the `## Check Items` or `## Token Efficiency` section of that file:
130
-
131
- ```markdown
132
- ### Token Efficiency Check (context-doctor)
133
- - [ ] .claudeignore is up to date
134
- - [ ] 500+ line large files list and whether split reads are followed
135
- - [ ] Whether burst pattern occurred (3+ full reads of same large file)
136
- - [ ] Whether /clear was used after direction changes
137
- ```
138
-
139
- Environments without `tracks/_audit/` (Mode C — plugin only):
140
- → Output items to terminal only, skip file writes.
102
+ Environments without `tracks/_audit/` (Mode C plugin only): output items to terminal only, skip file writes.
141
103
 
142
104
  ### Step 5. CC Context Structure Regular Audit (Hub Environment Only)
143
105
 
144
- **Hub environment detection condition**: CLAUDE.md contains "your-hub" or "meta hub" + `memory/MEMORY.md` exists.
145
-
146
- ```bash
147
- # CLAUDE.md line count
148
- wc -l CLAUDE.md .claude/CLAUDE.md 2>/dev/null | sort -rn | head -3
106
+ **Hub environment detection condition**: CLAUDE.md contains "your-hub" or "meta hub" + `memory/MEMORY.md` exists. Skip Step 5 when not in a hub environment.
149
107
 
150
- # MEMORY.md line count (200-line limit)
151
- wc -l memory/MEMORY.md 2>/dev/null
152
-
153
- # memory/*.md files exceeding 30K
154
- find memory -name "*.md" -size +30k 2>/dev/null | xargs wc -l | sort -rn | head -10
155
-
156
- # SKILL.md files > 300 lines with no SKILL_detail.md (skill-splitter candidates)
157
- find plugins -name "SKILL.md" 2>/dev/null | while read f; do
158
- lines=$(wc -l < "$f")
159
- detail=$(dirname "$f")/SKILL_detail.md
160
- [ "$lines" -gt 300 ] && [ ! -f "$detail" ] && echo "[skill-splitter candidate] $f ($lines lines)"
161
- done
162
- ```
163
-
164
- **Audit thresholds + prescriptions**:
108
+ Run the audit bash (§Step-Bash) and apply thresholds:
165
109
 
166
110
  | Target | Threshold | Prescription |
167
111
  |---|---|---|
@@ -170,20 +114,8 @@ done
170
114
  | memory/*.md single file | Exceeds 30K (300 lines) | Suggest splitting accumulated history into separate files |
171
115
  | SKILL.md (any) | > 300 lines AND no SKILL_detail.md | Propose `/skill-splitter` — governance-semantic split (not compression); compression removes content, splitting routes it on-demand |
172
116
 
173
- Audit result report format:
174
- ```
175
- CC Context Audit Results
176
- CLAUDE.md: {N} lines {status}
177
- MEMORY.md: {N} lines / 200-line limit ({remaining} lines remaining)
178
- Bloated files ({30K+}):
179
- - {filename}: {N} lines → compression recommended
180
- Recommended actions: {summary}
181
- ```
182
-
183
117
  **Frequency**: When explicitly called with `/context-doctor` or auto-invoked at session start when MEMORY.md is detected at 180+ lines.
184
118
 
185
- > Skip Step 5 when not in a hub environment.
186
-
187
119
  ## Context Hierarchy (L1/L2/L3)
188
120
 
189
121
  Information buried in the middle of a long context window suffers measurable accuracy loss — the "lost in the middle" effect, ~10–30% degradation for mid-context information (see `../../../../knowledge/shared/harness-core/harness_frontier_diagnosis_2026-06-02.md`). The remedy is two-fold: tier the context, and place the most important instructions at the **start and end**, never buried in the middle.
@@ -216,25 +148,7 @@ Advisory and tool-agnostic — recommend (and, where a doc is being authored/edi
216
148
 
217
149
  Keep it reversible: compress the *working copy* in context, not the source of truth on disk, unless the user is explicitly editing that file.
218
150
 
219
- ### Tooling Headroom (external option)
220
-
221
- The advisory pass above is tool-agnostic, but a concrete, reversible, local-first implementation exists: **Headroom** (`github.com/chopratejas/headroom`, open source, v0.22). It compresses tool outputs, logs, files, and RAG chunks before they reach the LLM — **vendor/coverage-reported** at 60–95% fewer tokens with the same answers ([The Register, 2026-05-31](https://www.theregister.com/ai-ml/2026/05/31/netflix-wiz-creates-app-to-slash-ai-bills-then-open-sources-it/5248702); figures unverified by FH). General token-efficiency basis: `../../../../knowledge/shared/harness-core/harness_frontier_diagnosis_2026-06-02.md`.
222
-
223
- **Redundancy-category targeting** (its key insight — import this into the pass): the high-yield targets are *machine-generated, schema-repetitive* payloads, not prose. Prioritize compressing, in order:
224
-
225
- 1. **MCP tool outputs** — ~70% redundant JSON (most relevant to FH: heavy MCP sessions burn tokens here).
226
- 2. **Logs** — ~90% jettisonable.
227
- 3. **DB dumps / structured query output** — one schema, repeated rows.
228
- 4. **File trees / directory listings** — repeated path metadata.
229
-
230
- Plain prose docs compress far less — spend the budget on the four categories above first.
231
-
232
- **Integration surfaces** (all local, runtime-side — outside the FH repo, so for the user's local setup, not a hub asset):
233
- - **Library** — `compress(messages)` inline (Python/TS).
234
- - **Proxy** — `headroom proxy --port 8787`, zero code change, then point the client at it.
235
- - **MCP server / agent-wrap** — wrap an MCP server or the agent CLI directly.
236
-
237
- Caveats: v0.22 is still early — pilot before relying on it; compression carries a quality/accuracy tradeoff, so its local-first + reversible design (matching the reversibility rule above) is the safeguard. See the repo for exact config — do not assume flags.
151
+ > **Detail**: See `SKILL_detail.md §Headroom` external tooling option (redundancy-category targeting, integration surfaces, caveats) — read when executing a compression pass and considering tooling.
238
152
 
239
153
  ## External User Environment Adaptation
240
154
 
@@ -0,0 +1,114 @@
1
+ ---
2
+ name: context-doctor-detail
3
+ description: Detail reference for context-doctor — per-step detection bash, audit report formats, Headroom tooling notes. Load when executing a specific step.
4
+ load: on-demand
5
+ ---
6
+
7
+ # context-doctor — Detail Reference
8
+
9
+ > Load when executing a specific step. SKILL.md contains the diagnosis causes, per-step behavioral rules and thresholds, context hierarchy, compression pass principles, triggers/suppress mechanism, and Done When.
10
+
11
+ ---
12
+
13
+ ## §Step-Bash
14
+
15
+ ### Step 1 — `.claudeignore` existence + project type detection
16
+
17
+ ```bash
18
+ # Check whether .claudeignore exists in current project root
19
+ ls -la .claudeignore 2>/dev/null || echo "MISSING"
20
+ ```
21
+
22
+ ```bash
23
+ # Project type detection
24
+ ls package.json pyproject.toml build.gradle pom.xml 2>/dev/null | head -5
25
+ # Top-level directory list
26
+ ls -d */ 2>/dev/null | head -20
27
+ ```
28
+
29
+ ### Step 2 — Large file detection + warning format
30
+
31
+ ```bash
32
+ # Detect files exceeding 500 lines (top 10)
33
+ find . -name "*.py" -o -name "*.ts" -o -name "*.tsx" -o -name "*.js" -o -name "*.java" -o -name "*.kt" \
34
+ | grep -v node_modules | grep -v .git \
35
+ | xargs wc -l 2>/dev/null | sort -rn | head -11 | tail -10
36
+ ```
37
+
38
+ When files exceeding 500 lines are found:
39
+
40
+ ```
41
+ ⚠️ Large file detected: {filename} ({N} lines)
42
+ Full read cost: ~{token count} tokens
43
+ Recommended: split reads with offset + limit
44
+ Example: Read({filename}, offset=0, limit=100) → proceed section by section
45
+ ```
46
+
47
+ ### Step 4 — weekly_audit lookup + check items block
48
+
49
+ ```bash
50
+ # Check latest weekly_audit file
51
+ ls -1t tracks/_audit/weekly_audit_*.md 2>/dev/null | head -1
52
+ ```
53
+
54
+ If found, suggest adding to the `## Check Items` or `## Token Efficiency` section:
55
+
56
+ ```markdown
57
+ ### Token Efficiency Check (context-doctor)
58
+ - [ ] .claudeignore is up to date
59
+ - [ ] 500+ line large files list and whether split reads are followed
60
+ - [ ] Whether burst pattern occurred (3+ full reads of same large file)
61
+ - [ ] Whether /clear was used after direction changes
62
+ ```
63
+
64
+ ### Step 5 — Hub context audit bash + report format
65
+
66
+ ```bash
67
+ # CLAUDE.md line count
68
+ wc -l CLAUDE.md .claude/CLAUDE.md 2>/dev/null | sort -rn | head -3
69
+
70
+ # MEMORY.md line count (200-line limit)
71
+ wc -l memory/MEMORY.md 2>/dev/null
72
+
73
+ # memory/*.md files exceeding 30K
74
+ find memory -name "*.md" -size +30k 2>/dev/null | xargs wc -l | sort -rn | head -10
75
+
76
+ # SKILL.md files > 300 lines with no SKILL_detail.md (skill-splitter candidates)
77
+ find plugins -name "SKILL.md" 2>/dev/null | while read f; do
78
+ lines=$(wc -l < "$f")
79
+ detail=$(dirname "$f")/SKILL_detail.md
80
+ [ "$lines" -gt 300 ] && [ ! -f "$detail" ] && echo "[skill-splitter candidate] $f ($lines lines)"
81
+ done
82
+ ```
83
+
84
+ Audit result report format:
85
+ ```
86
+ CC Context Audit Results
87
+ CLAUDE.md: {N} lines {status}
88
+ MEMORY.md: {N} lines / 200-line limit ({remaining} lines remaining)
89
+ Bloated files ({30K+}):
90
+ - {filename}: {N} lines → compression recommended
91
+ Recommended actions: {summary}
92
+ ```
93
+
94
+ ---
95
+
96
+ ## §Headroom — Tooling (external option)
97
+
98
+ The compression pass in SKILL.md is tool-agnostic, but a concrete, reversible, local-first implementation exists: **Headroom** (`github.com/chopratejas/headroom`, open source, v0.22). It compresses tool outputs, logs, files, and RAG chunks before they reach the LLM — **vendor/coverage-reported** at 60–95% fewer tokens with the same answers ([The Register, 2026-05-31](https://www.theregister.com/ai-ml/2026/05/31/netflix-wiz-creates-app-to-slash-ai-bills-then-open-sources-it/5248702); figures unverified by FH). General token-efficiency basis: `../../../../knowledge/shared/harness-core/harness_frontier_diagnosis_2026-06-02.md`.
99
+
100
+ **Redundancy-category targeting** (its key insight — import this into the pass): the high-yield targets are *machine-generated, schema-repetitive* payloads, not prose. Prioritize compressing, in order:
101
+
102
+ 1. **MCP tool outputs** — ~70% redundant JSON (most relevant to FH: heavy MCP sessions burn tokens here).
103
+ 2. **Logs** — ~90% jettisonable.
104
+ 3. **DB dumps / structured query output** — one schema, repeated rows.
105
+ 4. **File trees / directory listings** — repeated path metadata.
106
+
107
+ Plain prose docs compress far less — spend the budget on the four categories above first.
108
+
109
+ **Integration surfaces** (all local, runtime-side — outside the FH repo, so for the user's local setup, not a hub asset):
110
+ - **Library** — `compress(messages)` inline (Python/TS).
111
+ - **Proxy** — `headroom proxy --port 8787`, zero code change, then point the client at it.
112
+ - **MCP server / agent-wrap** — wrap an MCP server or the agent CLI directly.
113
+
114
+ Caveats: v0.22 is still early — pilot before relying on it; compression carries a quality/accuracy tradeoff, so its local-first + reversible design (matching the reversibility rule in SKILL.md) is the safeguard. See the repo for exact config — do not assume flags.
@@ -46,38 +46,17 @@ Proposal format (one line, then wait):
46
46
 
47
47
  ## Step 0. Field Project Path Detection
48
48
 
49
- When no path is specified, auto-detect with 3-level priority:
50
-
51
- ```bash
52
- # Priority 1: Read FH auto_project_mapping.md
53
- cat .claude/rules/auto_project_mapping.md 2>/dev/null | grep -E "path:|project:" | head -10
54
-
55
- # Priority 2: Auto-discover git repos in common development directories
56
- find "$HOME/projects" "$HOME/dev" "$HOME/workspace" "$HOME/PycharmProjects" \
57
- -maxdepth 2 -name ".git" -type d 2>/dev/null \
58
- | sed 's|/.git||' \
59
- | grep -v "forge-harness\|harness_framework" \
60
- | head -10
61
-
62
- # Priority 3: Scan parent directory of current cwd
63
- find "$(dirname "$(pwd)")" -maxdepth 1 -name ".git" -type d 2>/dev/null \
64
- | sed 's|/.git||'
65
- ```
49
+ When no path is specified, auto-detect with 3-level priority: ① FH `auto_project_mapping.md` → ② auto-discover git repos in common dev directories (excluding the hub itself) → ③ scan parent of cwd. List discovered repos and ask the user to select; 0 repos → prompt for direct path input.
66
50
 
67
- List discovered repos to user and ask to select target. If 0 repos found, prompt for direct path input.
51
+ > **Detail**: See `SKILL_detail.md §ModeA-Blocks` path-detection bash, commit scan, classification commands, candidate list format, PR creation bash read when executing Mode A Steps 0–4.
68
52
 
69
53
  ## Step 1. Recent Commit Scan
70
54
 
71
- ```bash
72
- cd "$FIELD_PATH"
73
- git log --oneline --since="<N> days ago" --no-merges
74
- ```
75
-
76
- If commit count is 0, report "no changes within last <N> days" and exit.
55
+ Scan `git log --oneline --since="<N> days ago" --no-merges` in the field path. If commit count is 0, report "no changes within last <N> days" and exit.
77
56
 
78
57
  ## Step 2. Harvest Candidate Classification
79
58
 
80
- Classify each commit using the following criteria:
59
+ Classify each commit using the following criteria (commit message + changed-file patterns first → read diff when needed):
81
60
 
82
61
  ### FH Reverse Absorption Candidate Conditions (when one or more apply)
83
62
 
@@ -96,66 +75,13 @@ Classify each commit using the following criteria:
96
75
  - Bug fixes (one-off non-reproducible)
97
76
  - Simple documentation updates
98
77
 
99
- Classification method:
100
-
101
- ```bash
102
- # Commit detail check
103
- git show <hash> --stat
104
- git show <hash> -- "*.md" "*.py" "*.sh" | head -100
105
- ```
106
-
107
- First classify by commit message + changed file patterns → read diff for detail when needed.
108
-
109
78
  ## Step 3. Harvest Candidate List Presentation
110
79
 
111
- ```
112
- field-harvest results — <project name> (within <N> days)
113
-
114
- Scanned: <total commits>
115
- FH absorption candidates: <N>
116
-
117
- Candidate list:
118
- ┌─────────────────────────────────────────────────────┐
119
- │ [1] <commit hash> "<commit message>" │
120
- │ Type: <workflow pattern / feedback rule / ...> │
121
- │ Absorption location: plugins/fh-meta/skills/<X>/ │
122
- │ Impact: ★★★ (applicable across projects) │
123
- ├─────────────────────────────────────────────────────┤
124
- │ [2] ... │
125
- └─────────────────────────────────────────────────────┘
126
-
127
- Field-only (skipped): <M>
128
-
129
- → Absorb to FH via PR? [all / select number / skip]
130
- ```
131
-
132
- If 0 candidates, report "no absorption candidates" and exit.
80
+ Output the candidate list (format in §ModeA-Blocks): scanned count, FH absorption candidates with type/location/impact stars, field-only skipped count, then ask `[all / select number / skip]`. If 0 candidates, report "no absorption candidates" and exit.
133
81
 
134
82
  ## Step 4. PR Creation (upon user approval)
135
83
 
136
- ```bash
137
- cd "$FH_ROOT"
138
- git checkout -b harvest/"$FIELD_PROJECT"-"$YYYYMMDD"
139
-
140
- # Apply approved patterns
141
- # - Update skill SKILL.md
142
- # - Update .claude/rules/
143
- # - Update templates/
144
-
145
- git add -A
146
- git commit -m "harvest($FIELD_PROJECT): $PATTERN_SUMMARY — $FIELD_COMMIT_HASH absorbed"
147
- git push origin harvest/"$FIELD_PROJECT"-"$YYYYMMDD"
148
-
149
- gh pr create \
150
- --title "harvest: $FIELD_PROJECT pattern absorption ($DATE)" \
151
- --body "..."
152
- ```
153
-
154
- PR body includes:
155
- - Original field commit hash + link
156
- - Absorbed pattern summary
157
- - Application location (which skill/rule)
158
- - Expected cross-project impact
84
+ Create a `harvest/{project}-{date}` branch in FH, apply approved patterns, commit, push, and `gh pr create` (bash + PR body checklist in §ModeA-Blocks).
159
85
 
160
86
  ## Step 5. Done (Mode A Complete)
161
87
 
@@ -227,49 +153,17 @@ Records session work from field projects to the knowledge hub when a session end
227
153
 
228
154
  ## Step 0-B. Locate Hub Path
229
155
 
230
- Auto-detect knowledge hub location (3-level priority):
231
-
232
- ```bash
233
- # Priority 1: FH environment variables (set in ~/.zshrc)
234
- echo "${FH_DIR:-${CC_HUB_DIR:-}}"
235
-
236
- # Priority 2: Auto-discover hub candidates near home
237
- find ~ -maxdepth 3 -name "tracks" -type d 2>/dev/null \
238
- | grep -E "(forge-harness|knowledge-hub)" | head -3
239
-
240
- # Priority 3: Ask user
241
- ```
156
+ Auto-detect knowledge hub location with 3-level priority: ① FH env vars (`FH_DIR`/`CC_HUB_DIR`) → ② auto-discover hub candidates near home → ③ ask user. Track subdirectory: field projects → `tracks/{project-name}/`, external collaborations → `tracks/external/{name}/`.
242
157
 
243
- Determine track subdirectory:
244
- - Field projects → `tracks/{project-name}/`
245
- - External collaborations → `tracks/external/{name}/`
158
+ > **Detail**: See `SKILL_detail.md §ModeB-Blocks` — hub-locate bash, detection-skip inline-grep, session scan, session markdown template, hub commit bash, confirmation format — read when executing Mode B Steps 0-B–5-B.
246
159
 
247
160
  ## Step 0-B.1. Detection-Skip — Already-Logged Pattern Filter (item2)
248
161
 
249
162
  Before scanning session work, build a **skip ledger** of commits already recorded in the hub so the same commit is not logged twice across sessions (re-runs, overlapping auto-trigger + explicit invocation, multi-session same-day work).
250
163
 
251
- **Skip rule**: a field commit hash is **skipped** (excluded from Step 1-B scan output) if it already appears in any existing session file under the project's track directory.
164
+ **Skip rule (behavioral)**: a field commit hash is **skipped** (excluded from Step 1-B scan output) if it already appears in any existing session file under the project's track directory.
252
165
 
253
- > **Detection-skip style: stateless inline-grep (finalized).** FH uses the inline-grep form below
254
- > rather than a persisted ledger file (`tracks/{project}/.logged_commits`): it keeps no extra state to
255
- > sync and is self-correcting — the hub session files *are* the ledger. Adequate at FH's scale; a
256
- > persisted ledger would only pay off on a very large hub where re-grepping all session files is slow.
257
-
258
- Bind the three paths from earlier Mode B steps: `HUB_PATH` = the hub root from Step 0-B, `TRACK` = the track subdirectory chosen above, `FIELD_PATH` = the field project cwd from Step 0.
259
-
260
- ```bash
261
- # Stateless inline-grep: collect hashes already present in hub session files,
262
- # then filter today's field commits against them.
263
- LOGGED=$(grep -rhoE '\b[0-9a-f]{7,40}\b' "$HUB_PATH/tracks/$TRACK/" 2>/dev/null | sort -u)
264
-
265
- git -C "$FIELD_PATH" log --oneline --since="today" --no-merges \
266
- --author="$(git -C "$FIELD_PATH" config user.name)" \
267
- | while read -r hash rest; do
268
- # skip if this hash is already logged in any hub session file
269
- echo "$LOGGED" | grep -q "^${hash}" && continue
270
- echo "$hash $rest"
271
- done
272
- ```
166
+ > **Detection-skip style: stateless inline-grep (finalized).** FH uses the inline-grep form (bash in §ModeB-Blocks) rather than a persisted ledger file: it keeps no extra state to sync and is self-correcting — the hub session files *are* the ledger. Adequate at FH's scale.
273
167
 
274
168
  If **all** of today's commits are already logged, report `"All N commits today are already logged to the hub — nothing new to record"` and exit (Mode B done, no empty session file written). This is also what the item1 auto-trigger consults to count *un-logged* commits — the auto-trigger must not fire on a session whose commits are all already logged.
275
169
 
@@ -277,14 +171,7 @@ If **all** of today's commits are already logged, report `"All N commits today a
277
171
 
278
172
  ## Step 1-B. Scan Current Session Work
279
173
 
280
- Use the **detection-skip-filtered** commit set from Step 0-B.1 (already-logged hashes removed), not the raw `git log`:
281
-
282
- ```bash
283
- cd <field-project-path>
284
- # raw scan — then pass through the Step 0-B.1 skip ledger before use
285
- git log --oneline --since="today" --no-merges --author="$(git config user.name)"
286
- git status --short # uncommitted changes
287
- ```
174
+ Use the **detection-skip-filtered** commit set from Step 0-B.1 (already-logged hashes removed), not the raw `git log`. Also capture uncommitted changes via `git status --short`.
288
175
 
289
176
  ## Step 2-B. Extract Session Summary
290
177
 
@@ -299,55 +186,28 @@ git status --short # uncommitted changes
299
186
 
300
187
  ## Step 3-B. Generate Session Markdown
301
188
 
302
- Template:
303
-
304
- ```markdown
305
- # Session YYYY-MM-DD — <Slug>
306
-
307
- ## Context
308
- <Initial problem inferred from first commit>
309
-
310
- ## Solution
311
- <What was implemented — aggregated from commits>
312
-
313
- ## Commits
314
- 1. `<hash>` — <message>
315
-
316
- ## Next Session
317
- <Parsed from TODO/FIXME, or user-supplied>
189
+ Generate from the template in §ModeB-Blocks (Context / Solution / Commits / Next Session / Key Learnings / FH Backport Points / Tags). Filename: `session_YYYY_MM_DD_<slug>.md`.
318
190
 
319
- ## Key Learnings
320
- <Patterns discovered — user-supplied or inferred>
191
+ ## Step 4-B. Write + Commit to Hub
321
192
 
322
- ## FH Backport Points (Optional)
323
- <If patterns worth meta-skill/rule promotion>
193
+ Write the session file and commit to the hub (bash in §ModeB-Blocks).
324
194
 
325
- ---
326
- **Tags**: #<project> #<topic>
327
- ```
195
+ > **Push policy**: commit only. Push requires explicit user approval ("push해줘", "push it"). Do not auto-push — consistent with FH PR principle.
328
196
 
329
- Filename: `session_YYYY_MM_DD_<slug>.md`
197
+ ## Step 5-B. Confirmation
330
198
 
331
- ## Step 4-B. Write + Commit to Hub
199
+ Output the confirmation block (file path + commit hash + push offer — format in §ModeB-Blocks).
332
200
 
333
- ```bash
334
- cd <hub-path>
335
- # Write session file
336
- git add tracks/<track>/session_$(date +%Y_%m_%d)_<slug>.md
337
- git commit -m "session: <title> (<project> <date>)
201
+ ## Step 5-B.1. UAP Update (Operational Adaptation Loop)
338
202
 
339
- Co-Authored-By: Claude <noreply@anthropic.com>"
340
- ```
203
+ > Rule: `.claude/rules/operational_adaptation.md`
341
204
 
342
- > **Push policy**: commit only. Push requires explicit user approval ("push해줘", "push it"). Do not auto-push consistent with FH PR principle.
205
+ At field-session close, update the **User Adaptation Profile** (`tracks/_meta/user_adaptation_profile.md`, local/gitignored skip silently if absent or in an ephemeral/cloud session):
343
206
 
344
- ## Step 5-B. Confirmation
207
+ 1. **WRITE** — append this session's skill-proposal outcomes (`accepted`/`rejected`/`sustained`, same vocabulary as `operations.md`) + any new recurring friction. Behavioral prefs only — never domain content.
208
+ 2. **Generalization check** — for any UAP entry that recurs across **2+ sessions/projects** (not user-specific), flag it as a **Mode A harvest candidate** (`≥40%` reject = redefine/deprecate candidate; `≥60%` accept = reinforce). Idiosyncratic entries stay local.
345
209
 
346
- ```
347
- ✅ Session logged to knowledge hub
348
- 📝 tracks/<track>/session_YYYY_MM_DD_<slug>.md
349
- 🔀 Commit: <hash> — push? (y/n)
350
- ```
210
+ One pass per session; never blocks the Mode B commit.
351
211
 
352
212
  ---
353
213