Packs are self-contained units of knowledge. Each pack covers a specific domain — code quality, security, testing, git workflow — and contains rules and lessons that MARVEL injects into Claude's context when relevant.
Every pack is a directory under marvel/packs/ with three files:
marvel/packs/my-pack/
├── pack.json # Metadata and targeting rules
├── guardrails.md # Human-written rules (injected as-is)
└── lessons.jsonl # Machine-learned lessons (one JSON per line)
Controls when and where the pack's content is injected.
{
"name": "my-pack",
"version": "1.0.0",
"owner": "team-name",
"description": "What this pack covers",
"categories": ["category-a", "category-b"],
"applies_to": {
"extensions": [".ts", ".tsx"]
},
"sensitive_paths": ["**/auth/**"],
"excludes_paths": ["node_modules/", "dist/"]
}| Field | Description |
|---|---|
name |
Must match the directory name. Lowercase, hyphenated. |
version |
Semantic version string (e.g., 1.0.0). |
owner |
Team or individual responsible for maintaining the pack. |
| Field | Description |
|---|---|
description |
Brief description of the pack's purpose. |
categories |
Knowledge domains (used for relevance scoring and correction routing). |
applies_to.extensions |
File extensions that trigger this pack (e.g., [".ts", ".tsx"]). |
depends_on |
Other packs this pack depends on (boosts their relevance). |
sensitive_paths |
Glob patterns for high-importance files (strong relevance signal). |
excludes_paths |
Path prefixes where this pack should never inject. |
references.code_paths |
Key file paths in the codebase (strongest relevance signal). |
references.doc_links |
External documentation URLs. |
Packs are validated against marvel/packs/_pack.schema.json.
Human-authored rules injected directly into Claude's context. Write clear, imperative instructions organized by topic.
Good guardrails:
- "Use
unknowninstead ofanyfor untyped values." - "Always check for
nullbefore accessing optional chain results." - "Prefer
vitestmatchers over rawassertcalls."
Bad guardrails:
- "Write good code." (too vague)
- "Follow best practices." (not actionable)
Machine-learned lessons, one JSON object per line:
{"timestamp":"2026-01-15T10:00:00Z","category":"code-quality","title":"Prefer early returns","description":"Reduce nesting with guard clauses","actionable":"When a function has a guard condition, return early instead of wrapping the body in an if block"}| Field | Required | Description |
|---|---|---|
timestamp |
Yes | ISO 8601 creation time. |
category |
Yes | Knowledge domain (should match a pack category). |
title |
Yes | Short identifier. |
description |
Yes | What the lesson teaches. |
actionable |
Yes | Concrete instruction for Claude to follow. |
run_id |
No | Session that created the lesson. |
utility_score |
No | Effectiveness rating (set by /marvel-health). |
injection_count |
No | How many times this lesson has been injected. |
When a PreToolUse hook fires for a file operation, MARVEL scores every loaded pack to decide which lessons to inject.
| Signal | Weight | Description |
|---|---|---|
FILE_PATTERN_MATCH |
15 | File path matches references.code_paths |
EXTENSION_MATCH |
5 | File extension matches applies_to.extensions |
SENSITIVE_PATH |
20 | File matches sensitive_paths glob |
RECENT_CORRECTION |
20 | User corrected something in this pack's category (last 30 min, up to 3x) |
CATEGORY_MATCH |
8 | Recent guidance matches the pack's categories |
PATH_KEYWORD |
8 | File path contains a keyword matching the pack (e.g., "test" -> testing) |
DEPENDENCY_BOOST |
3 | Pack is a dependency of another relevant pack |
- Strong signal (code path, sensitive path, or recent correction): minimum score of 10
- Weak signal (extension match only): minimum score of 20
- Maximum 4 packs per injection
- Maximum 10 lessons total (sorted by
utility_scoredescending, 3 per pack)
File paths containing certain keywords boost packs with matching categories:
| Keyword | Boosted Categories |
|---|---|
test, spec |
testing, test-quality |
auth, middleware |
security, auth |
config, env |
configuration |
schema, migration |
database, schema |
If a file path starts with any of the pack's excludes_paths prefixes, the pack's score is set to 0.
- Capture — The
UserPromptSubmithook detects a user correction - Classify — Guidance is categorized by type and domain
- Store — Guidance is written to the run's
guidance.jsonl - Reflect —
/marvel-reflectreviews guidance and extracts lesson candidates - Promote — Approved lessons are appended to the target pack's
lessons.jsonl - Inject — Future
PreToolUsehooks include the lesson when the pack is relevant - Evolve —
/marvel-evolvegraduates high-utility lessons intoguardrails.mdand prunes stale ones
MARVEL ships with four starter packs:
| Pack | Categories | File Extensions | Sensitive Paths |
|---|---|---|---|
code-quality |
typescript, code-quality, patterns | .ts, .tsx, .js, .jsx | — |
git-workflow |
git, workflow, collaboration | .md | .git/**, CLAUDE.md |
testing |
testing, vitest, test-quality | .test.ts, .test.tsx, .spec.ts, .spec.tsx | — |
security |
security, auth, validation | .ts, .tsx, .js, .jsx | **/auth/**, **/middleware/**, **/.env* |
These are starting points. Modify them or create new packs to match your project's conventions.