Skip to content

Commit 174192c

Browse files
release: @levnikolaevich/hex-line-mcp v1.12.0, @levnikolaevich/hex-graph-mcp v0.8.0, @levnikolaevich/hex-ssh-mcp v1.4.0
hex-line: conservative conflict recovery (retry_edit/retry_edits, suggested_read_call, retry_plan), hook policy extraction, canonical output contracts for verify/changes hex-graph: output contract alignment (pruneEmpty, STATUS/ACTION constants, graphNextAction error mapping, DB busy handling) hex-ssh: remotePlatform parameter (auto/posix/windows), requirePosixRemotePath validation, transfer improvements Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent c782d99 commit 174192c

77 files changed

Lines changed: 3203 additions & 812 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.claude/commands/publish-mcp.md

Lines changed: 66 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,67 @@ claimed=$(grep -oE '[0-9]+ MCP Tools' $PROJECT_ROOT/mcp/${PKG}/README.md | grep
110110
```
111111
If mismatch — update `N MCP Tools` in README.md before proceeding.
112112

113+
**MANDATORY READ:** Load `docs/best-practice/MCP_OUTPUT_CONTRACT_GUIDE.md`
114+
115+
**Output contract + vocabulary gates**
116+
117+
- Public outputs MUST keep canonical field ordering where applicable: `status` -> `reason` -> identity/query fields -> `next_action` / `next_actions` -> `summary` -> recovery helpers -> details.
118+
- Public `reason` values MUST be stable `snake_case`, not prose sentences.
119+
- Public `next_action` / `next_actions` MUST use canonical labels, not English advice sentences.
120+
- Do not introduce a new `status`, `reason`, or `next_action` label if an existing one already covers the same decision.
121+
- `hex-graph` success payloads MUST keep top-level `status: "OK"`; error payloads MUST keep the compact error envelope: `status`, `code`, `summary`, `next_action`, `recovery`.
122+
- `hex-line` text contracts MUST stay canonical and compact: prefer `summary` / `snippet` / `retry_edit` / `retry_edits` / `suggested_read_call` / `retry_plan` over long prose guidance blocks.
123+
124+
**Docs and server-description sync gates**
125+
126+
- `README.md`, package site/page content if touched, and `server.mjs` tool descriptions must agree on:
127+
- tool count
128+
- primary use cases
129+
- current output contract fields
130+
- status/reason/next_action vocabulary
131+
- `server.mjs` descriptions must describe **when to use** the tool and mention current recovery contract where relevant.
132+
- If a release changes public output wording or recovery fields, update README examples in the same release.
133+
134+
**hex-line-specific release gates**
135+
136+
- Hook behavior, `output-style.md`, README, and `hook.mjs` must agree on:
137+
- whether built-in `Read` / `Edit` / `Write` / `Grep` are redirected or merely advised
138+
- what Bash commands are redirected
139+
- PostToolUse truncation thresholds and head/tail counts
140+
- SessionStart bootstrap behavior
141+
- `edit_file` conflict output must still expose the current compact recovery contract:
142+
- `status`
143+
- `reason`
144+
- `next_action`
145+
- `summary`
146+
- `snippet`
147+
- recovery helpers such as `retry_edit`, `retry_edits`, `suggested_read_call`, `retry_plan`, `retry_checksum`, `recovery_ranges`
148+
- `verify` and `changes` must preserve canonical `status` / `reason` / `next_action` outputs; do not publish if they drift back to narrative/prose-first responses.
149+
150+
**hex-graph-specific release gates**
151+
152+
- Use-case wrappers and server-level overrides must keep the same action vocabulary; no mixed sentence-style `next_actions`.
153+
- `compact` / default outputs should prune empty sections instead of shipping null-heavy payloads.
154+
- Query success results must preserve the top-level pattern: `status`, `query`, `summary`, `reason`, `result`, optional `quality`, optional `warnings`, optional `next_actions`.
155+
156+
**Suggested spot checks before publish**
157+
158+
Run targeted searches and inspect mismatches:
159+
160+
```bash
161+
node mcp/check-output-contracts.mjs
162+
rg -n "next_action|next_actions|status: |reason: " $PROJECT_ROOT/mcp/${PKG}/
163+
rg -n "retry_edit|retry_edits|suggested_read_call|retry_plan|summary: |snippet: " $PROJECT_ROOT/mcp/${PKG}/
164+
```
165+
166+
For `hex-line-mcp`, also inspect:
167+
168+
```bash
169+
rg -n "HOOK_OUTPUT_POLICY|LINE_THRESHOLD|HEAD_LINES|TAIL_LINES|SessionStart|PreToolUse|PostToolUse" $PROJECT_ROOT/mcp/hex-line-mcp/hook.mjs $PROJECT_ROOT/mcp/hex-line-mcp/lib/hook-policy.mjs $PROJECT_ROOT/mcp/hex-line-mcp/README.md $PROJECT_ROOT/mcp/hex-line-mcp/output-style.md
170+
```
171+
172+
If these checks reveal drift, fix it before version bumping.
173+
113174
### 6. Bump version
114175

115176
```bash
@@ -128,7 +189,7 @@ Version is injected at build time via esbuild `define: { __HEX_VERSION__ }`. No
128189
Verify version in bundle using `mcp__hex-line__grep_search`:
129190
- pattern: `"${NEW_VERSION}"` (literal), path: `mcp/${PKG}/dist/server.mjs`, limit: 1
130191

131-
### 7b. Sync version in server.json (MCP Registry metadata)
192+
### 8. Sync version in server.json (MCP Registry metadata)
132193

133194
Update both `version` and `packages[0].version` in `mcp/${PKG}/server.json`:
134195
```bash
@@ -140,7 +201,7 @@ Verify:
140201
jq '.version, .packages[0].version' $PROJECT_ROOT/mcp/${PKG}/server.json
141202
```
142203

143-
### 8. Commit + tag + push
204+
### 9. Commit + tag + push
144205

145206
**CRITICAL:** Commit ALL repo changes (`git add -A`), not just the package directory. Other pending changes (skills, commands, docs) ride along with the release commit. Never scope `git add` to a subdirectory.
146207

@@ -151,21 +212,21 @@ git tag ${TAG_PREFIX}${NEW_VERSION}
151212
git push origin master --tags
152213
```
153214

154-
### 9. Verify publish
215+
### 10. Verify publish
155216

156217
Wait ~30s, then:
157218
```bash
158219
gh run list --limit 1
159220
npm view ${PKG_NAME} version
160221
```
161222

162-
### 10. Report
223+
### 11. Report
163224

164225
Display: package name, old → new version, npm URL (`https://www.npmjs.com/package/${PKG_NAME}`), GitHub Actions run status.
165226

166227
---
167228

168-
### 11. Meta-Analysis
229+
### 12. Meta-Analysis
169230

170231
**MANDATORY READ:** Load `shared/references/meta_analysis_protocol.md`
171232

AGENTS.md

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,11 @@ Skills collection for Codex with config-driven Agile task management (Linear or
2727

2828
## MCP Tool Preferences
2929

30-
**Prefer** hex-line MCP for code files. Hash-annotated reads support safe edits.
31-
32-
| Instead of | Use | When |
33-
|-----------|-----|------|
34-
| Built-in Read | `hex-line read_file` | Code files |
35-
| Built-in Edit | `hex-line edit_file` | Always |
36-
| Built-in Write | `hex-line write_file` | Always |
37-
| Built-in Grep | `hex-line grep_search` | Before editing found code |
38-
| Large code file | `hex-line outline` then `read_file` with range | Unfamiliar files over 100 lines |
39-
40-
Built-in tools are still fine for images, PDFs, notebooks, Glob, and `.claude/settings*.json`.
30+
Prefer `hex-line` for code/config/script/test files.
31+
- Use `outline` before large reads, then `read_file` with ranges.
32+
- Use `edit_file` / `write_file` for writes, `bulk_replace` for multi-file text rename, `verify` after conflicts or delayed follow-up edits, and `changes` for diff review.
33+
- Use `hex-graph` only for symbol, reference, architecture, and semantic diff questions.
34+
- Built-in tools are still fine for images, PDFs, notebooks, Glob, and `.claude/settings*.json`.
4135

4236
## Quick Understanding
4337

@@ -68,6 +62,7 @@ Built-in tools are still fine for images, PDFs, notebooks, Glob, and `.claude/se
6862
| Questions format | `skills-catalog/shared/references/questions_format.md` |
6963
| Hook design | `docs/best-practice/HOOK_DESIGN_GUIDE.md` |
7064
| MCP tool design | `docs/best-practice/MCP_TOOL_DESIGN_GUIDE.md` |
65+
| MCP output contract | `docs/best-practice/MCP_OUTPUT_CONTRACT_GUIDE.md` |
7166
| Token efficiency | `docs/standards/TOKEN_EFFICIENCY_PATTERNS.md` |
7267
| Prompt caching | `docs/best-practice/PROMPT_CACHING_GUIDE.md` |
7368

CLAUDE.md

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -23,39 +23,29 @@ Skills collection for Claude Code with config-driven Agile task management (Line
2323

2424
## MCP Tool Preferences
2525

26-
**PREFER** hex-line MCP for code files — hash-annotated reads enable safe edits:
27-
28-
| Instead of | Use | When |
29-
|-----------|-----|------|
30-
| Built-in Read | `hex-line read_file` | Code files (hash-annotated, edit-ready) |
31-
| Built-in Edit | `hex-line edit_file` | Always (hash-verified anchors) |
32-
| Built-in Write | `hex-line write_file` | Always (consistent workflow) |
33-
| Built-in Grep | `hex-line grep_search` | Before editing found code (grep→edit pipeline) |
34-
| Large code file | `hex-line outline` then `read_file` with range | Unfamiliar files >100 lines |
35-
| Edit (text rename) | `hex-line bulk_replace` | Multi-file rename/refactor |
36-
| Bash `find`/`tree`/`stat` | `hex-line inspect_path` | File metadata, tree view, gitignore-aware discovery |
37-
| Bash `diff` | `hex-line changes` | Semantic diff with symbol-level detail |
38-
| Re-read after CONFLICT | `hex-line verify` | Check freshness without rereading |
39-
40-
**Built-in OK for:** images, PDFs, notebooks, Glob (always), `.claude/settings.json` and `.claude/settings.local.json`.
26+
Prefer `hex-line` for code/config/script/test files.
27+
- Use `outline` before large reads, then `read_file` with ranges.
28+
- Use `edit_file` / `write_file` for writes, `bulk_replace` for multi-file text rename, `verify` after conflicts or delayed follow-up edits, and `changes` for diff review.
29+
- Use `hex-graph` only for symbol, reference, architecture, and semantic diff questions.
30+
- Built-in tools are still fine for images, PDFs, notebooks, Glob, and `.claude/settings*.json`.
4131

4232
## Quick Understanding
4333

4434
| What | How |
4535
|------|-----|
4636
| Project overview + tree | `cat README.md` |
4737
| Architecture (L0-L3) | `cat docs/architecture/SKILL_ARCHITECTURE_GUIDE.md` |
48-
| Key workflow | `ln-700 ln-100 ln-200 ln-1000` |
38+
| Key workflow | `ln-700 -> ln-100 -> ln-200 -> ln-1000` |
4939
| Tool config (Linear/File) | `cat skills-catalog/shared/references/tools_config_guide.md` |
5040
| Skill metadata | `head -20 {ln-NNN}/SKILL.md` |
5141

5242
## Navigation
5343

54-
**DAG:** CLAUDE.md `docs/README.md` topic docs. Read SCOPE tag first.
44+
**DAG:** CLAUDE.md -> `docs/README.md` -> topic docs. Read SCOPE tag first.
5545

5646
| Topic | File |
5747
|-------|------|
58-
| Writing Guidelines | `docs/architecture/SKILL_ARCHITECTURE_GUIDE.md` §Writing Guidelines |
48+
| Writing Guidelines | `docs/architecture/SKILL_ARCHITECTURE_GUIDE.md` section Writing Guidelines |
5949
| Tool Configuration | `skills-catalog/shared/references/tools_config_guide.md` |
6050
| Risk-Based Testing | `skills-catalog/shared/references/risk_based_testing_guide.md` |
6151
| Frontmatter fields | `skills-catalog/shared/references/frontmatter_reference.md` |

GEMINI.md

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ Skills collection for Gemini CLI with config-driven Agile task management (Linea
1010

1111
| Rule | When to Apply | Details |
1212
|------|---------------|---------|
13-
| **Read Architecture Guide first** | Before working with skills | `cat docs/architecture/SKILL_ARCHITECTURE_GUIDE.md` L0-L3 hierarchy, SRP, Token Efficiency, Red Flags |
14-
| **MANDATORY READ pattern** | File references in SKILL.md | Use `**MANDATORY READ:** Load {file}`. Passive refs (`See`, `Per`, `Follows`) are NOT followed by agents. Group multiple into ONE block at section start |
13+
| **Read Architecture Guide first** | Before working with skills | `cat docs/architecture/SKILL_ARCHITECTURE_GUIDE.md` - L0-L3 hierarchy, SRP, Token Efficiency, Red Flags |
14+
| **MANDATORY READ pattern** | File references in SKILL.md | Use `**MANDATORY READ:** Load {file}`. Passive refs are NOT followed by agents. Group multiple into ONE block at section start |
1515
| **Path Resolution** | File paths in SKILL.md | Relative to skills repo root, NOT target project. Every SKILL.md with file refs includes `> **Paths:**` note after frontmatter |
1616
| **Sequential Numbering** | Phases/Sections/Steps | 1, 2, 3, 4 (NOT 1, 1.5, 2). Exception: 4a (CREATE), 4b (REPLAN) |
1717
| **Docs in English** | All documentation | Stories/Tasks can be EN/RU regardless of provider |
@@ -25,17 +25,11 @@ Skills collection for Gemini CLI with config-driven Agile task management (Linea
2525

2626
## MCP Tool Preferences
2727

28-
**PREFER** hex-line MCP for code files — hash-annotated reads enable safe edits:
29-
30-
| Instead of | Use | When |
31-
|-----------|-----|------|
32-
| Built-in Read | `hex-line read_file` | Code files (hash-annotated, edit-ready) |
33-
| Built-in Edit | `hex-line edit_file` | Always (hash-verified anchors) |
34-
| Built-in Write | `hex-line write_file` | Always (consistent workflow) |
35-
| Built-in Grep | `hex-line grep_search` | Before editing found code (grep→edit pipeline) |
36-
| Large code file | `hex-line outline` then `read_file` with range | Unfamiliar files >100 lines |
37-
38-
**Built-in OK for:** images, PDFs, notebooks, Glob (always), `.claude/settings.json` and `.claude/settings.local.json`.
28+
Prefer `hex-line` for code/config/script/test files.
29+
- Use `outline` before large reads, then `read_file` with ranges.
30+
- Use `edit_file` / `write_file` for writes, `bulk_replace` for multi-file text rename, `verify` after conflicts or delayed follow-up edits, and `changes` for diff review.
31+
- Use `hex-graph` only for symbol, reference, architecture, and semantic diff questions.
32+
- Built-in tools are still fine for images, PDFs, notebooks, Glob, and `.claude/settings*.json`.
3933

4034
## Quick Understanding
4135

@@ -45,16 +39,16 @@ Skills collection for Gemini CLI with config-driven Agile task management (Linea
4539
| Skill count | `ls -d ln-*/SKILL.md \| wc -l` |
4640
| Architecture patterns (L0-L3) | `cat docs/architecture/SKILL_ARCHITECTURE_GUIDE.md` |
4741
| Tool configuration (Linear/File Mode) | `cat skills-catalog/shared/references/tools_config_guide.md` |
48-
| Key workflow | `ln-700 ln-100 ln-200 ln-1000` (or manually: `ln-400 ln-500`) |
42+
| Key workflow | `ln-700 -> ln-100 -> ln-200 -> ln-1000` (or manually: `ln-400 -> ln-500`) |
4943
| Skill metadata | `head -20 {ln-NNN}/SKILL.md` (frontmatter + type/category) |
5044

5145
## Navigation
5246

53-
**DAG:** GEMINI.md `docs/README.md` topic docs. Read SCOPE tag first in each doc.
47+
**DAG:** GEMINI.md -> `docs/README.md` -> topic docs. Read SCOPE tag first in each doc.
5448

5549
| Topic | File |
5650
|-------|------|
57-
| Writing Guidelines | `docs/architecture/SKILL_ARCHITECTURE_GUIDE.md` §Writing Guidelines |
51+
| Writing Guidelines | `docs/architecture/SKILL_ARCHITECTURE_GUIDE.md` section Writing Guidelines |
5852
| Tool Configuration (Phase 0) | `skills-catalog/shared/references/tools_config_guide.md` |
5953
| Risk-Based Testing | `skills-catalog/shared/references/risk_based_testing_guide.md` |
6054

@@ -64,7 +58,7 @@ Skills collection for Gemini CLI with config-driven Agile task management (Linea
6458

6559
1. Update `**Version:**` in `{skill}/SKILL.md`
6660
2. Update version in README.md feature tables
67-
3. Update CHANGELOG.md one summary paragraph per date (`## YYYY-MM-DD`), no duplicate dates
61+
3. Update CHANGELOG.md - one summary paragraph per date (`## YYYY-MM-DD`), no duplicate dates
6862

6963
## Compact Instructions
7064

README.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,10 @@ Bundled MCP servers extend agent capabilities — hash-verified editing, code in
113113
| **[hex-graph-mcp](mcp/hex-graph-mcp/)** | Indexes codebases into a deterministic SQLite graph with framework-aware overlays, capability-first quality tooling, optional SCIP interop, and architecture/reference analysis. | 14 | [README](mcp/hex-graph-mcp/README.md) · [npm](https://www.npmjs.com/package/@levnikolaevich/hex-graph-mcp) |
114114
| **[hex-ssh-mcp](mcp/hex-ssh-mcp/)** | Hash-verified remote file editing and SFTP transfer over SSH. Normalized output for minimal token usage. | 8 | [README](mcp/hex-ssh-mcp/README.md) · [npm](https://www.npmjs.com/package/@levnikolaevich/hex-ssh-mcp) |
115115

116+
Deterministic scope rule: `hex-line` and `hex-graph` keep `path` as the project anchor. In normal use the agent fills it automatically from the active file or project root, so users usually do not need to type it manually. `hex-ssh` runs on Windows/macOS/Linux hosts; remote shell tools stay POSIX-oriented, while SFTP transfers support platform-aware remote paths.
117+
116118
<!-- GENERATED:HEX_GRAPH_MCP_STATUS:START -->
117-
`hex-graph-mcp` quality snapshot: `81/81` tests passing, `1` curated corpus, `1` pinned external corpora, parser-first `green`.
119+
`hex-graph-mcp` quality snapshot: `83/83` tests passing, `1` curated corpus, `1` pinned external corpora, parser-first `green`.
118120
<!-- GENERATED:HEX_GRAPH_MCP_STATUS:END -->
119121

120122
### External servers
@@ -152,17 +154,16 @@ claude mcp add -s user --transport http linear-server https://mcp.linear.app/mcp
152154

153155
### Agent steering
154156

155-
MCP servers are installed but Claude won't prefer them over built-ins by default. hex-line-mcp includes tools that teach the agent to use MCP:
157+
MCP servers can be installed correctly and still lose to built-ins in practice. `hex-line-mcp` keeps Claude aligned through one output style and three Claude hook events:
156158

157159
| Mechanism | How it works |
158160
|-----------|-------------|
159161
| **[Output style](mcp/hex-line-mcp/output-style.md)** | Injected into system prompt — maps built-in tools to MCP equivalents (`Read``hex-line read_file`, `Edit``hex-line edit_file`) |
160-
| **PostToolUse hook** | When Claude uses a built-in, the hook reminds it to use the MCP tool next time |
161-
| **secret-scanner hook** | Blocks `git commit` if secrets detected |
162-
| **story-validator hook** | Validates Story context before `ln-400` execution |
163-
| **code-quality hook** | Reports DRY/KISS/YAGNI violations after Edit/Write |
162+
| **SessionStart hook** | Injects a compact bootstrap hint and defers to the active `hex-line` output style when present |
163+
| **PreToolUse hook** | Advises small `Read`/`Edit`, redirects heavier `Read`/`Edit` plus `Write`/`Grep`, selectively redirects simple Bash, blocks dangerous commands |
164+
| **PostToolUse hook** | Filters only verbose Bash output (50+ lines), keeping first 15 + last 15 lines after normalization and dedupe |
164165

165-
Run `hex-line setup_hooks` to install all hooks + output style.
166+
Hooks and output style auto-sync on `hex-line-mcp` startup. First run after install performs the initial sync automatically.
166167

167168
---
168169

docs/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ docs/
1111
| `-- AGENT_DELEGATION_PLATFORM_GUIDE.md # Skill vs subagent runtime, recovery, Windows
1212
|-- best-practice/ # Claude Code usage guidance
1313
| |-- COMPONENT_SELECTION.md
14+
| |-- MCP_OUTPUT_CONTRACT_GUIDE.md # Canonical MCP status/reason/next_action vocabulary
1415
| `-- WORKFLOW_TIPS.md
1516
|-- plugins/ # Per-plugin landing pages
1617
| |-- agile-workflow.md
@@ -47,3 +48,10 @@ docs/
4748
| `plugins/` | Per-plugin landing pages, skill tables, workflow overviews | Skill internals |
4849
| `standards/` | Documentation quality requirements for generated project docs | Skill-specific writing contracts |
4950
| `TROUBLESHOOTING.md` | Known issues and solutions | Runtime protocols |
51+
52+
## Key Maintainer References
53+
54+
| Topic | File |
55+
|-------|------|
56+
| MCP tool design | [best-practice/MCP_TOOL_DESIGN_GUIDE.md](best-practice/MCP_TOOL_DESIGN_GUIDE.md) |
57+
| MCP output contract | [best-practice/MCP_OUTPUT_CONTRACT_GUIDE.md](best-practice/MCP_OUTPUT_CONTRACT_GUIDE.md) |

docs/best-practice/HOOK_DESIGN_GUIDE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ Flow: block -> agent sees reason -> asks user -> confirms -> retries with bypass
106106
| Stage | What It Does | Implementation |
107107
|-------|-------------|----------------|
108108
| Detect | Match command type (npm, test, build, pip, git) | Regex array -> type string |
109-
| Threshold | Skip if output < N lines | `LINE_THRESHOLD = 50` |
109+
| Threshold | Skip if output < N lines | `HOOK_OUTPUT_POLICY.lineThreshold = 50` |
110110
| Deduplicate | Normalize UUIDs/IPs/timestamps, group identical | `deduplicateLines()` with `(xN)` |
111111
| Truncate | First N + last N, gap indicator | `smartTruncate(text, 15, 15)` |
112112
| Header | Type + compression ratio | `RTK FILTERED: npm-install (847 -> 30 lines)` |

0 commit comments

Comments
 (0)