Skills
Design reliable context with ak:context-engineering
Manage context, task budgets, compaction, and model selection from outcome evidence without reading credentials.
Use ak:context-engineering to finish requested work with less wasted context,
cost, time, and agent steps. Optimize complete outcomes, including failures,
retries, and verification. Never cut required scope or verification to meet an
efficiency target. The Skill does not change model settings, API keys, billing,
or provider quotas.
Choose ak:context-engineering for context problems
Use ak:context-engineering when
- A long session is losing important facts, mixing tasks, or approaching its context limit.
- You need to reduce token use without losing decisions, file history, or next steps.
- You are designing retrieval, memory, tool descriptions, or context isolation for an agent system.
- You want a probe-based way to compare an original context with a compressed summary.
Choose another workflow when
- You need repository facts or file locations. Use
ak:scoutfirst. - You need current external documentation. Use
ak:docs-seeker. - You need implementation rather than a context design. Move to planning or
ak:cookafter the proposal has measurable acceptance criteria. - You only need the runtime's quota display. Read that runtime's own status surface; the Skill never invents usage data and never reads credential files to obtain it.
Prepare the evidence and runtime
Before you start:
- Complete Onboarding, and confirm Engineer Kit is installed for the runtime and scope you use.
- State the failure you observe, the model or runtime limit when known, and the evidence that must survive any compression.
- Identify sensitive messages, tool output, credentials, or customer data that must not be copied into summaries, files, or external services.
- For script-based analysis, prepare UTF-8 JSON containing either a message
array or an object with a
messagesarray.
| Runtime | Invocation | Availability boundary |
|---|---|---|
| Claude Code | /ak:context-engineering ... | Reads usage from /context, /cost, or the statusline percent. AgentKit hooks do not inject usage numbers. |
| Cursor | /ak:context-engineering ... | Uses the user-verified slash spelling; Claude Hook, statusline, and quota behavior are not implied. |
| Codex | $ak:context-engineering ... | Uses native Codex discovery; Claude-specific usage injection is not projected as a general Codex capability. |
See Runtime adapters before treating a runtime-specific usage signal as portable evidence.
Run the Skill
/ak:context-engineering "Our tool outputs dominate a long debugging session. Design a compaction policy that preserves errors, decisions, changed files, and next steps; do not write files."/ak:context-engineering "Our tool outputs dominate a long debugging session. Design a compaction policy that preserves errors, decisions, changed files, and next steps; do not write files."$ak:context-engineering "Our tool outputs dominate a long debugging session. Design a compaction policy that preserves errors, decisions, changed files, and next steps; do not write files."The Skill accepts a topic or question. It has no published mode flag. Ask for a specific output such as a diagnosis, budget, compression policy, model-selection comparison, memory design, tool review, or evaluation plan.
Keep all four core metrics when comparing models or harnesses: average cost per task, average task duration, estimated cost per successful first attempt, and average agent steps. First require sufficient task-specific success. Then compare cost per first-attempt success and duration. Use raw cost for budget planning and steps to diagnose waste. Do not blend correlated metrics into one score. Missing fields stay unknown; there is no hardcoded ranking or automatic model switch.
Optional local analyzers
| Operation | Input | Observable output |
|---|---|---|
| File sizing | Paths to size before a full read | JSON on standard output advising whole-file, range, or search-first reads |
| Context analysis | UTF-8 context JSON, optional token limit | Capacity and lexical diagnostics; no measured health or poisoning score |
| Budget calculation | Window and cumulative task accounting | JSON that separates context occupancy from cumulative task spend |
| Compression evaluation | Original context plus compressed text or explicit grades | Lexical diagnostics or supplied grading; not an automatic quality oracle |
| Benchmark aggregation | Supplied run records | Aggregates cost, duration, and agent steps; does not run models |
These Python utilities read files up to 100 MiB and do not create output files on their own. Shell redirection or a separate write request changes that boundary. The evaluator is heuristic; comments in the source reserve real model-based judging for a production implementation.
Understand what happens during a run
- The Skill identifies the context failure. It separates capacity pressure from distraction, contradiction, poisoning, lost-in-the-middle behavior, or missing persistence.
- It measures before optimizing. Usage numbers come from the runtime display or the local estimate script. Missing percentages are not filled from credentials or provider APIs.
- It selects a bounded strategy. The source organizes choices as write, select, compress, and isolate, then loads only the relevant reference.
- It preserves the task contract. Goals, decisions, constraints, artifact history, current state, and next steps remain explicit.
- It proposes or performs the requested operation. Advice stays in the conversation; analyzers read local files; requested designs or summaries may write to an approved path.
- It checks quality. Probe-based checks test factual recall, artifacts, continuation, and decision rationale instead of trusting token reduction alone.
Keep context and credentials safe
A smaller context can still expose sensitive data
Compression changes size, not sensitivity. Remove or redact secrets and private data before writing a context bundle, sharing it with another agent, or sending it to a model provider.
- Reading local context, summaries, or memory files requires access to those paths; writing or replacing them requires an explicit artifact boundary.
- Usage and context numbers come from the runtime display or the estimate script. The Skill never reads, prints, or transmits credential files, OAuth tokens, or API keys to report usage.
- Context isolation through another agent can multiply model use and cost. Ask before adding paid providers, broad parallelism, or external storage.
- A proposed memory system does not authorize collection, retention, or cross-session storage of personal data.
- Do not discard the original context or overwrite a trusted summary until the compressed result passes the required probes.
Verify the result
A complete guidance run should provide the observed failure, evidence used, selected strategy, preservation contract, expected token or latency effect, and a test that can falsify the proposal. A script run should also report input files, exact operation, exit status, JSON output, and any estimate or heuristic limit.
Treat the result as evidence only when critical facts remain recoverable, artifact history and next steps survive, contradictory or stale material is identified, and the proposed change does not silently expand persistence, provider access, or cost.
Troubleshoot or continue
| Symptom | Safe next step |
|---|---|
| The answer is generic | Supply the observed failure, representative messages, required facts, and a measurable success test. |
| The runtime percentage is missing | Check the runtime's own status surface and installation; do not substitute a guessed context limit. |
| The analyzer rejects the input | Confirm the file exists, is UTF-8 JSON, is at most 100 MiB, and contains a list or messages array. |
| Compression loses file or decision history | Add explicit artifacts, decisions, current state, and next steps, then rerun probes. |
| Results imply production performance | Separate the local heuristic from model-based or load-tested evidence. |
| The runtime does not recognize the Skill | Confirm target and scope, restart the runtime, then follow Runtime cannot find a Skill or Agent. |
Know the current limits
- Token estimates use simple character-based approximations in the bundled scripts; they are not provider billing records or tokenizer-exact counts.
- Attention, degradation, cost, and performance figures in the source material are design guidance, not measurements of your system.
- The Skill does not automatically create a context bundle, memory store, graph, or evaluation dataset.
- External model judging, retrieval services, and persistent stores require separate tools, credentials, privacy review, and cost approval.
Analyze and plan a feature port with ak:xia
Compare or adapt a feature from another repository through source mapping, challenge gates, and a reviewed implementation handoff.
Preserve subfolder conventions with ak:folder-context
Create compact local instructions for a meaningful subfolder while protecting root guidance and user edits.