Create Context
Create the baseline session context from the in-folder of raw project documents, classifying each file by priority, writing a manifest, summarising oversized files and producing a token-budgeted baseline. Use when bootstrapping project context or setting up the ctx snapshot once per project. Triggers include "create context", "bootstrap context", "setup context", "init context".
npx skills add github:pantheon-org/tekhne --skill agentic-harness--create-contextTurn the raw documents in the in-folder into a prioritised, token-budgeted snapshot that later sessions load in one read.
Layout
.context/session/in/ immutable input: users drop documents here, no command edits it
.context/session/ctx/ generated snapshot: manifest, copies, summaries
.context/session/CONTEXT-baseline-llm.md single load point, 2000 tokens at most
Mindset
- Use the in-folder as the source of truth. The manifest mirrors it faithfully.
- Keep the snapshot scoped to the session’s open questions. Include only what shapes decisions.
- Keep one manifest per session. Two manifests in one folder leave load-context unable to choose.
- State the origin of every constraint, assumption and decision that enters the baseline.
When to Use
- Use it once per project when raw documents sit in the in-folder and no ctx snapshot exists.
- Use it with
--forceafter the source documents changed materially. - Use it when load-context reports a missing manifest.
When Not to Use
- Do not use it when the ctx snapshot is current. A rerun without
--forcestops, and--forcediscards existing summaries. - Do not use it when the in-folder is empty. There is nothing to scan.
- Do not use it to refresh one document. Update that summary and its manifest entry by hand.
- Use save-context instead to store live session state in a named stream.
Steps
- Guard the prerequisites. Stop on a missing in-folder, and stop on an existing ctx folder unless
--forcewas passed.
[ -d .context/session/in ] || { echo "No in-folder found. Add source files first." >&2; exit 1; }
[ -d .context/session/ctx ] && [ "$ARGUMENTS" != "--force" ] && { echo "ctx exists. Use --force." >&2; exit 1; }
- Scan the in-folder with the bundled script. It lists md, txt, csv, yaml, yml and json files with a token estimate, and skips sensitive paths.
./scripts/scan-in-folder.sh .context/session/in
- Classify every file as HIGH, MEDIUM or LOW with a one-line description. Batch several files into each AskUserQuestion call, and check for blank answers after every call (see the guard below).
- Size each file with
wc -w, where tokens are words divided by 0.75, then apply the thresholds.
| Priority | At or under threshold | Over threshold, up to 25K | Over 25K |
|---|---|---|---|
| HIGH (1500) | inline | summarise directly | summarise via sub-agent |
| MEDIUM (2500) | inline | summarise directly | summarise via sub-agent |
| LOW | reference only, no copy | not applicable | not applicable |
- Copy HIGH and MEDIUM files into the ctx folder and keep their subdirectories. Write a summary of about 500 tokens for each oversized file, and delegate files above 25K tokens to the
summarize-for-contextsub-agent. - Write
manifest.yamlin the ctx folder after sizing, because eachactionvalue depends on it. Then validate it.
./scripts/validate-manifest.sh .context/session/ctx/manifest.yaml
- Write the baseline within 2000 tokens: inline content, summary pointers and LOW references. Report the file counts and the RISEN INPUT table, then suggest
/save-context baseline.
AskUserQuestion Guard
Outside Plan Mode the tool can return blank answers without showing its UI. After every call, check the answers. If they are blank, do not assume a priority. Print the options as a numbered list, ask for the number, and wait for the reply.
Anti-Patterns
- NEVER build the manifest from memory. WHY: the in-folder defines the scope, so a manifest without a scan misleads every downstream agent.
# BAD: fabricated, no scan, wrong shape
high_priority: []
# GOOD: sources.high/medium/low from a real scan
sources:
high:
- {file: design-doc.md, desc: "Architecture decisions", action: inline}
medium: []
low: []
- NEVER omit
high,mediumorlow, even when empty. WHY:validate-manifest.shfails and consumers cannot iterate predictably. - NEVER copy files matching
.env*,*credentials*,*secrets*,*token*,*.key,*.pem,*.crt,*.p12or*.pfx. WHY: the ctx folder gets committed and shared, so a copied secret leaks.
# BAD: copies everything, secrets included
cp -r .context/session/in/* .context/session/ctx/
# GOOD: select with the scanner, which also skips secrets inside a secrets/ directory
./scripts/scan-in-folder.sh .context/session/in
- NEVER inline a file above its threshold. WHY: one oversized inline breaks the 2000-token baseline budget on every later load.
- NEVER run the skill concurrently with save-context or load-context. WHY: nothing locks the ctx folder, so the last writer wins and leaves a partial manifest.
- Pitfall: a filename pattern alone misses
secrets/prod.yaml. Check directory names too, as the scanner does.
References
- Reference - manifest schema, sizing rules, baseline template, validation rules and error messages
- Worked examples - bootstrap, forced rebuild and large-file runs with expected output
Explicit NEVER/WHY/consequence triplets with side-by-side bad/good examples. Generic warnings score low — concrete failure modes with real impact (security, correctness, performance) score high.
Runtime validation via eval scenarios proving the skill actually changes agent behaviour. Requires evals/ directory, instructions.json, ≥3 scenarios, and ≥80% instruction coverage in summary.json.
Appropriate rigidity for the skill type: strict rules for critical/security skills, balanced steps for process skills, flexible options for tool skills. Mismatched calibration (too rigid or too loose) reduces score.
Expert-only knowledge the AI couldn't derive on its own — domain-specific patterns, production gotchas, decision frameworks, and non-obvious tool behaviour. High scores mean <5% redundancy with what the model already knows.
A clear philosophy plus numbered step-by-step workflows with explicit entry/exit points. Should answer: what is the core principle, how to execute it, and when (and when not) to apply it.
Rich activation keywords and trigger scenarios in the description so the skill fires when needed. Best descriptions read like an exhaustive list of the tasks and concepts that should invoke this skill.
Copy-paste-ready code, complete runnable examples, real file paths and commands. Pseudocode and abstract descriptions score low — concrete, executable content scores high.
SKILL.md as a <100-line navigation hub pointing to focused references/ files. Content should be lazy-loaded on demand, not front-loaded. Includes actionable 'When to Use' conditions per reference.
Proper frontmatter, single-task focus, activation keywords, and cross-harness portability. Skills must work across 40+ agentic harnesses without hardcoded paths or agent-specific references.
Explicit NEVER/WHY/consequence triplets with side-by-side bad/good examples. Generic warnings score low — concrete failure modes with real impact (security, correctness, performance) score high.
Runtime validation via eval scenarios proving the skill actually changes agent behaviour. Requires evals/ directory, instructions.json, ≥3 scenarios, and ≥80% instruction coverage in summary.json.
Appropriate rigidity for the skill type: strict rules for critical/security skills, balanced steps for process skills, flexible options for tool skills. Mismatched calibration (too rigid or too loose) reduces score.
Expert-only knowledge the AI couldn't derive on its own — domain-specific patterns, production gotchas, decision frameworks, and non-obvious tool behaviour. High scores mean <5% redundancy with what the model already knows.
A clear philosophy plus numbered step-by-step workflows with explicit entry/exit points. Should answer: what is the core principle, how to execute it, and when (and when not) to apply it.
Rich activation keywords and trigger scenarios in the description so the skill fires when needed. Best descriptions read like an exhaustive list of the tasks and concepts that should invoke this skill.
Copy-paste-ready code, complete runnable examples, real file paths and commands. Pseudocode and abstract descriptions score low — concrete, executable content scores high.
SKILL.md as a <100-line navigation hub pointing to focused references/ files. Content should be lazy-loaded on demand, not front-loaded. Includes actionable 'When to Use' conditions per reference.
Proper frontmatter, single-task focus, activation keywords, and cross-harness portability. Skills must work across 40+ agentic harnesses without hardcoded paths or agent-specific references.
Expert-only knowledge the AI couldn't derive on its own — domain-specific patterns, production gotchas, decision frameworks, and non-obvious tool behaviour. High scores mean <5% redundancy with what the model already knows.
A clear philosophy plus numbered step-by-step workflows with explicit entry/exit points. Should answer: what is the core principle, how to execute it, and when (and when not) to apply it.
Explicit NEVER/WHY/consequence triplets with side-by-side bad/good examples. Generic warnings score low — concrete failure modes with real impact (security, correctness, performance) score high.
Proper frontmatter, single-task focus, activation keywords, and cross-harness portability. Skills must work across 40+ agentic harnesses without hardcoded paths or agent-specific references.
SKILL.md as a <100-line navigation hub pointing to focused references/ files. Content should be lazy-loaded on demand, not front-loaded. Includes actionable 'When to Use' conditions per reference.
Appropriate rigidity for the skill type: strict rules for critical/security skills, balanced steps for process skills, flexible options for tool skills. Mismatched calibration (too rigid or too loose) reduces score.
Rich activation keywords and trigger scenarios in the description so the skill fires when needed. Best descriptions read like an exhaustive list of the tasks and concepts that should invoke this skill.
Copy-paste-ready code, complete runnable examples, real file paths and commands. Pseudocode and abstract descriptions score low — concrete, executable content scores high.
Runtime validation via eval scenarios proving the skill actually changes agent behaviour. Requires evals/ directory, instructions.json, ≥3 scenarios, and ≥80% instruction coverage in summary.json.
No eval scenarios available.
create-context worked examples
Paths are given relative to the session folder: in/ is the in-folder, ctx/ the generated snapshot.
Bootstrap at session start
Input: in/design-doc.md (900 words), in/requirements.csv (2400 words), in/old-notes.txt.
- Run the scanner. It reports three files with estimates of 1200, 3200 and a small figure for the notes.
- The user classifies
design-doc.mdas HIGH,requirements.csvas MEDIUM andold-notes.txtas LOW. - Apply the sizing table.
design-doc.mdis 1200 tokens, under the HIGH threshold of 1500, so copy it and inline it.requirements.csvis 3200 tokens, over the MEDIUM threshold of 2500, so copy it and writectx/01-requirements-summary-llm.md.old-notes.txtis LOW, so list it by path and copy nothing.
- Write
ctx/manifest.yamlwithaction: inlinefor the design document andaction: summarizedfor the CSV, then run the validator.
Expected output: a RISEN INPUT table with three rows (HIGH, MED, LOW) and the suggestion /save-context baseline.
Forced rebuild after a source change
A requirements file was replaced and the ctx folder already exists.
- A plain run stops with “ctx exists. Use –force.” and changes nothing.
- A
--forcerun rescans, asks for priorities again, and rewrites the manifest, the copies, the summaries and the baseline. - Hand-edited summaries are discarded. Copy any summary worth keeping elsewhere before forcing.
One file above 25K tokens
A 40K-token specification is classified HIGH.
- Direct summarising would need the whole file in the main context, so delegate to the
summarize-for-contextsub-agent, which reads it in chunks. - The summary lands in
ctx/{nn}-{basename}-summary-llm.mdat about 500 tokens, and the manifest recordsaction: summarized.
Blank AskUserQuestion answers
The classification call returns without any answer and without showing its UI.
- Do not default the files to MEDIUM. Print the files with options
1 HIGH,2 MEDIUM,3 LOW, and wait for the user’s reply. - Resume at step 4 only once every file has a priority the user chose.
Secrets in the in-folder
in/secrets/prod.yaml, in/prod-credentials.json and in/api.key sit beside ordinary documents.
- The scanner prints
SKIPPED (security)for each on stderr and leaves them out of its JSON. - The first one is skipped because of its directory name, not its filename, which is why the scanner checks every path component.
- None of the three appears in the manifest or in the ctx folder. Tell the user which files were skipped.
create-context Reference
Manifest Schema (.context/session/ctx/manifest.yaml)
project: string # Auto-inferred from directory
created: ISO8601 # Timestamp of creation
source_folder: .context/session/in/ # Reference to immutable bootstrap folder
sources:
high: # ≤1500 tokens inline, >1500 summarized
- file: string # Path relative to .context/session/in/
desc: string # Human-readable description
action: inline|summarized # Auto-set based on size
medium: # ≤2500 tokens inline, >2500 summarized
- file: string
desc: string
action: inline|summarized
low: # Reference only, no content copied
- file: string
desc: string
tags: # Optional categorization
category_name: [file1, file2]
Context Sizing Behavior
| Priority | Token Count | Action |
|---|---|---|
| HIGH | ≤1500 | Copy to .context/session/ctx/, inline in baseline |
| HIGH | >1500, ≤25K | Copy to .context/session/ctx/, summarize directly |
| HIGH | >25K | Copy to .context/session/ctx/, summarize via sub-agent |
| MEDIUM | ≤2500 | Copy to .context/session/ctx/, inline in baseline |
| MEDIUM | >2500, ≤25K | Copy to .context/session/ctx/, summarize directly |
| MEDIUM | >25K | Copy to .context/session/ctx/, summarize via sub-agent |
| LOW | any | Reference only (path to .context/session/in/, no copy) |
Token estimation: tokens ≈ words / 0.75 (using wc -w)
25K limit: Files exceeding this use summarize-for-context sub-agent with chunked reads.
Baseline Template (.context/session/CONTEXT-baseline-llm.md)
# Baseline Context
saved: {ISO 8601 timestamp}
stream: baseline
manifest: .context/session/ctx/manifest.yaml
source: .context/session/in/
## Project
ref: .context/session/ctx/manifest.yaml
source_folder: .context/session/in/
files: {total_count}
## Sources (inline)
### {filename}
{Full content from .context/session/ctx/{file}}
## Sources (summarized)
### {filename}
See: `.context/session/ctx/{nn}-{basename}-summary-llm.md`
## Sources (reference only)
- `.context/session/in/{path}`: {description}
## Refs
manifest: .context/session/ctx/manifest.yaml
summaries: [.context/session/ctx/01-*.md, .context/session/ctx/02-*.md, ...]
source: .context/session/in/
Token budget: ≤2000 tokens total.
Validation Rules
- Required: project, created, source_folder, sources (high/medium/low)
- File paths: Relative to
.context/session/in/, must exist at generation time - Descriptions: Required, non-empty, concise (1-2 sentences)
- Action field: Auto-set, user can override
- Tags: Optional, keys alphanumeric/hyphens/underscores
- All priority sections: Must be present (can be empty arrays)
Security
Auto-skipped: .env*, *credentials*, *secrets*, *token*, *.key, *.pem, *.crt, *.p12, *.pfx.
The scanner matches every path component, so a file inside a directory named secrets/ is skipped too. Skipped paths are printed on stderr as SKIPPED (security). Set CONTEXT_DIR to scan a context root other than .context.
RISEN INPUT Table (output)
| Priority | File | Description |
|----------|------|-------------|
| 1 (HIGH) | @.context/session/ctx/proposal.md | Main objectives |
| 2 (MED) | @.context/session/ctx/style-guide.md | Style reference |
| 3 (LOW) | @.context/session/in/old-notes.md | Background (ref only) |
Scripts
scripts/scan-in-folder.sh [IN_DIR]— scan the in-folder, print JSON with a token estimate per file, skip sensitive pathsscripts/validate-manifest.sh [MANIFEST]— check required fields, the three priority sections, that listed files exist and that every file has a description; exits 1 on a schema error and 0 with warnings when files are missing
Error Messages
| Check | Message |
|---|---|
[ -d .context/session/in/ ] |
“No .context/session/in/ folder found. Create it and add source files first.” |
ls .context/session/in/ empty |
“No files in .context/session/in/ folder. Add documents first.” |
[ -d .context/session/ctx/ ] |
“.context/session/ctx/ exists. Use –force to recreate.” |
Related
/save-context [stream]- Save session to named stream/load-context [stream]- Load saved streamscripts/validate-manifest.sh- Validate manifest schemasummarize-for-contextsub-agent - summarises files above 25K tokens in chunks- Worked examples - end-to-end runs