---
name: eck:pull-from-standards
version: "0.7.4"
description: Pull and compile development standards from the evolv-coder-standards repository into project context files.
disable-model-invocation: false
---

# Pull From Standards Workflow

Pull development standards from the `evolv-coder-standards` repository and compile them into domain-specific context files for agent consumption.

---

## Visual Framework

Follow these conventions for all terminal output displayed to the user via the Bash tool.

### Output Mode Awareness

Before producing output, read the user's preferred output mode:

```bash
cat $ECK_HOME/user-preferences.json 2>/dev/null
```

Extract the `outputMode` field and adapt verbosity:

- **guided** — Add explanatory prose after key steps. Describe what is happening and why.
- **standard** (default) — Balanced. Show steps with brief context for non-obvious decisions.
- **concise** — Steps and summary box only. No prose, no explanations.

If the file is missing or `outputMode` is absent, use **standard**.

### ANSI Colors

Declare these variables at the top of **every** Bash tool call (shell state does not persist between calls):

```bash
source $ECK_HOME/colors.sh
```

Every color sequence **must** end with `${RESET}`. No exceptions.

### Stage Banners

Mark major stage transitions with a bold banner. One blank line before and after.

```bash
echo ""
printf '%b\n' "${ORANGE}${BOLD}STAGE NAME${RESET}"
echo ""
```

### Status Symbols

| Symbol | Meaning          | Color       |
| ------ | ---------------- | ----------- |
| `[*]`  | Active / running | `${CYAN}`   |
| `[x]`  | Completed        | `${GREEN}`  |
| `[!]`  | Error            | `${RED}`    |
| `[-]`  | Skipped          | `${DIM}`    |
| `[>]`  | In progress      | `${YELLOW}` |
| `[ ]`  | Pending          | `${DIM}`    |

```bash
printf '%b\n' "${GREEN}[x]${RESET} Step completed"
printf '%b\n' "${RED}[!]${RESET} Something failed"
```

No emoji in output. Use only these bracket symbols for status.

### Summary Boxes

Display at checkpoints and at the end of the skill. One blank line before and after.

```bash
echo ""
printf '%b\n' "${ORANGE}${BOLD}Title${RESET}"
echo ""
printf '%b\n' "Label: Value"
echo ""
```

### Error Format

```bash
printf '%b\n' "${RED}[!]${RESET} Error message here"
printf '%b\n' "    ${DIM}Recovery guidance here.${RESET}"
```

### Spacing Rules

- One blank line before and after stage banners and summary boxes.
- No blank lines within step lists.
- Maximum output line width: 70 characters.

### Statusline Stage Updates

At the **start** of each stage, update the statusline:

```bash
bash $ECK_HOME/update-stage.sh "{Statusline text from table}"
```

At **skill completion** (success or error), reset:

```bash
bash $ECK_HOME/update-stage.sh
```

---

## Task Registration

| Stage | Subject                  | Active Form             | Statusline      |
| ----- | ------------------------ | ----------------------- | --------------- |
| 1     | Stage 1: Pre-Flight      | Verifying prerequisites | Preflight (1/7) |
| 2     | Stage 2: Cache Standards | Caching standards       | Cache (2/7)     |
| 3     | Stage 3: Compile         | Compiling standards     | Compile (3/7)   |
| 4     | Stage 4: Full Copy       | Copying files           | FullCopy (4/7)  |
| 5     | Stage 5: Check           | Checking results        | Check (5/7)     |
| 6     | Stage 6: Metadata        | Updating metadata       | Metadata (6/7)  |
| 7     | Stage 7: Summary         | Generating summary      | Summary (7/7)   |

## Usage

```bash
/eck:pull-from-standards                          # All applicable domains
/eck:pull-from-standards backend,database         # Specific domains only
/eck:pull-from-standards --full                   # Full standards (not compiled)
/eck:pull-from-standards --compile                # Re-compile from source
/eck:pull-from-standards --check                  # Check freshness only
```

---

## Stage 1: Pre-Flight

### Inputs

- `gh` CLI availability and authentication status
- `.claude/project-constants.md` (for `<STANDARDS_REPO_URL>` and `<STANDARDS_REPO_BRANCH>`)
- Command-line domains argument (if provided)

### Activities

### Verify Requirements

```bash
# Check gh CLI is available
gh --version

# Check gh CLI is authenticated
gh auth status

# Check Python 3 is available (compile-standards.py requires it)
command -v python3

# Check project has .claude/ directory
ls .claude/project-constants.md
```

**If gh CLI not available:**

```bash
printf '%b\n' "${RED}[!]${RESET} gh CLI is required for pulling standards."
printf '%b\n' "    ${DIM}Install: https://cli.github.com/${RESET}"
```

**If Python 3 not available:**

```bash
printf '%b\n' "${RED}[!]${RESET} Python 3 is required to compile standards."
printf '%b\n' "    ${DIM}macOS: 'brew install python3' · Debian/Ubuntu: 'sudo apt-get install python3'${RESET}"
```

The compile step (Stage 4) calls `python3`, not bare `python` — modern macOS (12.3+) and minimal Linux distros ship no `python` alias, so a bare-`python` call would fail with `command not found`.

**If gh CLI not authenticated:**

```bash
printf '%b\n' "${RED}[!]${RESET} gh CLI is not authenticated."
printf '%b\n' "    ${DIM}Run: gh auth login${RESET}"
```

**If no project-constants.md:**

```bash
printf '%b\n' "${YELLOW}[>]${RESET} No project-constants.md found."
printf '%b\n' "    ${DIM}Using default standards repo:${RESET}"
printf '%b\n' "    ${DIM}https://github.com/evolvconsulting/evolv-coder-standards${RESET}"
```

### Read Configuration

1. Read `project-constants.md` for:
   - `<STANDARDS_REPO_URL>` — defaults to `https://github.com/evolvconsulting/evolv-coder-standards`
   - `<STANDARDS_REPO_BRANCH>` — defaults to `main`

2. If domains not specified on command line, infer from tech stack in `project-constants.md`:
   - Has frontend path → include `frontend`
   - Has backend path → include `backend`
   - Has database references → include `database`
   - Always include: `core`, `devops`, `documentation`

### Outputs

- Resolved `<STANDARDS_REPO_URL>`, `<STANDARDS_REPO_BRANCH>`, and domain filter list

### Exit Criteria

- All prerequisites verified; repo URL, branch, and domain list resolved

---

## Stage 2: Update Standards Cache

### Inputs

- `~/.claude/evolv-coder-standards/` local cache (or absent if first run)
- `<STANDARDS_REPO_URL>` and `<STANDARDS_REPO_BRANCH>` from Stage 1

### Activities

The installer maintains a full clone at `~/.claude/evolv-coder-standards/`. Update it before use:

```bash
# Pull latest into the local cache
cd ~/.claude/evolv-coder-standards && git pull --ff-only
```

**If cache directory does not exist** (installer hasn't run or clone failed):

```bash
gh repo clone {STANDARDS_REPO_URL} ~/.claude/evolv-coder-standards -- --branch {STANDARDS_REPO_BRANCH}
```

**If pull/clone fails:**

```bash
printf '%b\n' "${RED}[!]${RESET} Could not update standards repository."
printf '%b\n' "    ${DIM}Verify:${RESET}"
printf '%b\n' "    ${DIM}1. gh auth status (authentication)${RESET}"
printf '%b\n' "    ${DIM}2. Repository exists and you have access${RESET}"
printf '%b\n' "    ${DIM}3. Branch '${STANDARDS_REPO_BRANCH}' exists${RESET}"
printf '%b\n' ""
printf '%b\n' "    ${DIM}Falling back to embedded defaults in${RESET}"
printf '%b\n' "    ${DIM}.claude/context/standards/${RESET}"
```

If update fails, STOP and report. The embedded defaults (shipped with evolv-coder-kit) remain unchanged.

### Read Manifest

```bash
cat ~/.claude/evolv-coder-standards/manifest.yaml
```

Parse manifest to get:

- Domain versions
- File lists per domain
- Schema version

### Outputs

- Updated `~/.claude/evolv-coder-standards/` cache
- Parsed manifest data (domain versions, file lists, schema version)

### Exit Criteria

- Cache updated (or fallback noted); manifest parsed

---

## Stage 3: Default Mode — Compile Standards

### Inputs

- Updated standards cache from Stage 2
- Domain filter list from Stage 1
- `~/.claude/evolv-coder-standards/` source files

### Activities

**Triggered when:** No `--full` or `--check` flag specified, or `--compile` flag specified.

### Filter Domains

If specific domains were requested (e.g., `backend,database`):

- Only compile those domains
- Skip unrelated domains

If no domains specified:

- Compile all base domains: core, frontend, backend, database, devops, documentation, ai
- Compile language-specific domains (if present in manifest): java, csharp, cpp, php, go, rust, kotlin, ruby, dart, swift, typescript

### Run Compilation

```bash
STANDARDS_SOURCE_DIR=~/.claude/evolv-coder-standards python3 "$CLAUDE_PROJECT_DIR/.claude/scripts/compile-standards.py"
```

Or manually compile per domain:

1. For each domain in the filter list:
   - Read all files listed in `manifest.yaml` for that domain
   - Strip YAML front matter from each file
   - Concatenate into single domain file with TOC and source attribution
   - Write to `.claude/context/standards/{domain}-standards.md`

### Verify Output

```bash
# Check all expected files exist
ls .claude/context/standards/

# Base files (7):
# core-standards.md, frontend-standards.md, backend-standards.md
# database-standards.md, devops-standards.md, documentation-standards.md
# ai-standards.md

# Language files (11, compiled when present in manifest):
# java-standards.md, csharp-standards.md, cpp-standards.md
# php-standards.md, go-standards.md, rust-standards.md
# kotlin-standards.md, ruby-standards.md, dart-standards.md, swift-standards.md
# typescript-standards.md
```

### Outputs

- Compiled domain standards files written to `.claude/context/standards/`

### Exit Criteria

- All expected compiled files exist (or partial-compilation warning issued)

---

## Stage 4: Full Mode (`--full`)

### Inputs

- `~/.claude/evolv-coder-standards/` source directories
- Domain filter (if provided)

### Activities

**Triggered when:** `--full` flag specified.

### Copy Full Standards

```bash
# Create full standards directory
mkdir -p .claude/context/standards/full/

# Copy all standards files preserving structure
cp -R ~/.claude/evolv-coder-standards/standards/ .claude/context/standards/full/standards/
cp -R ~/.claude/evolv-coder-standards/patterns/ .claude/context/standards/full/patterns/
cp -R ~/.claude/evolv-coder-standards/evaluation/ .claude/context/standards/full/evaluation/
cp -R ~/.claude/evolv-coder-standards/examples/ .claude/context/standards/full/examples/
```

**Note:** Full mode copies ALL content (~93 files, ~43K lines). This increases context size significantly. Use only when detailed reference is needed.

### Filter by Domain (if specified)

If specific domains were requested:

- Only copy directories matching those domains
- Example: `--full backend,database` copies only `standards/backend/`, `standards/database/`, etc.

### Outputs

- Full standards content copied to `.claude/context/standards/full/`

### Exit Criteria

- All applicable standards directories copied

---

## Stage 5: Check Mode (`--check`)

### Inputs

- Local compiled files from `.claude/context/standards/`
- Manifest from `~/.claude/evolv-coder-standards/` for latest domain versions

### Activities

**Triggered when:** `--check` flag specified.

### Compare Versions

1. Read local compiled files from `.claude/context/standards/`
2. Read manifest from cloned repo for latest domain versions
3. Compare per-domain and display with status symbols:
   - OK: `${GREEN}[x]${RESET}`
   - STALE: `${YELLOW}[>]${RESET}`
   - MISSING: `${RED}[!]${RESET}`

```bash
source $ECK_HOME/colors.sh

echo ""
printf '%b\n' "${ORANGE}${BOLD}Standards Freshness${RESET}"
echo ""
printf '%b\n' "${GREEN}[x]${RESET} core           1.0.0 -> 1.0.0   OK"
printf '%b\n' "${YELLOW}[>]${RESET} frontend       1.0.0 -> 1.1.0   STALE"
printf '%b\n' "${GREEN}[x]${RESET} backend        1.0.0 -> 1.0.0   OK"
printf '%b\n' "${GREEN}[x]${RESET} database       1.0.0 -> 1.0.0   OK"
printf '%b\n' "${RED}[!]${RESET} devops         --    -> 1.0.0   MISSING"
printf '%b\n' "${RED}[!]${RESET} documentation  --    -> 1.0.0   MISSING"
echo ""
printf '%b\n' "  ${DIM}Run /eck:pull-from-standards frontend${RESET}"
printf '%b\n' "  ${DIM}to update stale domains.${RESET}"
printf '%b\n' "  ${DIM}Run /eck:pull-from-standards to pull all.${RESET}"
```

**No files modified in check mode.**

### Outputs

- Freshness report displayed to user

### Exit Criteria

- Freshness status displayed for all local domain files; no files modified

---

## Stage 6: Update Metadata

### Inputs

- Compilation results from Stage 3 or Stage 4
- `.claude/project-catalog.yaml` (if it exists)
- `$ECK_HOME/registry.yaml` (if it exists)

### Activities

### Update Catalog

If the project has a `catalog.yaml`, update the `standards` section:

```yaml
standards:
  source_repo: "{STANDARDS_REPO_URL}"
  source_version: "{manifest_schema_version}"
  compiled_at: "{ISO_TIMESTAMP}"
  domains:
    core-standards: { version: "{version}", compiled: true }
    frontend-standards: { version: "{version}", compiled: true }
    backend-standards: { version: "{version}", compiled: true }
    database-standards: { version: "{version}", compiled: true }
    devops-standards: { version: "{version}", compiled: true }
    documentation-standards: { version: "{version}", compiled: true }
```

### Cache Note

The `~/.claude/evolv-coder-standards/` directory is a persistent cache maintained by the installer. Do **not** delete it.

### Outputs

- `catalog.yaml` standards section updated (if exists)
- `registry.yaml` `sync_history` entry appended (if exists)

### Exit Criteria

- All catalog and registry metadata updated

---

## Stage 7: Summary

### Inputs

- Results from Stages 3-6 (files updated, versions, mode, source)

### Activities

Display as a summary box with domain details:

```bash
source $ECK_HOME/colors.sh

echo ""
printf '%b\n' "${ORANGE}${BOLD}Standards Pull Complete${RESET}"
echo ""
printf '%b\n' "Source: {STANDARDS_REPO_URL}"
printf '%b\n' "Branch: {STANDARDS_REPO_BRANCH}"
printf '%b\n' "Mode: {compile|full|check}"
echo ""
printf '%b\n' "${GREEN}[x]${RESET} core-standards           1.0.0   9 files   15.2 KB"
printf '%b\n' "${GREEN}[x]${RESET} frontend-standards       1.0.0   8 files   42.3 KB"
printf '%b\n' "${GREEN}[x]${RESET} backend-standards        1.0.0   4 files   18.7 KB"
printf '%b\n' "${GREEN}[x]${RESET} database-standards       1.0.0   4 files   12.1 KB"
printf '%b\n' "${GREEN}[x]${RESET} devops-standards         1.0.0   7 files   22.4 KB"
printf '%b\n' "${GREEN}[x]${RESET} documentation-standards  1.0.0   7 files   35.8 KB"
echo ""
printf '%b\n' "  ${DIM}Output: .claude/context/standards/${RESET}"
echo ""
printf '%b\n' "${YELLOW}[>]${RESET} Next steps:"
printf '%b\n' "    Run --check periodically to verify freshness"
printf '%b\n' "    Re-run when standards repo is updated"
```

### Registry Update

**Reference:** `ops:registry-update` primitive for the canonical read-modify-write procedure.

If registry does not exist, log warning and skip this step.

Append a `sync_history` entry to `$ECK_HOME/registry.yaml`:

```yaml
- date: "{DATE}"
  action: "pull-from-standards"
  performed_by: "/eck:pull-from-standards"
  summary: "Standards updated: {N} files refreshed from evolv-coder-standards"
```

Set `last_modified_at` to current ISO-8601 date.
Recompute `project_summary` per the `ops:registry-update` primitive.
Use atomic write: write to `registry.yaml.tmp`, then rename to `registry.yaml`.

### Outputs

- Summary box displayed to user with per-domain results

### Exit Criteria

- Summary displayed; statusline reset

---

## Error Handling

### Repository Not Found

```bash
printf '%b\n' "${RED}[!]${RESET} Repository not found: {STANDARDS_REPO_URL}"
printf '%b\n' "    ${DIM}Verify the repository exists and you have access.${RESET}"
printf '%b\n' "    ${DIM}Check: gh repo view {repo_name}${RESET}"
```

### Authentication Failed

```bash
printf '%b\n' "${RED}[!]${RESET} Authentication failed."
printf '%b\n' "    ${DIM}Run: gh auth login${RESET}"
printf '%b\n' "    ${DIM}Then retry: /eck:pull-from-standards${RESET}"
```

### Partial Compilation

```bash
printf '%b\n' "${YELLOW}[>]${RESET} {N} files not found in standards source."
printf '%b\n' "    ${DIM}Missing files:${RESET}"
printf '%b\n' "    ${DIM}  - {path1}${RESET}"
printf '%b\n' "    ${DIM}  - {path2}${RESET}"
printf '%b\n' ""
printf '%b\n' "    ${DIM}Compiled {M}/{total} files successfully.${RESET}"
printf '%b\n' "    ${DIM}The compiled output may be incomplete.${RESET}"
```

### Network Error

```bash
printf '%b\n' "${RED}[!]${RESET} Network error while updating standards cache."
printf '%b\n' "    ${DIM}Using existing cache at${RESET}"
printf '%b\n' "    ${DIM}~/.claude/evolv-coder-standards/${RESET}"
printf '%b\n' ""
printf '%b\n' "    ${DIM}If no cache exists:${RESET}"
printf '%b\n' "    ${DIM}Using embedded defaults in .claude/context/standards/${RESET}"
printf '%b\n' "    ${DIM}These may be outdated. Run the installer or retry${RESET}"
printf '%b\n' "    ${DIM}when network is available.${RESET}"
```

---

## Related Documents

- [compile-standards.py]($CLAUDE_PROJECT_DIR/.claude/scripts/compile-standards.py) — Compilation script (project-deployed)
- [/eck:new-project skill](../new-project/SKILL.md) — Calls pull-from-standards during setup
- [/eck:audit-unmanaged-project skill](../audit-unmanaged-project/SKILL.md) — Checks standards freshness
- [evolv-coder-standards repo](https://github.com/evolvconsulting/evolv-coder-standards) — Standards source
