xint / lib
CLAUDE.md254 starsChanged 10 months agoMITView on GitHub
Edit lib/mcp.ts - add to TOOLS array and executeTool() method:
- Reads credentials
In this repository2 other files it gives its agents.
- references/CLAUDE.mdCLAUDE.md
- xintSkill
The file
We split this CLAUDE.md into the rules it gives an agent
5 rules. About 0 are common, 4 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 47
All API functions throw on error
- Very specific: line 52
Create lib/newcmd.ts with command logic
- Distinctive: line 54
Add case to main switch statement
- Distinctive: line 100
No unit tests in current codebase
- Distinctive: line 101
Test API calls with real credentials
≈ “Common” is an estimate: at least 1 in 5 of the 12,729 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
xint TypeScript Codebase Guide
Project Overview
- Lines: ~6,835 LOC across 18 modules
- Runtime: Bun (TypeScript)
- Entry:
xint.ts(main CLI)
File Structure
lib/
├── api.ts # X API wrapper (search, profile, thread, tweet)
├── article.ts # Article fetching via xAI web_search
├── bookmarks.ts # OAuth bookmark operations
├── cache.ts # File-based cache (15min TTL)
├── costs.ts # API cost tracking & budgets
├── engagement.ts # Likes, following, bookmark writes
├── followers.ts # Follower tracking with snapshots
├── format.ts # Output formatters (Telegram, Markdown, CSV, JSONL)
├── grok.ts # xAI Grok integration (chat, analyze, vision)
├── mcp.ts # MCP server (STDIO + SSE modes)
├── oauth.ts # OAuth 2.0 PKCE authentication
├── report.ts # Intelligence report generation
├── sentiment.ts # AI sentiment analysis
├── trends.ts # Trending topics
├── watch.ts # Real-time monitoring (polling)
└── x_search.ts # xAI x-search (AI-powered search)Key Patterns
Rate Limiting
- 350ms delay between API requests
- Respects
x-rate-limit-resetheaders
Caching
- Default TTL: 15 minutes
- Quick mode: 1 hour
- Storage:
data/cache/(JSON files)
Token Storage
- OAuth tokens:
data/oauth-tokens.json - File permissions: chmod 600 (owner only)
Error Handling
- All API functions throw on error
- Common errors: 401 (auth), 429 (rate limit), 404 (not found)
Adding Commands
- Create
lib/newcmd.tswith command logic - Import in
xint.ts - Add case to main switch statement
import { cmdNewCmd } from "./lib/newcmd";
case "newcmd":
await cmdNewCmd(args.slice(1));
break;Adding MCP Tools
Edit lib/mcp.ts - add to TOOLS array and executeTool() method:
{
name: "xint_newtool",
description: "Description",
inputSchema: {
type: "object",
properties: { param: { type: "string" } },
required: ["param"]
}
}Common Tasks
| Task | Location |
| Add new command | lib/newcmd.ts |
| Add MCP tool | lib/mcp.ts |
| Modify search | lib/api.ts |
| Add Grok feature | lib/grok.ts |
| Change output format | lib/format.ts |
Environment Variables
| Variable | Required | Purpose |
X_BEARER_TOKEN | Yes | X API v2 |
XAI_API_KEY | No | Grok features |
X_CLIENT_ID | No | OAuth |
Testing Notes
- No unit tests in current codebase
- Test API calls with real credentials
- Cache operations use temp directories
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

