opencode-skills-collection 3.0.43 → 3.0.45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundled-skills/.antigravity-install-manifest.json +15 -1
- package/bundled-skills/agent-squad/SKILL.md +190 -0
- package/bundled-skills/agent-squad/alex/SKILL.md +129 -0
- package/bundled-skills/agent-squad/aria/SKILL.md +140 -0
- package/bundled-skills/agent-squad/dep/SKILL.md +146 -0
- package/bundled-skills/agent-squad/luna/SKILL.md +139 -0
- package/bundled-skills/agent-squad/mason/SKILL.md +124 -0
- package/bundled-skills/agent-squad/max/SKILL.md +118 -0
- package/bundled-skills/agent-squad/quinn/SKILL.md +143 -0
- package/bundled-skills/agent-squad/rex/SKILL.md +121 -0
- package/bundled-skills/atlas-contract/SKILL.md +650 -0
- package/bundled-skills/atlas-ledger/SKILL.md +248 -0
- package/bundled-skills/docs/integrations/jetski-cortex.md +3 -3
- package/bundled-skills/docs/integrations/jetski-gemini-loader/README.md +1 -1
- package/bundled-skills/docs/maintainers/repo-growth-seo.md +3 -3
- package/bundled-skills/docs/maintainers/skills-update-guide.md +1 -1
- package/bundled-skills/docs/users/bundles.md +1 -1
- package/bundled-skills/docs/users/claude-code-skills.md +1 -1
- package/bundled-skills/docs/users/gemini-cli-skills.md +1 -1
- package/bundled-skills/docs/users/getting-started.md +1 -1
- package/bundled-skills/docs/users/kiro-integration.md +1 -1
- package/bundled-skills/docs/users/usage.md +4 -4
- package/bundled-skills/docs/users/visual-guide.md +4 -4
- package/bundled-skills/fsi-compliance-checker/SKILL.md +125 -0
- package/bundled-skills/fsi-compliance-checker/mas-trm.md +99 -0
- package/bundled-skills/fsi-compliance-checker/pci-dss.md +89 -0
- package/bundled-skills/not-a-vibe-coder/SKILL.md +147 -0
- package/bundled-skills/papers-skill/SKILL.md +194 -0
- package/bundled-skills/papers-skill/scripts/papers.py +271 -0
- package/bundled-skills/polis-protocol/SKILL.md +13 -9
- package/bundled-skills/zipai-optimizer/SKILL.md +40 -68
- package/package.json +1 -1
- package/skills_index.json +309 -1
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
papers.py — Standalone academic paper toolkit (Skill-mode port of papers-mcp).
|
|
4
|
+
Original MCP project: https://github.com/xwmxcz/papers-mcp
|
|
5
|
+
|
|
6
|
+
Usage:
|
|
7
|
+
python papers.py search <query> [--limit 10]
|
|
8
|
+
python papers.py detail <paper_id>
|
|
9
|
+
python papers.py citations <paper_id> [--limit 10]
|
|
10
|
+
python papers.py arxiv <query> [--max-results 5]
|
|
11
|
+
python papers.py download <arxiv_id> [--save-dir .]
|
|
12
|
+
python papers.py read <pdf_path> [--max-pages 10]
|
|
13
|
+
|
|
14
|
+
Dependencies: httpx, arxiv, PyMuPDF
|
|
15
|
+
"""
|
|
16
|
+
from __future__ import annotations
|
|
17
|
+
|
|
18
|
+
import argparse
|
|
19
|
+
import sys
|
|
20
|
+
import time
|
|
21
|
+
from pathlib import Path
|
|
22
|
+
|
|
23
|
+
# Force UTF-8 stdout on Windows so Chinese strings render correctly when
|
|
24
|
+
# called via Bash / cmd / cron (Python 3.7+).
|
|
25
|
+
if hasattr(sys.stdout, "reconfigure"):
|
|
26
|
+
sys.stdout.reconfigure(encoding="utf-8")
|
|
27
|
+
sys.stderr.reconfigure(encoding="utf-8")
|
|
28
|
+
|
|
29
|
+
import httpx
|
|
30
|
+
|
|
31
|
+
S2_BASE = "https://api.semanticscholar.org/graph/v1"
|
|
32
|
+
S2_FIELDS = "paperId,title,abstract,year,citationCount,authors,externalIds,url"
|
|
33
|
+
S2_RETRIES = 3
|
|
34
|
+
S2_WAIT = 2 # seconds, exponential backoff base
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
# ---------- HTTP helpers ----------
|
|
38
|
+
|
|
39
|
+
def _s2_get(url: str, params: dict) -> dict:
|
|
40
|
+
"""GET with rate-limit retry. Returns parsed JSON or {'error': ...}."""
|
|
41
|
+
for attempt in range(S2_RETRIES):
|
|
42
|
+
try:
|
|
43
|
+
r = httpx.get(
|
|
44
|
+
url,
|
|
45
|
+
params=params,
|
|
46
|
+
timeout=30.0,
|
|
47
|
+
headers={"User-Agent": "papers-skill/1.0"},
|
|
48
|
+
)
|
|
49
|
+
if r.status_code == 429:
|
|
50
|
+
time.sleep(S2_WAIT * (attempt + 1))
|
|
51
|
+
continue
|
|
52
|
+
r.raise_for_status()
|
|
53
|
+
return r.json()
|
|
54
|
+
except httpx.HTTPError as e:
|
|
55
|
+
if attempt == S2_RETRIES - 1:
|
|
56
|
+
return {"error": f"HTTP error: {e}"}
|
|
57
|
+
time.sleep(S2_WAIT * (attempt + 1))
|
|
58
|
+
return {"error": "rate limit, retries exhausted"}
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def _fmt_authors(authors: list, n: int = 3) -> str:
|
|
62
|
+
if not authors:
|
|
63
|
+
return "(unknown)"
|
|
64
|
+
names = [a.get("name", "?") for a in authors[:n]]
|
|
65
|
+
suffix = " et al." if len(authors) > n else ""
|
|
66
|
+
return ", ".join(names) + suffix
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
# ---------- Commands ----------
|
|
70
|
+
|
|
71
|
+
def cmd_search(args) -> str:
|
|
72
|
+
data = _s2_get(
|
|
73
|
+
f"{S2_BASE}/paper/search",
|
|
74
|
+
{"query": args.query, "limit": min(args.limit, 20), "fields": S2_FIELDS},
|
|
75
|
+
)
|
|
76
|
+
if "error" in data:
|
|
77
|
+
return f"搜索失败: {data['error']}"
|
|
78
|
+
papers = data.get("data", [])
|
|
79
|
+
if not papers:
|
|
80
|
+
return f"没有找到与 '{args.query}' 相关的论文"
|
|
81
|
+
out = [f"# 搜索结果 ({len(papers)} 篇)\n"]
|
|
82
|
+
for i, p in enumerate(papers, 1):
|
|
83
|
+
title = p.get("title", "无标题")
|
|
84
|
+
year = p.get("year", "?")
|
|
85
|
+
citations = p.get("citationCount", 0)
|
|
86
|
+
authors = _fmt_authors(p.get("authors", []))
|
|
87
|
+
abstract = (p.get("abstract") or "").strip()[:200]
|
|
88
|
+
ext = p.get("externalIds") or {}
|
|
89
|
+
arxiv_id = ext.get("ArXiv", "")
|
|
90
|
+
out.append(
|
|
91
|
+
f"## {i}. {title}\n"
|
|
92
|
+
f"**Authors:** {authors} \n"
|
|
93
|
+
f"**Year:** {year} | **Citations:** {citations} \n"
|
|
94
|
+
f"**S2 ID:** `{p.get('paperId')}`"
|
|
95
|
+
+ (f" | **arXiv:** `{arxiv_id}`" if arxiv_id else "")
|
|
96
|
+
+ " \n"
|
|
97
|
+
f"**Abstract:** {abstract}{'...' if abstract else '(无摘要)'}\n"
|
|
98
|
+
)
|
|
99
|
+
return "\n".join(out)
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
def cmd_detail(args) -> str:
|
|
103
|
+
pid = args.paper_id
|
|
104
|
+
# Auto-detect ID type
|
|
105
|
+
if pid.startswith(("10.", "ARXIV:", "DOI:", "MAG:", "PMID:", "PMCID:")):
|
|
106
|
+
lookup = pid
|
|
107
|
+
elif pid.isdigit() and len(pid) >= 10:
|
|
108
|
+
lookup = f"ARXIV:{pid}"
|
|
109
|
+
else:
|
|
110
|
+
lookup = pid # assume raw S2 paperId
|
|
111
|
+
fields = S2_FIELDS + ",references.title,references.year,tldr"
|
|
112
|
+
data = _s2_get(f"{S2_BASE}/paper/{lookup}", {"fields": fields})
|
|
113
|
+
if "error" in data:
|
|
114
|
+
return f"查询失败: {data['error']}"
|
|
115
|
+
title = data.get("title", "无标题")
|
|
116
|
+
authors = _fmt_authors(data.get("authors", []), n=5)
|
|
117
|
+
year = data.get("year", "?")
|
|
118
|
+
citations = data.get("citationCount", 0)
|
|
119
|
+
abstract = data.get("abstract") or "(无摘要)"
|
|
120
|
+
tldr = (data.get("tldr") or {}).get("text") or "(无 TL;DR)"
|
|
121
|
+
refs = (data.get("references") or [])[:10]
|
|
122
|
+
out = [
|
|
123
|
+
f"# {title}",
|
|
124
|
+
f"**Authors:** {authors} ",
|
|
125
|
+
f"**Year:** {year} | **Citations:** {citations} ",
|
|
126
|
+
f"**ID:** `{data.get('paperId')}` ",
|
|
127
|
+
f"**URL:** {data.get('url', '')}",
|
|
128
|
+
"",
|
|
129
|
+
"## TL;DR",
|
|
130
|
+
tldr,
|
|
131
|
+
"",
|
|
132
|
+
"## Abstract",
|
|
133
|
+
abstract,
|
|
134
|
+
"",
|
|
135
|
+
f"## Top {len(refs)} References",
|
|
136
|
+
]
|
|
137
|
+
for i, r in enumerate(refs, 1):
|
|
138
|
+
out.append(f"{i}. {r.get('title', '?')} ({r.get('year', '?')})")
|
|
139
|
+
return "\n".join(out)
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
def cmd_citations(args) -> str:
|
|
143
|
+
data = _s2_get(
|
|
144
|
+
f"{S2_BASE}/paper/{args.paper_id}/citations",
|
|
145
|
+
{
|
|
146
|
+
"limit": min(args.limit, 20),
|
|
147
|
+
"fields": "title,year,authors",
|
|
148
|
+
},
|
|
149
|
+
)
|
|
150
|
+
if "error" in data:
|
|
151
|
+
return f"查询失败: {data['error']}"
|
|
152
|
+
cites = data.get("data", [])
|
|
153
|
+
if not cites:
|
|
154
|
+
return "没有找到引用此论文的记录"
|
|
155
|
+
out = [f"# 引用此论文的论文 ({len(cites)} 篇)\n"]
|
|
156
|
+
for i, item in enumerate(cites, 1):
|
|
157
|
+
p = item.get("citingPaper", {})
|
|
158
|
+
title = p.get("title", "?")
|
|
159
|
+
year = p.get("year", "?")
|
|
160
|
+
authors = _fmt_authors(p.get("authors", []), n=2)
|
|
161
|
+
out.append(f"{i}. **{title}** ({year}) — {authors}")
|
|
162
|
+
return "\n".join(out)
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
def cmd_arxiv(args) -> str:
|
|
166
|
+
try:
|
|
167
|
+
import arxiv
|
|
168
|
+
except ImportError:
|
|
169
|
+
return "需要安装 arxiv: pip install arxiv"
|
|
170
|
+
search = arxiv.Search(
|
|
171
|
+
query=args.query,
|
|
172
|
+
max_results=min(args.max_results, 10),
|
|
173
|
+
sort_by=arxiv.SortCriterion.Relevance,
|
|
174
|
+
)
|
|
175
|
+
results = list(arxiv.Client().results(search))
|
|
176
|
+
if not results:
|
|
177
|
+
return f"没有找到与 '{args.query}' 相关的 arXiv 论文"
|
|
178
|
+
out = [f"# arXiv 搜索结果 ({len(results)} 篇)\n"]
|
|
179
|
+
for i, p in enumerate(results, 1):
|
|
180
|
+
arxiv_id = p.entry_id.rsplit("/", 1)[-1]
|
|
181
|
+
out.append(
|
|
182
|
+
f"## {i}. {p.title}\n"
|
|
183
|
+
f"**Authors:** {', '.join(a.name for a in p.authors[:3])} \n"
|
|
184
|
+
f"**arXiv ID:** `{arxiv_id}` \n"
|
|
185
|
+
f"**Published:** {p.published.strftime('%Y-%m-%d')} \n"
|
|
186
|
+
f"**Summary:** {p.summary[:200].strip()}...\n"
|
|
187
|
+
)
|
|
188
|
+
return "\n".join(out)
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
def cmd_download(args) -> str:
|
|
192
|
+
try:
|
|
193
|
+
import arxiv
|
|
194
|
+
except ImportError:
|
|
195
|
+
return "需要安装 arxiv: pip install arxiv"
|
|
196
|
+
save_dir = Path(args.save_dir).resolve()
|
|
197
|
+
save_dir.mkdir(parents=True, exist_ok=True)
|
|
198
|
+
search = arxiv.Search(id_list=[args.arxiv_id])
|
|
199
|
+
paper = next(arxiv.Client().results(search), None)
|
|
200
|
+
if paper is None:
|
|
201
|
+
return f"找不到 arXiv ID: {args.arxiv_id}"
|
|
202
|
+
path = paper.download_pdf(dirpath=str(save_dir))
|
|
203
|
+
return f"已下载: {path}"
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
def cmd_read(args) -> str:
|
|
207
|
+
try:
|
|
208
|
+
import fitz # PyMuPDF
|
|
209
|
+
except ImportError:
|
|
210
|
+
return "需要安装 PyMuPDF: pip install PyMuPDF"
|
|
211
|
+
pdf = Path(args.pdf_path)
|
|
212
|
+
if not pdf.exists():
|
|
213
|
+
return f"PDF 不存在: {pdf}"
|
|
214
|
+
doc = fitz.open(str(pdf))
|
|
215
|
+
pages = min(args.max_pages, doc.page_count)
|
|
216
|
+
chunks = []
|
|
217
|
+
for i in range(pages):
|
|
218
|
+
text = doc.load_page(i).get_text().strip()
|
|
219
|
+
if text:
|
|
220
|
+
chunks.append(f"--- Page {i + 1} ---\n{text}")
|
|
221
|
+
doc.close()
|
|
222
|
+
if not chunks:
|
|
223
|
+
return "PDF无法提取文本(可能是扫描件)"
|
|
224
|
+
return "\n\n".join(chunks)
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
# ---------- CLI ----------
|
|
228
|
+
|
|
229
|
+
def main():
|
|
230
|
+
parser = argparse.ArgumentParser(prog="papers", description=__doc__)
|
|
231
|
+
sub = parser.add_subparsers(dest="cmd", required=True)
|
|
232
|
+
|
|
233
|
+
p = sub.add_parser("search", help="Semantic Scholar 搜索")
|
|
234
|
+
p.add_argument("query")
|
|
235
|
+
p.add_argument("--limit", type=int, default=10)
|
|
236
|
+
p.set_defaults(fn=cmd_search)
|
|
237
|
+
|
|
238
|
+
p = sub.add_parser("detail", help="论文详情 (支持 DOI / ARXIV:id / S2 paperId)")
|
|
239
|
+
p.add_argument("paper_id")
|
|
240
|
+
p.set_defaults(fn=cmd_detail)
|
|
241
|
+
|
|
242
|
+
p = sub.add_parser("citations", help="该论文的引用列表")
|
|
243
|
+
p.add_argument("paper_id")
|
|
244
|
+
p.add_argument("--limit", type=int, default=10)
|
|
245
|
+
p.set_defaults(fn=cmd_citations)
|
|
246
|
+
|
|
247
|
+
p = sub.add_parser("arxiv", help="arXiv 搜索")
|
|
248
|
+
p.add_argument("query")
|
|
249
|
+
p.add_argument("--max-results", type=int, default=5)
|
|
250
|
+
p.set_defaults(fn=cmd_arxiv)
|
|
251
|
+
|
|
252
|
+
p = sub.add_parser("download", help="下载 arXiv PDF")
|
|
253
|
+
p.add_argument("arxiv_id")
|
|
254
|
+
p.add_argument("--save-dir", default=".")
|
|
255
|
+
p.set_defaults(fn=cmd_download)
|
|
256
|
+
|
|
257
|
+
p = sub.add_parser("read", help="提取 PDF 文本 (PyMuPDF)")
|
|
258
|
+
p.add_argument("pdf_path")
|
|
259
|
+
p.add_argument("--max-pages", type=int, default=10)
|
|
260
|
+
p.set_defaults(fn=cmd_read)
|
|
261
|
+
|
|
262
|
+
args = parser.parse_args()
|
|
263
|
+
try:
|
|
264
|
+
print(args.fn(args))
|
|
265
|
+
except Exception as e:
|
|
266
|
+
print(f"错误: {type(e).__name__}: {e}", file=sys.stderr)
|
|
267
|
+
sys.exit(1)
|
|
268
|
+
|
|
269
|
+
|
|
270
|
+
if __name__ == "__main__":
|
|
271
|
+
main()
|
|
@@ -37,19 +37,18 @@ In Antigravity specifically, this turns Manager View's fixed pipeline into a tea
|
|
|
37
37
|
|
|
38
38
|
### Step 1: Found a polis
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
Run the published CLI — `uvx` fetches the latest release from PyPI ([polis-protocol](https://pypi.org/project/polis-protocol/)), so you always get the current version:
|
|
41
41
|
|
|
42
42
|
```bash
|
|
43
|
-
|
|
44
|
-
cd polis-protocol
|
|
45
|
-
git checkout <reviewed-commit-sha>
|
|
46
|
-
python3 scripts/init_polis.py \
|
|
43
|
+
uvx polis-protocol init \
|
|
47
44
|
--project-root . \
|
|
48
45
|
--agent-id gemini-antigravity-yourproject \
|
|
49
46
|
--vendor google --model gemini-3 --tool antigravity
|
|
50
47
|
```
|
|
51
48
|
|
|
52
|
-
|
|
49
|
+
(Prefer a pinned, reviewed install? `pipx install polis-protocol==<version>`, or clone the repo and run `python3 scripts/init_polis.py` with the same flags.)
|
|
50
|
+
|
|
51
|
+
This writes `_polis/` plus the skill into `.agents/skills/` (the path Antigravity reads), and bridge pointers (`GEMINI.md`, `AGENTS.md`) that point every tool at `_polis/CONSTITUTION.md`. Tip: add `--dry-run` to preview every file before anything is written; init never overwrites existing files, and `polis init --repair` restores missing ones.
|
|
53
52
|
|
|
54
53
|
### Step 2: Register citizens and open contracts
|
|
55
54
|
|
|
@@ -58,15 +57,20 @@ Each agent publishes a capability card under `_polis/citizens/`. Work is opened
|
|
|
58
57
|
### Step 3: Route by track record
|
|
59
58
|
|
|
60
59
|
```bash
|
|
61
|
-
|
|
60
|
+
polis route --polis-root _polis \
|
|
62
61
|
--contract _polis/contracts/open/your-task.md --explain
|
|
63
62
|
```
|
|
64
63
|
|
|
65
|
-
The router prints a score breakdown (history / self-rating / cost / availability) and recommends the citizen with the strongest record on the task's tags.
|
|
64
|
+
The router prints a score breakdown (history / self-rating / cost / availability / applied lessons) and recommends the citizen with the strongest record on the task's tags. Agents can also reserve files (`polis reserve src/auth --as <citizen>`) so two agents never edit the same path at once — overlapping claims are rejected with the holder named.
|
|
66
65
|
|
|
67
66
|
### Step 4: Settle, learn, and amend
|
|
68
67
|
|
|
69
|
-
|
|
68
|
+
```bash
|
|
69
|
+
polis contract settle <contract-id> --quality 5
|
|
70
|
+
polis reconcile --polis-root _polis
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
A settled contract files a lesson; accepted lessons carry a bounded `routing_effect` the router reads — and names in `--explain` — on the next similar task. Failures become guardrails (`polis guardrail add …`) that future contracts on those tags inherit as must-pass acceptance criteria. When a rule stops working, a citizen proposes an amendment and the others vote. Reproduce the learning claim yourself: `polis bench --mode learning`.
|
|
70
74
|
|
|
71
75
|
## Examples
|
|
72
76
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
---
|
|
2
2
|
id: zipai-optimizer
|
|
3
3
|
name: zipai-optimizer
|
|
4
|
-
version: "
|
|
5
|
-
description: "
|
|
4
|
+
version: "14.0"
|
|
5
|
+
description: "Ultra-dense token optimizer skill for prompt caching, log pruning, AST-based inspection, and minified JSON payloads."
|
|
6
6
|
category: agent-behavior
|
|
7
7
|
risk: safe
|
|
8
8
|
source: community
|
|
@@ -12,78 +12,52 @@ source: community
|
|
|
12
12
|
|
|
13
13
|
## When to Use
|
|
14
14
|
|
|
15
|
-
Use this skill when the request needs context-window-aware triage, concise technical output, ambiguity handling, or selective reading of logs, source files, JSON/YAML payloads, VCS output, or MCP tool results.
|
|
15
|
+
Use this skill when the request needs context-window-aware triage, prompt caching optimizations, concise technical output, ambiguity handling, or selective reading of logs, source files, JSON/YAML payloads, VCS output, or MCP tool results.
|
|
16
16
|
|
|
17
17
|
## Rules
|
|
18
18
|
|
|
19
|
-
### Rule 1 — Adaptive Verbosity
|
|
20
|
-
|
|
21
|
-
- **
|
|
22
|
-
- **
|
|
23
|
-
- **
|
|
24
|
-
- **
|
|
25
|
-
- **Review mode (code review, PR analysis):** structured output with labeled sections (`[ISSUE]`, `[SUGGESTION]`, `[NITPICK]`) is authorized and preferred.
|
|
19
|
+
### Rule 1 — Adaptive Verbosity (No Filler)
|
|
20
|
+
- **Fixes:** technical only. ZERO filler (e.g., "Certainly", "I understand", "Here is", "Sure").
|
|
21
|
+
- **Analysis:** full reasoning allowed.
|
|
22
|
+
- **Direct Ask:** max 15 words in ultra-dense telegraphic style. Omit grammatical helper constructs.
|
|
23
|
+
- **Long Sessions:** never re-summarize past thread context.
|
|
24
|
+
- **Reviews:** use structured headers: `[ISSUE]`, `[SUGGESTION]`, `[NITPICK]`.
|
|
26
25
|
|
|
27
26
|
### Rule 2 — Ambiguity-First Execution
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
- **
|
|
40
|
-
- **
|
|
41
|
-
- **
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
- **
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
- Single-line fix → `str_replace` only, no reprint.
|
|
57
|
-
- Multi-location changes in one file → batch `str_replace` calls in dependency order within single response.
|
|
58
|
-
- Cross-file refactor → one file per response turn, labeled, in dependency order (leaf dependencies first).
|
|
59
|
-
- Complex structural diffs → unified diff format (`--- a/file / +++ b/file`) when `str_replace` would be ambiguous.
|
|
60
|
-
- Never silently bundle unrelated changes.
|
|
61
|
-
- **Regression guard:** when modifying a function or module, explicitly check and mention if existing tests cover the changed path. If none exist, flag as `[RISK: untested path]`.
|
|
62
|
-
|
|
63
|
-
### Rule 5 — Context Pruning & Response Structure
|
|
64
|
-
|
|
65
|
-
- Never restate the user's input.
|
|
66
|
-
- Lead with conclusion, follow with reasoning (inverted pyramid).
|
|
67
|
-
- Distinguish when relevant: `[FACT]` (verified) vs `[ASSUMPTION]` (inferred) vs `[RISK]` (potential side effect) vs `[DEPRECATED]` (known obsolete pattern).
|
|
68
|
-
- If a response requires more than 3 sections, provide a structured summary at the top.
|
|
69
|
-
- In multi-step tasks, emit a minimal progress anchor after each completed step: `✓ Step N done — <one-line result>`.
|
|
70
|
-
|
|
71
|
-
### Rule 6 — MCP-Aware Tool Usage
|
|
72
|
-
|
|
73
|
-
- **Resolve IDs before acting:** never assume resource IDs (user, repo, issue, PR). Always resolve via lookup first.
|
|
74
|
-
- **Prefer read-before-write:** fetch current state of a resource before any mutating call.
|
|
75
|
-
- **Paginate lazily:** stop pagination as soon as the target entity is found; do not exhaust all pages by default.
|
|
76
|
-
- **Batch when possible:** prefer single multi-file push over sequential single-file commits.
|
|
77
|
-
- **Treat MCP errors as blocking:** surface error detail immediately, do not silently retry more than once.
|
|
78
|
-
- **SHA discipline:** always retrieve current file SHA before `create_or_update_file`. Never hardcode or cache SHAs across sessions.
|
|
27
|
+
- Ask exactly ONE question if 2+ interpretations exist. Never stack questions.
|
|
28
|
+
- Default to minimal intervention for minor changes.
|
|
29
|
+
- Scope ambiguous requests to narrowest boundary.
|
|
30
|
+
|
|
31
|
+
### Rule 3 — Prompt Caching & Prefix Stability
|
|
32
|
+
- **Static-First Ordering:** Structure prompts to place invariant components (system instructions, core rules, static tool schemas) at the top of the prompt.
|
|
33
|
+
- **Isolate Dynamic Context:** Append dynamic and volatile elements (active conversation history, recently read file contents, CLI execution outputs) at the very end of the prompt to protect and reuse the cached prefix.
|
|
34
|
+
- **Prefix Integrity:** Avoid interleaving new queries or dynamic variables inside static system blocks. Keep the static instructions strictly invariant.
|
|
35
|
+
- **Cached Files Reuse:** Reuse already loaded file contents present in the conversation history; do not re-read files unless explicitly updated.
|
|
36
|
+
|
|
37
|
+
### Rule 4 — Semantic Input Pruning & Log Compression
|
|
38
|
+
- **Traceback Extraction:** When handling error or build outputs, parse and filter logs using grep/regex to extract only tracebacks, error statements, and a maximum of 3-5 lines of context around them. Strip all info logs, successful build tasks, and redundant progress messages.
|
|
39
|
+
- **Skeletal Code Viewing (AST):** For large files (>300 lines), do not view the full file. Use `grep -nE "^(class|def|async def|function|const|let|var).*="` (or language equivalents) to view class and function headers first, then target specific ranges with `view_file`.
|
|
40
|
+
- **Smart JSON/YAML Crusher:** Minify structured inputs. Strip pretty-printing whitespaces, comments, and unused fields from JSON/YAML payloads before placing them in context. Convert large arrays to dense CSV or key-value listings if they are queried.
|
|
41
|
+
|
|
42
|
+
### Rule 5 — Surgical & Compact Output
|
|
43
|
+
- **Local Replacements:** Perform edits using surgical tools (`str_replace` or single-hunk diffs). Never reprint unchanged surrounding code or perform full-file reprints.
|
|
44
|
+
- **Batch Modifies:** Consolidate multiple non-contiguous edits in a single file into a single multi-replace chunk operation, ordered from leaf dependencies upward.
|
|
45
|
+
- **Differential Output:** Limit conversational responses to the exact modified blocks, avoiding conversational code repetition.
|
|
46
|
+
|
|
47
|
+
### Rule 6 — Telegraphic Grammar & Density
|
|
48
|
+
- **Syntax Compression:** Strip articles ("a", "an", "the"), redundant helper verbs ("to be", "to have", "do"), and politeness/softening modifiers ("please", "simply", "just", "easy").
|
|
49
|
+
- **Structure:** Format output blocks into dense semantic mappings (`key: val`), short bullet lists, and compact tables. Avoid paragraphs of text.
|
|
50
|
+
|
|
51
|
+
### Rule 7 — Token-Budget Reasoning (CoT Optimization)
|
|
52
|
+
- **Direct Mode:** Skip long planning/thinking cycles for trivial, deterministic edits (typos, formatting, import adjustments).
|
|
53
|
+
- **Abbreviated Thoughts:** Keep thought blocks compact. Never reprint code snippets or copy-paste file blocks inside thoughts. Reference files via path and lines (e.g. `file.py#L12-18`).
|
|
79
54
|
|
|
80
55
|
---
|
|
81
56
|
|
|
82
57
|
## Negative Constraints
|
|
83
|
-
|
|
84
58
|
- No filler: "Here is", "I understand", "Let me", "Great question", "Certainly", "Of course", "Happy to help".
|
|
85
59
|
- No blind truncation of stacktraces or error logs.
|
|
86
|
-
- No full-file reads
|
|
60
|
+
- No full-file reads on large files.
|
|
87
61
|
- No re-reading files already in context.
|
|
88
62
|
- No multi-question clarification dumps.
|
|
89
63
|
- No silent bundling of unrelated changes.
|
|
@@ -96,8 +70,6 @@ Classify before ingesting — never read raw:
|
|
|
96
70
|
---
|
|
97
71
|
|
|
98
72
|
## Limitations
|
|
99
|
-
|
|
100
|
-
- **
|
|
101
|
-
- **
|
|
102
|
-
- **Context Overshadowing:** In extremely long sessions, aggressive anchor summarization might cause the agent to lose track of microscopic variable states dropped during context pruning.
|
|
103
|
-
- **MCP Pagination Truncation:** Lazy pagination stops early on first match — may miss duplicate entity names in large datasets. Override by specifying `paginate:full` explicitly in the request.
|
|
73
|
+
- **Brainstorming:** disable during creative/open-ended design phases.
|
|
74
|
+
- **Grep Blindness:** key context may fall outside filter boundaries.
|
|
75
|
+
- **Overshadowing:** aggressive pruning may drop micro-variables in long sessions.
|
package/package.json
CHANGED