Skip to content
Back to skills

Learn

ASecurity

Explore a codebase with parallel Haiku agents — clone, read, and document. Modes — --fast (1 agent), default (3), --deep (5). Use when user says "learn [repo]", "explore codebase", "study this repo", or shares a GitHub URL to study. Do NOT trigger for finding projects (use /trace), session mining (use /dig), or cloning for active development (use /incubate).

  • 132 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added May 31, 2026
documentationpythonrustgobashtestinggitapidocumentation

Works with

  • api

Security analysis

A100/100

Scanned December 3, 2026

npx -y skills add Soul-Brews-Studio/arra-oracle-skills-cli --skill learn --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Learn?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Learn
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/soul-brews-studio-learn/badge)](https://www.skillsdirectory.com/skills/soul-brews-studio-learn)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: learn
description: Explore a codebase with parallel Haiku agents — clone, read, and document. Modes — --fast (1 agent), default (3), --deep (5). Use when user says "learn [repo]", "explore codebase", "study this repo", or shares a GitHub URL to study. Do NOT trigger for finding projects (use /trace), session mining (use /dig), or cloning for active development (use /incubate).
argument-hint: "<repo-url> [--fast | --deep]"
group: code
tier: standard
---

# /learn - Deep Dive Learning Pattern

Explore a codebase with 3 parallel Haiku agents → create organized documentation.

## Usage

```
/learn [url]             # Auto: clone via ghq, symlink origin/, then explore
/learn [slug]            # Use slug from ψ/memory/slugs.yaml
/learn [repo-path]       # Path to repo
/learn [repo-name]       # Finds in ψ/learn/owner/repo
/learn --init            # Restore all origins after git clone (like submodule init)
```

## Depth Modes

| Flag | Agents | Files | Use Case |
|------|--------|-------|----------|
| `--fast` | 1 | 1 overview | Quick scan, "what is this?" |
| (default) | 3 | 3 docs | Normal exploration |
| `--deep` | 5 | 5 docs | Master complex codebases |

```
/learn --fast [target]   # Quick overview (1 agent, ~2 min)
/learn [target]          # Standard (3 agents, ~5 min)
/learn --deep [target]   # Deep dive (5 agents, ~10 min)
```

## Directory Structure

```
ψ/learn/
├── .origins             # Manifest of learned repos (committed)
└── owner/
    └── repo/
        ├── origin       # Symlink to ghq source (gitignored)
        ├── repo.md      # Hub file - links to all sessions (committed)
        └── YYYY-MM-DD/  # Date folder
            ├── 1349_ARCHITECTURE.md      # Time-prefixed files
            ├── 1349_CODE-SNIPPETS.md
            ├── 1349_QUICK-REFERENCE.md
            ├── 1520_ARCHITECTURE.md      # Second run same day
            └── ...
```

**Multiple learnings**: Each run gets time-prefixed files (HHMM_), nested in date folder.

**Offload source, keep docs:**
```bash
unlink ψ/learn/owner/repo/origin   # Remove symlink
ghq rm owner/repo                  # Remove source
# Docs remain in ψ/learn/owner/repo/
```

## /learn --init

Restore all origins after cloning (like `git submodule init`):

```bash
ROOT="$(pwd)"
# .origins entries are "host/owner/repo" (current) or bare "owner/repo" (legacy — github.com)
while read entry; do
  SLASHES=$(tr -cd '/' <<< "$entry" | wc -c)
  if [ "$SLASHES" -ge 2 ]; then
    HOST=$(cut -d/ -f1 <<< "$entry")
    OWNER=$(cut -d/ -f2 <<< "$entry")
    REPO=$(cut -d/ -f3- <<< "$entry")
  else
    HOST="github.com"
    OWNER=$(dirname "$entry")
    REPO=$(basename "$entry")
  fi
  ghq get -u "https://$HOST/$OWNER/$REPO"
  mkdir -p "$ROOT/ψ/learn/$OWNER/$REPO"
  ln -sf "$(ghq root)/$HOST/$OWNER/$REPO" "$ROOT/ψ/learn/$OWNER/$REPO/origin"
  echo "✓ Restored: $HOST/$OWNER/$REPO"
done < "$ROOT/ψ/learn/.origins"
```

## Step 0: Detect Input Type + Resolve Path

Clones via ghq, writes the `origin/` symlink and `.origins` entry, and — the part that matters most — resolves that symlink before handing any path to an agent. An agent given the ψ-nested path models the target as a variant of THIS repo: measured on one real run, 3 contaminated docs and 26 false claims from the nested path versus zero from the resolved one. Carries the verbatim isolation preamble and the absent-referent rule. Read it before spawning any agent. See [references/resolve-target.md](references/resolve-target.md).

## Scope

**For external repos**: Clone with script first, then explore via `origin/`
**For local projects** (in `specs/`, `ψ/lib/`): Read directly

## Step 0.5: Detect a single-file target

A gist, and some repos, is one file rather than a codebase. Check before picking agents:

```bash
FILE_COUNT=$(find "$SOURCE_DIR" -type f -not -path '*/.git/*' | wc -l | tr -d ' ')
echo "Files in source: $FILE_COUNT"
```

**If `FILE_COUNT` is 1, or a small handful all readable in one pass:**

- **Do not spawn the Haiku agents.** Read the file yourself. Parallel agents exist to divide
  a codebase too large to hold at once; delegating a file you already hold costs a full
  round-trip per agent and returns what you could have read directly.
- **Drop the fixed Architecture / Code Snippets / Testing / API Surface categories** — they
  assume a codebase. Name 3–5 docs after what the file actually contains (a guideline or
  config document, say: Structure, its core mechanism, Rules and Constraints, Templates,
  Lessons).
- Still write the number of files the mode implies — 1 for `--fast`, 3 by default, 5 for
  `--deep`. The count is adapted by content, not by role.
- Step 2 (the hub file) and the Trace Connection are unchanged.

Say so plainly when it triggers: *"This gist is a single 240-line file, not a codebase —
reading it directly instead of spawning agents."*

If `FILE_COUNT` is more than a handful, continue to Step 1.

## Step 1: Detect Mode & Calculate Paths

Check arguments for `--fast` or `--deep`:
- `--fast` → Single overview agent
- `--deep` → 5 parallel agents
- (neither) → 3 parallel agents (default)
- single-file target, any mode → no agents; see Step 0.5

**Calculate ACTUAL paths (replace variables with real values):**
```
TODAY = YYYY-MM-DD (e.g., 2026-02-04)
TIME = HHMM (e.g., 1349)
REPO_DIR = [ROOT]/ψ/learn/[OWNER]/[REPO]/
DOCS_DIR = [ROOT]/ψ/learn/[OWNER]/[REPO]/[TODAY]/   ← date folder
SOURCE_DIR = $(readlink [ROOT]/ψ/learn/[OWNER]/[REPO]/origin)  ← RESOLVED ghq path.
             Never pass the ψ/-nested symlink path to an agent (see BUG 2 above).
FILE_PREFIX = [TIME]_                               ← time prefix for files

Example:
- ROOT = /home/user/ghq/github.com/my-org/my-oracle
- OWNER = acme-corp
- REPO = cool-library
- TODAY = 2026-02-04, TIME = 1349
- DOCS_DIR = .../ψ/learn/acme-corp/cool-library/2026-02-04/
- Files: 1349_ARCHITECTURE.md, 1349_CODE-SNIPPETS.md, etc.
```

**⚠️ CRITICAL: Create symlink AND date folder FIRST, then spawn agents!**

1. Run the clone + symlink script in Step 0 FIRST
2. Capture TIME: `date +%H%M` (e.g., 1349)
3. Create the date folder: `mkdir -p "$DOCS_DIR"`
4. Capture DOCS_DIR, SOURCE_DIR, and TIME as literal values
5. THEN spawn agents with paths including TIME prefix

**Multiple runs same day?** Each run gets unique TIME prefix → no overwrites.

---

## Agent prompts per mode

What each arm is told, per mode: 1 overview agent for `--fast`, 3 for the default, 5 for `--deep`, with the literal `READ from` / `WRITE to` pair each one needs. Read it after Step 0 has resolved the paths. See [references/agent-prompts.md](references/agent-prompts.md).

## Step 1.9: Contamination check (REQUIRED — before the hub file)

Agents that leak are fluent and confident; you cannot spot it by reading. Grep
for **our** distinctive vocabulary appearing in docs about **their** repo:

```bash
# Terms distinctive to THIS oracle repo. A hit means the doc is describing us.
rg -n --stats "src/skills|split-brain|bun run compile|public shelf|CalVer|G-SKLL|zombie|lefthook" \
   "$DOCS_DIR"/${TIME}_*.md
```

Any hit → verify that specific claim against the target before trusting the
doc. Cheap structural checks settle most of them instantly:

```bash
ls -d "$SOURCE_DIR/src" 2>&1                                  # does the vault exist?
python3 -c "import json;print(json.load(open('$SOURCE_DIR/package.json')).get('scripts'))"
```

If a doc is contaminated, **prepend a correction banner naming each false
claim and its verified reality** — do not silently delete, and do not just
warn generically. Check **every** doc: a partial pass leaves a poisoned file
looking clean by omission (this happened — `TESTING.md` was missed on the
first pass and read as verified for 25 minutes).

## Step 2: Create/Update Hub File ([REPO].md)

```markdown
# [REPO] Learning Index

## Source
- **Origin**: ./origin/
- **GitHub**: https://github.com/$OWNER/$REPO

## Explorations

### [TODAY] [TIME] ([mode])
- [[YYYY-MM-DD/HHMM_ARCHITECTURE|Architecture]]
- [[YYYY-MM-DD/HHMM_CODE-SNIPPETS|Code Snippets]]
- [[YYYY-MM-DD/HHMM_QUICK-REFERENCE|Quick Reference]]
- [[YYYY-MM-DD/HHMM_TESTING|Testing]]        <!-- --deep only -->
- [[YYYY-MM-DD/HHMM_API-SURFACE|API Surface]] <!-- --deep only -->

**Key insights**: [2-3 things learned]

### [TODAY] [EARLIER-TIME] ([mode])
...
```

## Output Summary

After learning completes, print the hub + generated file paths.

# announce-mode → absolute path (no ψ/, no ~/, no $VAR, no ...).
# Use:  echo "marker: $RESOLVED_PATH"  — bash substitutes. See CONVENTIONS.md.

```bash
echo "📚 Hub: $REPO_DIR/$REPO.md"
echo "📚 Files: $DOCS_DIR/${TIME}_*.md"
ls "$DOCS_DIR"/${TIME}_*.md
```

Files generated depend on mode (`--fast` → 1 overview; default → 3 docs; `--deep` → 5 docs). Add a 2–3 line "Key Insights" summary after the file listing.

## .gitignore Pattern

For Oracles that want to commit docs but ignore symlinks:

```gitignore
# Ignore origin symlinks only (source lives in ghq)
# Note: no trailing slash - origin is a symlink, not a directory
ψ/learn/**/origin
```

**After running /learn**, check your repo's `.gitignore` has these patterns so docs are committed but symlinks are ignored.

## Trace Connection

After writing docs, log the learning to Oracle so it's discoverable via `/trace`:

### Save the lesson (two-layer pattern)

1. Write to `ψ/memory/learnings/YYYY-MM-DD_<slug>.md` with frontmatter:
   ```yaml
   ---
   pattern: "Learned [REPO]: [2-3 key insights]"
   date: <today>
   source: learn: OWNER/REPO
   concepts: ["learn", "codebase", <relevant-tags>]
   ---

   # Learned [REPO]
   <2-3 key insights in body>
   ```

2. The Oracle's auto-memory layer picks up new files in `ψ/memory/learnings/` automatically — no separate API call needed.

This connects `/learn` to the shared knowledge layer — future `/trace` queries find what was learned.

## Notes

- `--fast`: 1 agent, quick scan for "what is this?"
- Default: 3 agents in parallel, good balance
- `--deep`: 5 agents, comprehensive for complex repos
- Haiku for exploration = cost effective
- Main reviews = quality gate
- `origin/` structure allows easy offload
- `.origins` manifest enables `--init` restore

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in documentation →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.