Context Compressor by toonight/get-shit-done-for-antigravity
npx skills add https://github.com/toonight/get-shit-done-for-antigravity --skill 'Context Compressor'核心原则: 积极压缩,仅在需要时解压。
适用场景: 你已完全理解某个文件,后续可能需要参考它。
方法:
## 文件摘要:src/auth/login.ts
**用途:** 通过邮箱/密码处理用户登录
**关键函数:**
- handleLogin(req, res) → 验证凭证,返回 JWT
- validateCredentials(email, password) → 根据数据库检查
**依赖项:** bcrypt, jose, database
**节省的令牌数:** ~400 (95 行无需重新加载)
替代方案: 重新阅读完整文件
适用场景: 你需要了解文件结构,但不需要实现细节。
方法:
## 大纲:src/services/payment.ts (127 行)
- L1-15: 导入和类型
- L17-35: PaymentService 类
- L20: constructor(config)
- L25: processPayment(amount, method)
- L45: refund(transactionId)
- L67: getHistory(userId)
- L90-127: 辅助函数
令牌数: ~50 vs 完整文件的 ~500
适用场景: 你已经看过一个文件,需要了解其变更。
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
方法:
## 变更内容:src/config.ts
新增:
- L45: TOKEN_BUDGET_THRESHOLD = 0.5
- L46: COMPRESSION_ENABLED = true
修改:
- L12: MAX_CONTEXT → 从 100000 增加到 150000
用于: 审查修改、理解更新
适用场景: 你需要跟踪一个文件而不加载它。
方法:
## 引用
| 文件 | 上次查看 | 摘要 | 加载条件 |
|------|-----------|---------|---------|
| auth.ts | 任务 2 | 登录处理 | 认证错误 |
| db.ts | 任务 1 | Postgres 客户端 | 数据库错误 |
| utils.ts | 从未 | 工具函数 | 需要辅助时 |
成本: ~10 令牌 vs 每个文件 ~200+ 令牌
适用场景: 不确定需要多少细节。
流程:
L1: 大纲 → "我看到 L25 处的 handleLogin"
L2: 函数 → "handleLogin 验证后调用 createToken"
L3: 相关代码 → "createToken 使用 jose.sign 和 HS256"
L4: 完整文件 → 仅用于复杂调试
| 触发器 | 操作 |
|---|---|
| 理解文件后 | 创建摘要 |
| 切换任务时 | 压缩先前上下文 |
| 预算达到 50% | 积极大纲模式 |
| 预算达到 70% | 仅摘要模式 |
| 阶段结束时 | 完全压缩过程 |
当你需要从压缩上下文中获取细节时:
## 解压日志
| 文件 | 原因 | 级别 | 令牌数 |
|------|--------|-------|--------|
| auth.ts | 调试登录 | L2 (函数) | +150 |
| db.ts | 检查查询 | L3 (片段) | +50 |
## 📦 [文件名]
**用途:** [一行描述]
**关键导出:** [列表]
**依赖项:** [列表]
**模式:** [使用的显著模式]
**注意:** [陷阱或边界情况]
## 📋 [文件名] (N 行)
- L[起始]-[结束]: [部分名称]
- L[n]: [关键项]
- L[n]: [关键项]
## Δ [文件名]
**+** [新增内容]
**-** [移除内容]
**~** [修改内容]
可与以下组件协同工作:
token-budget — 在阈值处触发压缩context-fetch — 为压缩提供输入context-health-monitor — 监控压缩效果❌ 在思维上下文中保留完整文件 — 理解后即压缩 ❌ 重新阅读而非引用 — 使用摘要 ❌ 为一个函数加载完整文件 — 使用大纲 + 目标定位 ❌ 为"节省时间"而跳过压缩 — 后期成本更高
属于 GSD v1.6 令牌优化的一部分。示例请参阅 docs/token-optimization-guide.md。
每周安装数
–
代码仓库
GitHub 星标数
664
首次出现
–
安全审计
Core principle: Compress aggressively, decompress only when needed.
When: You've fully understood a file and may need to reference it later.
How:
## File Summary: src/auth/login.ts
**Purpose:** Handles user login via email/password
**Key functions:**
- handleLogin(req, res) → Validates credentials, returns JWT
- validateCredentials(email, password) → Checks against DB
**Dependencies:** bcrypt, jose, database
**Tokens saved:** ~400 (95 lines not reloaded)
Use instead of: Re-reading the full file
When: You need to understand a file's structure but not implementation details.
How:
## Outline: src/services/payment.ts (127 lines)
- L1-15: Imports and types
- L17-35: PaymentService class
- L20: constructor(config)
- L25: processPayment(amount, method)
- L45: refund(transactionId)
- L67: getHistory(userId)
- L90-127: Helper functions
Tokens: ~50 vs ~500 for full file
When: You've already seen a file and need to understand changes.
How:
## Changes to: src/config.ts
Added:
- L45: TOKEN_BUDGET_THRESHOLD = 0.5
- L46: COMPRESSION_ENABLED = true
Modified:
- L12: MAX_CONTEXT → increased from 100000 to 150000
Use for: Reviewing modifications, understanding updates
When: You need to track a file without loading it.
How:
## References
| File | Last Seen | Summary | Load If |
|------|-----------|---------|---------|
| auth.ts | Task 2 | Login handling | Auth bugs |
| db.ts | Task 1 | Postgres client | DB errors |
| utils.ts | Never | Utility funcs | Helper needed |
Cost: ~10 tokens vs ~200+ per file
When: Unsure how much detail is needed.
Process:
L1: Outline → "I see handleLogin at L25"
L2: Function → "handleLogin validates then calls createToken"
L3: Related → "createToken uses jose.sign with HS256"
L4: Full → Only for complex debugging
| Trigger | Action |
|---|---|
| After understanding a file | Create summary |
| Switching tasks | Compress previous context |
| Budget at 50% | Aggressive outline mode |
| Budget at 70% | Summary-only mode |
| End of wave | Full compression pass |
When you need details from compressed context:
## Decompression Log
| File | Reason | Level | Tokens |
|------|--------|-------|--------|
| auth.ts | Debug login | L2 (func) | +150 |
| db.ts | Check query | L3 (snippet) | +50 |
## 📦 [filename]
**Purpose:** [one line]
**Key exports:** [list]
**Dependencies:** [list]
**Patterns:** [notable patterns used]
**Watch for:** [gotchas or edge cases]
## 📋 [filename] (N lines)
- L[start]-[end]: [section name]
- L[n]: [key item]
- L[n]: [key item]
## Δ [filename]
**+** [additions]
**-** [removals]
**~** [modifications]
Works with:
token-budget — Triggers compression at thresholdscontext-fetch — Provides input for compressioncontext-health-monitor — Monitors compression effectiveness❌ Keeping full files in mental context — Compress after understanding ❌ Re-reading instead of referencing — Use summaries ❌ Loading full file for one function — Use outline + target ❌ Skipping compression "to save time" — Costs more later
Part of GSD v1.6 Token Optimization. See docs/token-optimization-guide.md for examples.
Weekly Installs
–
Repository
GitHub Stars
664
First Seen
–
Security Audits
agent-browser 浏览器自动化工具 - Vercel Labs 命令行网页操作与测试
147,400 周安装