/write — Context Externalizer
Move knowledge from the context window into a structured, persistent file in .wisci/context/. This is the "save to disk" operation — preserve what would otherwise be lost to context limits or session endings.
Boundary: /write stores reusable knowledge (research, decisions, architecture notes). Session work state (goal, in-progress, next steps) belongs in /compress.
Timestamp: !date '+%Y-%m-%d %H:%M'
Execution Flow
Parse arguments. Read $ARGUMENTS to determine what to externalize from the current context.
Derive topic slug. Extract the core topic noun phrase (strip filler: "results on", "notes about"), kebab-case, lowercase, max 5 words. If the user names a target file explicitly, use it.
Check for existing file. Glob .wisci/context/ for the slug:
- No match: Create Mode below.
- Exact match, same topic: Merge Mode — read and follow references/merge-procedure.md.
- Exact match, different topic: ask the user — merge or disambiguated new name.
Write to .wisci/context/<topic-slug>.md (create directories as needed).
Confirm. Report path, created vs merged, and a one-line content summary.
Create Mode
- Extract and structure the information from the current context per
$ARGUMENTS
- Organize into logical
## sections
- Build a
## References section listing every file path mentioned in the content
- Write using the output format below
Output Format
# <Title inferred from arguments>
> Last updated by /write on <timestamp from above>
> Source: <what session context this was extracted from>
## Summary
<2-3 sentence overview>
## <Section 1>
<Structured content with all specifics preserved>
## Key Details
- **Decisions**: <every decision made, with rationale>
- **Open questions**: <anything unresolved>
## References
- `src/auth/middleware.ts` — auth middleware, token validation logic
- `src/auth/session.ts:42` — session expiry configuration
Preservation Rules
Never summarize away:
- Exact file paths and line numbers
- Error messages and error codes
- Numeric values, measurements, benchmarks
- Command outputs and their results
- Decisions and the reasoning behind them
- Function, class, variable, and module names
- URLs and references
When condensing verbose material, compression must be reversible: keep the pointer (file path, URL, commit hash) next to every condensed claim so the detail is one Read away.
Key Constraints
## References is always the last section, each entry annotated with why it is referenced. This manifest powers staleness detection by /select and the bundled script (scripts/wisci.py).
- The
## References section is rebuilt from scratch on every write — current state, not accumulated history.
- When in doubt during merge, preserve both versions and flag with
<!-- REVIEW: possible overlap -->.
1---2name: write3description: Externalizes knowledge from the conversation into persistent, staleness-tracked markdown files under .wisci/context/. Use when research results, decisions, or findings are worth keeping beyond this session, or when the user wants context saved to disk.4---56# /write — Context Externalizer78Move knowledge from the context window into a structured, persistent file in `.wisci/context/`. This is the "save to disk" operation — preserve what would otherwise be lost to context limits or session endings.910**Boundary:** `/write` stores reusable *knowledge* (research, decisions, architecture notes). Session work *state* (goal, in-progress, next steps) belongs in `/compress`.1112Timestamp: !`date '+%Y-%m-%d %H:%M'`1314## Execution Flow15161. **Parse arguments.** Read `$ARGUMENTS` to determine what to externalize from the current context.17182. **Derive topic slug.** Extract the core topic noun phrase (strip filler: "results on", "notes about"), kebab-case, lowercase, max 5 words. If the user names a target file explicitly, use it.19203. **Check for existing file.** Glob `.wisci/context/` for the slug:21 - **No match:** Create Mode below.22 - **Exact match, same topic:** Merge Mode — read and follow [references/merge-procedure.md](references/merge-procedure.md).23 - **Exact match, different topic:** ask the user — merge or disambiguated new name.24254. **Write** to `.wisci/context/<topic-slug>.md` (create directories as needed).26275. **Confirm.** Report path, created vs merged, and a one-line content summary.2829## Create Mode30311. Extract and structure the information from the current context per `$ARGUMENTS`322. Organize into logical `##` sections333. Build a `## References` section listing every file path mentioned in the content344. Write using the output format below3536## Output Format3738```markdown39# <Title inferred from arguments>4041> Last updated by /write on <timestamp from above>42> Source: <what session context this was extracted from>4344## Summary45<2-3 sentence overview>4647## <Section 1>48<Structured content with all specifics preserved>4950## Key Details51- **Decisions**: <every decision made, with rationale>52- **Open questions**: <anything unresolved>5354## References55- `src/auth/middleware.ts` — auth middleware, token validation logic56- `src/auth/session.ts:42` — session expiry configuration57```5859## Preservation Rules6061Never summarize away:6263- Exact file paths and line numbers64- Error messages and error codes65- Numeric values, measurements, benchmarks66- Command outputs and their results67- Decisions and the reasoning behind them68- Function, class, variable, and module names69- URLs and references7071When condensing verbose material, compression must be reversible: keep the pointer (file path, URL, commit hash) next to every condensed claim so the detail is one Read away.7273## Key Constraints7475- `## References` is always the last section, each entry annotated with why it is referenced. This manifest powers staleness detection by `/select` and the bundled script ([scripts/wisci.py](scripts/wisci.py)).76- The `## References` section is rebuilt from scratch on every write — current state, not accumulated history.77- When in doubt during merge, preserve both versions and flag with `<!-- REVIEW: possible overlap -->`.