instar 1.3.436 → 1.3.437

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.
Files changed (40) hide show
  1. package/dist/commands/init.d.ts +17 -0
  2. package/dist/commands/init.d.ts.map +1 -1
  3. package/dist/commands/init.js +50 -0
  4. package/dist/commands/init.js.map +1 -1
  5. package/package.json +2 -1
  6. package/skills/README.md +106 -0
  7. package/skills/agent-identity/SKILL.md +226 -0
  8. package/skills/agent-memory/SKILL.md +261 -0
  9. package/skills/agent-passport/SKILL.md +37 -0
  10. package/skills/agent-readiness/SKILL.md +55 -0
  11. package/skills/command-guard/SKILL.md +239 -0
  12. package/skills/credential-leak-detector/SKILL.md +377 -0
  13. package/skills/instar-dev/SKILL.md +223 -0
  14. package/skills/instar-dev/scripts/verify-proposal-derived-runbook.mjs +319 -0
  15. package/skills/instar-dev/scripts/write-trace.mjs +203 -0
  16. package/skills/instar-dev/templates/eli16-overview.md +43 -0
  17. package/skills/instar-dev/templates/side-effects-artifact.md +133 -0
  18. package/skills/instar-feedback/SKILL.md +285 -0
  19. package/skills/instar-identity/SKILL.md +290 -0
  20. package/skills/instar-scheduler/SKILL.md +259 -0
  21. package/skills/instar-session/SKILL.md +270 -0
  22. package/skills/instar-telegram/SKILL.md +259 -0
  23. package/skills/iterative-converging-audit/SKILL.md +96 -0
  24. package/skills/knowledge-base/SKILL.md +189 -0
  25. package/skills/smart-web-fetch/SKILL.md +241 -0
  26. package/skills/spec-converge/SKILL.md +249 -0
  27. package/skills/spec-converge/scripts/cross-model-review.mjs +155 -0
  28. package/skills/spec-converge/scripts/publish-spec-review.mjs +166 -0
  29. package/skills/spec-converge/scripts/write-convergence-tag.mjs +199 -0
  30. package/skills/spec-converge/templates/report.md +76 -0
  31. package/skills/spec-converge/templates/reviewer-adversarial.md +37 -0
  32. package/skills/spec-converge/templates/reviewer-cross-model.md +28 -0
  33. package/skills/spec-converge/templates/reviewer-integration.md +39 -0
  34. package/skills/spec-converge/templates/reviewer-lessons-aware.md +101 -0
  35. package/skills/spec-converge/templates/reviewer-scalability.md +35 -0
  36. package/skills/spec-converge/templates/reviewer-security.md +36 -0
  37. package/skills/systematic-debugging/SKILL.md +222 -0
  38. package/src/data/builtin-manifest.json +2 -2
  39. package/upgrades/1.3.437.md +29 -0
  40. package/upgrades/side-effects/builtin-skill-install-single-source.md +80 -0
@@ -0,0 +1,189 @@
1
+ ---
2
+ name: knowledge-base
3
+ description: Ingest URLs, documents, and transcripts into a searchable knowledge base. Query past research and curated documentation using full-text search. Trigger words: ingest, knowledge base, look up, search knowledge, what do we know about, research, index this, add to knowledge base.
4
+ license: MIT
5
+ metadata:
6
+ author: sagemindai
7
+ version: "1.0"
8
+ requires: instar
9
+ homepage: https://instar.sh
10
+ user_invocable: "true"
11
+ ---
12
+
13
+ # knowledge-base -- Searchable Knowledge Base for Instar Agents
14
+
15
+ Build a searchable knowledge base from external sources -- URLs, documents, transcripts, PDFs. Uses the existing MemoryIndex (FTS5) for search, so no new dependencies.
16
+
17
+ ---
18
+
19
+ ## How It Works
20
+
21
+ The knowledge base is a set of markdown files in `.instar/knowledge/` that MemoryIndex indexes alongside your other memory files. Each file has YAML frontmatter for metadata and is tracked in a catalog for browsing.
22
+
23
+ ```
24
+ .instar/knowledge/
25
+ catalog.json # Registry of all ingested sources
26
+ articles/ # Ingested web articles
27
+ transcripts/ # Video/audio transcripts
28
+ docs/ # Curated reference documentation
29
+ ```
30
+
31
+ ---
32
+
33
+ ## Ingesting Content
34
+
35
+ ### Via CLI
36
+
37
+ ```bash
38
+ # Ingest text content directly
39
+ instar knowledge ingest "Article content here..." --title "My Article" --tags "AI,agents"
40
+
41
+ # Ingest from a URL (fetch first, then ingest)
42
+ # Step 1: Fetch the content
43
+ python3 .claude/scripts/smart-fetch.py "https://example.com/article" --auto > /tmp/fetched.md
44
+ # Step 2: Ingest it
45
+ instar knowledge ingest "$(cat /tmp/fetched.md)" --title "Article Title" --url "https://example.com/article" --tags "topic1,topic2"
46
+ ```
47
+
48
+ ### Via API
49
+
50
+ ```bash
51
+ curl -X POST http://localhost:${INSTAR_PORT:-4040}/knowledge/ingest \
52
+ -H "Content-Type: application/json" \
53
+ -d '{
54
+ "content": "The article content...",
55
+ "title": "Article Title",
56
+ "url": "https://example.com/article",
57
+ "type": "article",
58
+ "tags": ["AI", "infrastructure"],
59
+ "summary": "Brief description"
60
+ }'
61
+ ```
62
+
63
+ ### Via Agent Workflow
64
+
65
+ When the agent wants to ingest content during a session:
66
+
67
+ 1. Fetch the content (WebFetch, smart-fetch, transcript tools, or Read for local files)
68
+ 2. Clean it (strip navigation, ads, boilerplate)
69
+ 3. Call the ingest API or write the file manually:
70
+
71
+ ```bash
72
+ # Write the markdown file with frontmatter
73
+ cat > .instar/knowledge/articles/2026-02-25-my-article.md << 'EOF'
74
+ ---
75
+ title: "My Article"
76
+ source: "https://example.com/article"
77
+ ingested: "2026-02-25"
78
+ tags: ["AI", "infrastructure"]
79
+ ---
80
+
81
+ # My Article
82
+
83
+ [Cleaned article content here]
84
+ EOF
85
+
86
+ # Sync the index to pick up the new file
87
+ instar memory sync
88
+ ```
89
+
90
+ ---
91
+
92
+ ## Searching Knowledge
93
+
94
+ ### CLI
95
+
96
+ ```bash
97
+ # Search within knowledge base only
98
+ instar knowledge search "notification batching"
99
+
100
+ # Search all memory (including knowledge)
101
+ instar memory search "notification batching"
102
+ ```
103
+
104
+ ### API
105
+
106
+ ```bash
107
+ # Knowledge-scoped search
108
+ curl "http://localhost:${INSTAR_PORT:-4040}/memory/search?q=notification+batching&source=knowledge/&limit=5"
109
+
110
+ # Browse the catalog
111
+ curl "http://localhost:${INSTAR_PORT:-4040}/knowledge/catalog"
112
+ curl "http://localhost:${INSTAR_PORT:-4040}/knowledge/catalog?tag=AI"
113
+ ```
114
+
115
+ ---
116
+
117
+ ## Managing Sources
118
+
119
+ ### List all sources
120
+
121
+ ```bash
122
+ instar knowledge list
123
+ instar knowledge list --tag AI
124
+ ```
125
+
126
+ ### Remove a source
127
+
128
+ ```bash
129
+ # Find the source ID from the list
130
+ instar knowledge list
131
+
132
+ # Remove it
133
+ instar knowledge remove kb_20260225123456_abc123
134
+
135
+ # Re-sync the index
136
+ instar memory sync
137
+ ```
138
+
139
+ ### Via API
140
+
141
+ ```bash
142
+ # Remove
143
+ curl -X DELETE "http://localhost:${INSTAR_PORT:-4040}/knowledge/kb_20260225123456_abc123"
144
+ ```
145
+
146
+ ---
147
+
148
+ ## MemoryIndex Configuration
149
+
150
+ To enable knowledge base indexing, add these sources to your `.instar/config.json` memory section:
151
+
152
+ ```json
153
+ {
154
+ "memory": {
155
+ "enabled": true,
156
+ "sources": [
157
+ { "path": "AGENT.md", "type": "markdown", "evergreen": true },
158
+ { "path": "USER.md", "type": "markdown", "evergreen": true },
159
+ { "path": "knowledge/articles/", "type": "markdown", "evergreen": false },
160
+ { "path": "knowledge/transcripts/", "type": "markdown", "evergreen": false },
161
+ { "path": "knowledge/docs/", "type": "markdown", "evergreen": true }
162
+ ]
163
+ }
164
+ }
165
+ ```
166
+
167
+ **Source behavior:**
168
+ - `articles/` and `transcripts/` use `evergreen: false` -- recent content ranks higher (30-day temporal decay)
169
+ - `docs/` uses `evergreen: true` -- reference documentation doesn't decay
170
+
171
+ ---
172
+
173
+ ## Content Types
174
+
175
+ | Type | Directory | Temporal Decay | Best For |
176
+ |------|-----------|----------------|----------|
177
+ | `article` | `articles/` | Yes (30-day) | Web articles, blog posts, news |
178
+ | `transcript` | `transcripts/` | Yes (30-day) | YouTube videos, podcasts, meetings |
179
+ | `doc` | `docs/` | No (evergreen) | API docs, manuals, reference material |
180
+
181
+ ---
182
+
183
+ ## Tips
184
+
185
+ - **Always sync after ingesting**: `instar memory sync` updates the FTS5 index
186
+ - **Use tags consistently**: Tags enable filtered browsing via `instar knowledge list --tag X`
187
+ - **Include source URLs**: Helps trace back to original content
188
+ - **Clean before ingesting**: Strip navigation, ads, cookie banners for better search results
189
+ - **Use smart-fetch for URLs**: `python3 .claude/scripts/smart-fetch.py URL --auto` gets clean markdown
@@ -0,0 +1,241 @@
1
+ ---
2
+ name: smart-web-fetch
3
+ description: Fetch web content efficiently by checking llms.txt first, then Cloudflare markdown endpoints, then falling back to HTML. Reduces token usage by 80% on sites that support clean markdown delivery. No external dependencies — installs a single Python script. Trigger words: fetch URL, web content, read website, scrape page, download page, get webpage, read this link.
4
+ license: MIT
5
+ metadata:
6
+ author: sagemindai
7
+ version: "1.0"
8
+ homepage: https://instar.sh
9
+ ---
10
+
11
+ # smart-web-fetch — Token-Efficient Web Content Fetching
12
+
13
+ Fetching a webpage with the default WebFetch tool retrieves full HTML — navigation menus, footers, ads, cookie banners, and all. For a documentation page, 90% of the tokens go to chrome, not content. This script fixes that by trying cleaner sources first.
14
+
15
+ ## How It Works
16
+
17
+ The fetch chain, in order:
18
+
19
+ 1. **Check `llms.txt`** — Many sites publish `/llms.txt` or `/llms-full.txt` with curated content for AI agents. If present, this is the best source: intentionally structured, no noise.
20
+ 2. **Try Cloudflare markdown** — Cloudflare's network serves clean markdown for millions of sites via a URL prefix trick. If the site is behind Cloudflare, this returns structured markdown at ~20% of the HTML token cost.
21
+ 3. **Fall back to HTML** — Standard fetch, with HTML stripped to readable text. Reliable but verbose.
22
+
23
+ The result: typically 60-80% fewer tokens on documentation sites, blog posts, and product pages.
24
+
25
+ ---
26
+
27
+ ## Installation
28
+
29
+ Copy the script into your project's scripts directory:
30
+
31
+ ```bash
32
+ mkdir -p .claude/scripts
33
+ ```
34
+
35
+ Then create `.claude/scripts/smart-fetch.py` with the contents below.
36
+
37
+ ---
38
+
39
+ ## The Script
40
+
41
+ Save this as `.claude/scripts/smart-fetch.py`:
42
+
43
+ ```python
44
+ #!/usr/bin/env python3
45
+ """
46
+ smart-fetch.py — Token-efficient web content fetching.
47
+ Tries llms.txt, then Cloudflare markdown, then plain HTML.
48
+ Usage: python3 .claude/scripts/smart-fetch.py <url> [--raw] [--source]
49
+ """
50
+ import sys
51
+ import urllib.request
52
+ import urllib.parse
53
+ import urllib.error
54
+ import re
55
+ import json
56
+
57
+ def fetch_url(url, timeout=15):
58
+ req = urllib.request.Request(url, headers={
59
+ 'User-Agent': 'Mozilla/5.0 (compatible; agent-fetch/1.0)'
60
+ })
61
+ try:
62
+ with urllib.request.urlopen(req, timeout=timeout) as r:
63
+ charset = 'utf-8'
64
+ ct = r.headers.get('Content-Type', '')
65
+ if 'charset=' in ct:
66
+ charset = ct.split('charset=')[-1].strip()
67
+ return r.read().decode(charset, errors='replace'), r.geturl()
68
+ except urllib.error.HTTPError as e:
69
+ return None, str(e)
70
+ except Exception as e:
71
+ return None, str(e)
72
+
73
+ def html_to_text(html):
74
+ # Remove scripts, styles, nav, footer
75
+ for tag in ['script', 'style', 'nav', 'footer', 'header', 'aside']:
76
+ html = re.sub(rf'<{tag}[^>]*>.*?</{tag}>', '', html, flags=re.DOTALL|re.IGNORECASE)
77
+ # Remove all remaining tags
78
+ text = re.sub(r'<[^>]+>', ' ', html)
79
+ # Decode common entities
80
+ for ent, ch in [('&amp;','&'),('&lt;','<'),('&gt;','>'),('&nbsp;',' '),('&#39;',"'"),('&quot;','"')]:
81
+ text = text.replace(ent, ch)
82
+ # Collapse whitespace
83
+ text = re.sub(r'\n\s*\n\s*\n', '\n\n', text)
84
+ text = re.sub(r'[ \t]+', ' ', text)
85
+ return text.strip()
86
+
87
+ def get_base(url):
88
+ p = urllib.parse.urlparse(url)
89
+ return f"{p.scheme}://{p.netloc}"
90
+
91
+ def try_llms_txt(base):
92
+ for path in ['/llms-full.txt', '/llms.txt']:
93
+ content, _ = fetch_url(base + path)
94
+ if content and len(content) > 100 and not content.strip().startswith('<'):
95
+ return content, 'llms.txt'
96
+ return None, None
97
+
98
+ def try_cloudflare_markdown(url):
99
+ # Cloudflare's markdown delivery: prefix with https://cloudflare.com/markdown/
100
+ # Actually the pattern is: replace scheme+domain with r.jina.ai for Jina,
101
+ # or use the /md/ subdomain pattern for CF Pages.
102
+ # Most reliable open technique: jina.ai reader (no API key needed for basic use)
103
+ jina_url = 'https://r.jina.ai/' + url
104
+ content, final_url = fetch_url(jina_url, timeout=20)
105
+ if content and len(content) > 200 and not content.strip().startswith('<!'):
106
+ return content, 'markdown'
107
+ return None, None
108
+
109
+ def smart_fetch(url, show_source=False):
110
+ base = get_base(url)
111
+ results = []
112
+
113
+ # 1. Try llms.txt
114
+ content, source = try_llms_txt(base)
115
+ if content:
116
+ results.append(('llms.txt', content))
117
+
118
+ # 2. Try markdown delivery
119
+ content, source = try_cloudflare_markdown(url)
120
+ if content:
121
+ results.append(('markdown', content))
122
+
123
+ # 3. HTML fallback
124
+ if not results:
125
+ html, _ = fetch_url(url)
126
+ if html:
127
+ text = html_to_text(html)
128
+ results.append(('html', text))
129
+
130
+ if not results:
131
+ print(f"ERROR: Could not fetch {url}", file=sys.stderr)
132
+ sys.exit(1)
133
+
134
+ # Use best result (prefer llms.txt > markdown > html)
135
+ best_source, best_content = results[0]
136
+
137
+ if show_source:
138
+ print(f"[source: {best_source}]", file=sys.stderr)
139
+
140
+ return best_content
141
+
142
+ if __name__ == '__main__':
143
+ args = sys.argv[1:]
144
+ if not args or args[0] in ('-h', '--help'):
145
+ print(__doc__)
146
+ sys.exit(0)
147
+
148
+ url = args[0]
149
+ show_source = '--source' in args
150
+
151
+ content = smart_fetch(url, show_source=show_source)
152
+ print(content)
153
+ ```
154
+
155
+ Make it executable:
156
+
157
+ ```bash
158
+ chmod +x .claude/scripts/smart-fetch.py
159
+ ```
160
+
161
+ ---
162
+
163
+ ## Usage
164
+
165
+ ```bash
166
+ # Fetch a page (auto-selects best source)
167
+ python3 .claude/scripts/smart-fetch.py https://docs.example.com/guide
168
+
169
+ # Show which source was used (llms.txt / markdown / html)
170
+ python3 .claude/scripts/smart-fetch.py https://docs.example.com/guide --source
171
+
172
+ # Pipe into another tool
173
+ python3 .claude/scripts/smart-fetch.py https://example.com | head -100
174
+ ```
175
+
176
+ ---
177
+
178
+ ## Teaching the Agent to Use It
179
+
180
+ Add this to your project's `CLAUDE.md`:
181
+
182
+ ```markdown
183
+ ## Web Fetching
184
+
185
+ When fetching web content, always use the smart-fetch script first:
186
+
187
+ ```bash
188
+ python3 .claude/scripts/smart-fetch.py <url> --source
189
+ ```
190
+
191
+ Only use WebFetch as a fallback if smart-fetch fails or if you need
192
+ JavaScript-rendered content. The script reduces token usage by 60-80%
193
+ on documentation sites and blogs.
194
+ ```
195
+
196
+ ---
197
+
198
+ ## When Each Source Wins
199
+
200
+ | Site Type | Likely Source | Why |
201
+ |-----------|--------------|-----|
202
+ | AI/dev tool docs | llms.txt | Modern tools publish agent-ready content |
203
+ | Technical blogs | markdown | Clean article content via markdown delivery |
204
+ | Legacy enterprise sites | html | No markdown alternative available |
205
+ | SPAs / JS-heavy sites | html (may be sparse) | Server-side content only |
206
+
207
+ ---
208
+
209
+ ## Token Savings by Source
210
+
211
+ Approximate token counts for a typical 2,000-word documentation page:
212
+
213
+ - **HTML** (raw): ~8,000 tokens (navigation, scripts, markup included)
214
+ - **Markdown delivery**: ~2,000 tokens (clean structured content)
215
+ - **llms.txt**: ~1,500 tokens (curated for AI consumption)
216
+
217
+ On a project that fetches 50 URLs per session, this saves ~300,000 tokens — roughly the difference between fitting in context and not.
218
+
219
+ ---
220
+
221
+ ## Going Further
222
+
223
+ Smart-fetch saves tokens on every fetch. But you're still triggering each fetch manually — "go check this URL." The real power comes when fetching happens automatically, on a schedule, without you asking.
224
+
225
+ **With Instar, your agent can monitor the web autonomously.** Set up a cron job that checks competitor pricing every morning. Another that watches API documentation for breaking changes. Another that summarizes your RSS feeds before you wake up. Smart-fetch runs inside each job, keeping token costs low while the agent works through dozens of URLs on its own.
226
+
227
+ Instar also adds a caching layer — the same URL fetched twice within a configurable window returns the cached version, so recurring jobs don't waste tokens re-reading content that hasn't changed.
228
+
229
+ And web monitoring is just one use case. With Instar, your agent also gets:
230
+ - **A full job scheduler** — any task on cron
231
+ - **Background sessions** — parallel workers for deep tasks
232
+ - **Telegram integration** — results delivered to your phone
233
+ - **Persistent identity and memory** — context that survives across sessions
234
+
235
+ One command, about 2 minutes:
236
+
237
+ ```bash
238
+ npx instar
239
+ ```
240
+
241
+ Your agent goes from fetching when you ask to watching the web while you sleep. [instar.sh](https://instar.sh)