# Doc

> Document adapter. Calls the distill engine, formats the result as markdown, and saves it to a file. Inherits the prior distill save flow. Triggers: "문서로", "정리해서 저장", "doc", "기록으로", "shrink", "줄여줘", "압축"

- Skill: `jazz1x/doc` (Agent Skill, multi-file: 3 files)
- Install (CLI): `npx skillmds@latest add jazz1x/doc`
- Raw SKILL.md: https://api.skillmd.com/api/skills/jazz1x/doc/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Docs & Writing
- Author: jazz1x (https://skillmd.com/u/jazz1x)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/jazz1x/doc

---


# galmuri:doc — Document adapter

## Prerequisites
- `scripts/preflight.sh` passes.
- `skills/distill/` engine is installed.
- `scripts/record-asset.sh` is executable.

## Step 1: Alias detection + Audience

When triggered via `shrink` / `줄여줘` / `압축`:
```bash
if [ ! -f ".galmuri/tmp/.warned-shrink" ]; then
  echo "[deprecated] the 'shrink' trigger is routed to a context-based adapter. Scheduled for removal in a future release." >&2
  touch ".galmuri/tmp/.warned-shrink"
fi
# source_tokens ≥ 80 AND ratio > 0.1 → doc runs; otherwise → delegate to another adapter
```

> "Who is this document for? (e.g. the whole team, future-me, an external reviewer)"
- Ask if audience is missing.

## Step 2: Engine Invoke
- Call `distill --mode reduce --ratio 0.3 --audience {X}`.
- Receive the EngineOutput JSON.

## Step 3: Render
- EngineOutput.units → markdown body:
  - Section title = first unit's `claim`.
  - Each unit's `essence` + `evidence` becomes the body copy.
  - `dropped[]` becomes a "## Omitted items" section.

## Step 4: Save
Default path: `docs/galmuri-doc-{slug}.md`
> "Save to `docs/galmuri-doc-{slug}.md`? (y/n/edit-slug)"
- `y` → create the file, then proceed to Step 5.
- `n` → stdout only.
- `edit-slug` → rename, then create.

## Step 5: Asset record

The PostToolUse hook (`hooks/shims/asset-record.sh`) runs **automatically** when the Write tool creates `docs/galmuri-doc-{slug}.md`. You do **not** need to invoke `record-asset.sh` manually.

If for any reason the hook did not run (e.g., direct CLI invocation without hooks), call it manually:
```bash
bash scripts/record-asset.sh --type doc --tags "doc,{slug}" \
  --source-ref ".galmuri/tmp/source-{slug}.txt" --output "docs/galmuri-doc-{slug}.md"
```

## Output Schema
A markdown file (`docs/galmuri-doc-{slug}.md`) + an asset record.

