Initial release: aircontext
This commit is contained in:
26
templates/README.md
Normal file
26
templates/README.md
Normal file
@@ -0,0 +1,26 @@
|
||||
# AirContext (per-project)
|
||||
|
||||
This directory configures AirContext for **this project**. It was created the
|
||||
first time you ran `aircontext` here.
|
||||
|
||||
## Files
|
||||
|
||||
- `config.yaml` — backend (LLM), trigger threshold, compaction options
|
||||
- `rules.md` — compression rules sent to the LLM as system prompt
|
||||
- `state.json` — runtime state (do not edit; managed by the plugin)
|
||||
- `snapshots/` — backup of each JSONL before compaction; keep or delete freely
|
||||
|
||||
## Getting started
|
||||
|
||||
1. Open `config.yaml`, set `backend.endpoint` / `backend.model` / `backend.api_key`.
|
||||
The default targets DeepSeek; replace with Ollama or any OpenAI-compatible
|
||||
server as needed. For Ollama set `endpoint: http://localhost:11434/v1` and
|
||||
any non-empty `api_key`.
|
||||
2. Tune `trigger.threshold` (default 0.6 = compact at 60% of model context).
|
||||
3. Edit `rules.md` to bias summaries toward what your project considers important.
|
||||
4. Re-run `aircontext` from this directory.
|
||||
|
||||
## Disabling auto compaction temporarily
|
||||
|
||||
Run `/aircontext-pause` inside Claude Code, or set `safety.dry_run: true` in
|
||||
config.yaml.
|
||||
44
templates/config.yaml
Normal file
44
templates/config.yaml
Normal file
@@ -0,0 +1,44 @@
|
||||
# AirContext compaction config.
|
||||
#
|
||||
# YOU MUST FILL these two fields (privacy-sensitive, never auto-populated):
|
||||
# - backend.endpoint your LLM endpoint URL
|
||||
# - backend.api_key either a literal value, or the ${env:VAR} placeholder
|
||||
# pointing at an env var that holds the secret
|
||||
#
|
||||
# Everything else is auto-configured by `aircontext` on first run
|
||||
# (model_context_window inferred from your Claude model setting, etc.) and
|
||||
# you generally don't need to touch it. Edit freely if you want to override.
|
||||
# `${env:VAR}` placeholders are resolved at runtime against environment
|
||||
# variables (including those declared in ~/.claude/settings.json `env` block).
|
||||
|
||||
backend:
|
||||
type: anthropic_native # or openai_compat (auto-set by aircontext when possible)
|
||||
|
||||
# >>> REQUIRED — fill before re-running aircontext <<<
|
||||
endpoint: "" # e.g. https://api.anthropic.com | https://wolfai.top | http://localhost:11434/v1
|
||||
|
||||
# >>> REQUIRED — fill or set the env var <<<
|
||||
api_key: ${env:ANTHROPIC_AUTH_TOKEN} # change to ${env:OPENAI_API_KEY} or paste a literal value
|
||||
|
||||
model: claude-haiku-4-5-20251001 # cheap+fast for compression; raise to claude-sonnet-4-6 if quality insufficient
|
||||
max_output_tokens: 4000
|
||||
timeout_seconds: 60
|
||||
anthropic_version: "2023-06-01" # only used when type = anthropic_native
|
||||
|
||||
trigger:
|
||||
strategy: token_ratio
|
||||
threshold: 0.6 # compact when active chain reaches 60% of model_context_window
|
||||
cooldown_seconds: 300
|
||||
estimate_method: char_div_3_5
|
||||
model_context_window: 200000 # auto-overridden on first aircontext run based on your claude model
|
||||
|
||||
compaction:
|
||||
preserve_tail_messages: 10
|
||||
drop_tool_results_over_lines: 1000
|
||||
rules_file: rules.md
|
||||
continuation_prompt: "基于上面的压缩摘要继续之前的工作;如果没有进行中的任务则等待我的下一条指令。"
|
||||
|
||||
safety:
|
||||
backup: true
|
||||
max_snapshots: 50
|
||||
dry_run: false
|
||||
30
templates/rules.md
Normal file
30
templates/rules.md
Normal file
@@ -0,0 +1,30 @@
|
||||
# AirContext Compression Rules
|
||||
|
||||
This file is fed to the compression LLM as part of its system prompt. Edit
|
||||
freely to bias what the summary keeps versus drops. The defaults below favour
|
||||
software-engineering sessions; rewrite them for your domain.
|
||||
|
||||
## Always preserve verbatim
|
||||
|
||||
- File paths read or modified, with the final intended state of each file
|
||||
- Architecture decisions and the reasoning behind them
|
||||
- Open TODOs, unresolved bugs, error messages still in scope
|
||||
- The user's stated goal for the current session
|
||||
- Any user-supplied facts that the model could not derive from the codebase
|
||||
(credentials hints, deployment quirks, deadlines, "we tried X and it failed because Y")
|
||||
|
||||
## Aggressively drop
|
||||
|
||||
- Exploratory grep/glob results that did not lead anywhere
|
||||
- File contents that were superseded by later edits
|
||||
- Tool outputs over 1000 lines (keep first 50 lines and last 50 lines, summarise the middle)
|
||||
- Repeated similar searches and their near-identical outputs
|
||||
- Completed sub-steps whose only output was "looks good, moving on"
|
||||
|
||||
## Output format
|
||||
|
||||
- Plain prose, no markdown headers or bullet lists unless they materially aid recall
|
||||
- Reference files by `path:line` when relevant
|
||||
- One paragraph per topic; aim for under 3000 tokens total
|
||||
- Do NOT speculate beyond what the conversation contains
|
||||
- Do NOT apologise, summarise the act of summarising, or add meta-commentary
|
||||
Reference in New Issue
Block a user