Cognitive Output Refiner
Activation Contract
Use only when the user explicitly asks in English to refine, summarize, compact, deduplicate, or reduce the cognitive load of textual output such as Markdown, console output, logs, test results, or agent responses.
Do not activate automatically just because output is long. If the input is already concise, say no refinement is needed and offer at most a micro-improvement.
Hard Rules
- Preserve the input language. Do not translate unless asked.
- Redaction takes precedence over all exact-preservation requirements, including this output template. Never include credential material, including secrets, credentials, inline credentials, connection strings, URL-embedded credentials, API keys, access tokens, cookies, passwords, private keys, session identifiers, or authorization headers, in whole or in part; replace the full credential value with a placeholder such as
[REDACTED_TOKEN].
- Preserve useful diagnostic detail from errors, relevant stack frames, commands, paths, public/non-sensitive IDs, decisions, trade-offs, critical warnings, verification steps, and actionable next steps. When preserving stack frames, commands, or paths, redact usernames, local/private path prefixes, internal hostnames, credentials, and other sensitive identifiers while keeping non-sensitive filenames, function names, line numbers, error codes, and public IDs.
- When an ID's sensitivity is ambiguous, redact it. Preserve only clearly public identifiers.
- Be faithful by default. Label inferences as
Inference, Likely cause, or Possible next step; never present them as input facts.
- Deduplicate by keeping one canonical version. Preserve meaningful differences explicitly.
- Target 30–50% of the original size by default; use 10–20% only for explicit ultra-compact requests. Fidelity beats size.
- Never overwrite source content. Produce a separate response or file.
Decision Gates
| Input |
Strategy |
| Markdown/docs |
Preserve useful hierarchy, improve headings, merge duplicated sections. |
| Console/logs/tests |
Group by signal: result, errors, warnings, files, commands, next steps. Preserve order only when causal. |
| Agent/LLM output |
Remove repetition, separate decisions from explanations, cut unnecessary narrative. |
Create a file only when the user asks to save/create a document or provides a file as input. Save in the current working directory unless a path is provided. Infer the topic when possible; ask only if unclear. Use {topic_snake_case}_v<semver>.md; do not save the original. Start at v1.0.0 when no prior refined version exists.
SemVer: patch for clarity/order/deduplication, minor for added information or structure changes, major for changed interpretation.
Output Contract
Return this shape, omitting optional sections when empty. Optional sections are Preserved Details, Information Loss, and Compression Notes. Evaluate each Satisfaction Check item honestly before rendering; if any item fails, fix the output before asking the user.
## TL;DR
- <2-4 bullets with the essential signal>
## Refined Output
<clean, grouped, non-duplicative output>
## Preserved Details
<errors, redacted commands/paths, public/non-sensitive IDs, decisions, redacted placeholders, or other must-preserve facts; never include credential material or ambiguous sensitive identifiers>
## Information Loss
<Low/Medium/High only when compression risk exists>
## Compression Notes
<meaningful removals, merges, or heading changes>
## Satisfaction Check
- [ ] Preserves the important facts.
- [ ] Removes duplicated/noisy content.
- [ ] Is easier to scan.
- [ ] Does not invent conclusions.
- [ ] Fully replaces credential material and redacts sensitive identifiers before rendering.
Are you satisfied with this refined version?
If the user is not satisfied, ask one correction question at a time:
[Direct question]
Recommendation: [short suggested answer when useful]
Ask the question in normal chat, use Recommendation: ... only when useful, and do not add question headings, numbering, rationale blocks, or interview-length estimates. Use the question tool only for a closed confirmation or enumerated choice.
After resolving feedback, generate a new complete version, not a patch.
Mini Example
Input headings Error Details and More Error Details that repeat the same failing test should become one ### Test Failure section, with the duplicate merge noted in Compression Notes.
1---2name: cognitive-output-refiner3description: Trigger: refine output, summarize output, compact logs, reduce cognitive load, remove duplicates. Refines heavy textual output into a concise, faithful, non-duplicative version.4license: MIT5---67# Cognitive Output Refiner89## Activation Contract1011Use only when the user explicitly asks in English to refine, summarize, compact, deduplicate, or reduce the cognitive load of textual output such as Markdown, console output, logs, test results, or agent responses.1213Do not activate automatically just because output is long. If the input is already concise, say no refinement is needed and offer at most a micro-improvement.1415## Hard Rules1617- Preserve the input language. Do not translate unless asked.18- Redaction takes precedence over all exact-preservation requirements, including this output template. Never include credential material, including secrets, credentials, inline credentials, connection strings, URL-embedded credentials, API keys, access tokens, cookies, passwords, private keys, session identifiers, or authorization headers, in whole or in part; replace the full credential value with a placeholder such as `[REDACTED_TOKEN]`.19- Preserve useful diagnostic detail from errors, relevant stack frames, commands, paths, public/non-sensitive IDs, decisions, trade-offs, critical warnings, verification steps, and actionable next steps. When preserving stack frames, commands, or paths, redact usernames, local/private path prefixes, internal hostnames, credentials, and other sensitive identifiers while keeping non-sensitive filenames, function names, line numbers, error codes, and public IDs.20- When an ID's sensitivity is ambiguous, redact it. Preserve only clearly public identifiers.21- Be faithful by default. Label inferences as `Inference`, `Likely cause`, or `Possible next step`; never present them as input facts.22- Deduplicate by keeping one canonical version. Preserve meaningful differences explicitly.23- Target 30–50% of the original size by default; use 10–20% only for explicit ultra-compact requests. Fidelity beats size.24- Never overwrite source content. Produce a separate response or file.2526## Decision Gates2728| Input | Strategy |29|---|---|30| Markdown/docs | Preserve useful hierarchy, improve headings, merge duplicated sections. |31| Console/logs/tests | Group by signal: result, errors, warnings, files, commands, next steps. Preserve order only when causal. |32| Agent/LLM output | Remove repetition, separate decisions from explanations, cut unnecessary narrative. |3334Create a file only when the user asks to save/create a document or provides a file as input. Save in the current working directory unless a path is provided. Infer the topic when possible; ask only if unclear. Use `{topic_snake_case}_v<semver>.md`; do not save the original. Start at `v1.0.0` when no prior refined version exists.3536SemVer: patch for clarity/order/deduplication, minor for added information or structure changes, major for changed interpretation.3738## Output Contract3940Return this shape, omitting optional sections when empty. Optional sections are `Preserved Details`, `Information Loss`, and `Compression Notes`. Evaluate each Satisfaction Check item honestly before rendering; if any item fails, fix the output before asking the user.4142```md43## TL;DR44- <2-4 bullets with the essential signal>4546## Refined Output47<clean, grouped, non-duplicative output>4849## Preserved Details50<errors, redacted commands/paths, public/non-sensitive IDs, decisions, redacted placeholders, or other must-preserve facts; never include credential material or ambiguous sensitive identifiers>5152## Information Loss53<Low/Medium/High only when compression risk exists>5455## Compression Notes56<meaningful removals, merges, or heading changes>5758## Satisfaction Check59- [ ] Preserves the important facts.60- [ ] Removes duplicated/noisy content.61- [ ] Is easier to scan.62- [ ] Does not invent conclusions.63- [ ] Fully replaces credential material and redacts sensitive identifiers before rendering.6465Are you satisfied with this refined version?66```6768If the user is not satisfied, ask one correction question at a time:6970```md71[Direct question]7273Recommendation: [short suggested answer when useful]74```7576Ask the question in normal chat, use `Recommendation: ...` only when useful, and do not add question headings, numbering, rationale blocks, or interview-length estimates. Use the `question` tool only for a closed confirmation or enumerated choice.7778After resolving feedback, generate a new complete version, not a patch.7980## Mini Example8182Input headings `Error Details` and `More Error Details` that repeat the same failing test should become one `### Test Failure` section, with the duplicate merge noted in `Compression Notes`.