fast_context
Skill2 starsChanged 3 months agoMITView on GitHub
FastContext Agent — exploration repo déterministe. Parse une requête d'exploration → READ/GLOB/GREP ciblés → rapport compact (fichier:ligne:score). Remplace 56% des appels LLM de type "read/search" par des opérations stdio à ~5ms, 0 token. Use when the agent needs to understand a codebase, find patterns, locate imports, or gather context without an LLM call.
In this repository75 other files it gives its agents.
- AGENTS.mdAGENTS.md
- clean-cacheSkill
- agent-cacheSkill
- app_testSkill
- asset-qualitySkill
- auto_distillSkill
- auto-memorySkill
- auto_routerSkill
- benchSkill
- bootstrapSkill
- botte-proxySkill
- cacheSkill
- capabilitiesSkill
- cardinalSkill
- cavemanSkill
- checkupSkill
- clarificationSkill
- clusterSkill
- code_fingerprintSkill
- completion_proofSkill
- conductorSkill
- context_budgetSkill
- context_profilerSkill
- context_slicerSkill
- context_windowsSkill
- control_loopSkill
- cost_estimatorSkill
- cwe_kbSkill
- dag_optimizerSkill
- dashboardSkill
- decision-ladderSkill
- demoSkill
- diff_languageSkill
- directives_auditSkill
- docgenSkill
- docs_stewardSkill
- eventsSkill
- fallow_likeSkill
- fixSkill
- harness_deltaSkill
- hermes-bridgeSkill
- hf_provenanceSkill
- infra_advisorSkill
- ingestSkill
- llm_backendsSkill
- llm_mcpSkill
- loaderSkill
- mcp_gatewaySkill
- meta_harnessSkill
- metricsSkill
- migration_auditSkill
- monte_cristoSkill
- mousquetairesSkill
- nlp_deterministicSkill
- nn_auditSkill
- prefix-prunerSkill
- prefix_treeSkill
- preflightSkill
- prompt_improverSkill
- reportSkill
- The first 60 shown.
The file
Files
FastContext Agent — exploration repo
Un sous-agent d'exploration déterministe qui sépare la collecte de contexte du raisonnement. Au lieu de laisser l'agent principal dépenser 56% de ses tokens en READ/GLOB/GREP, FastContext gère ça en ~5ms, 0 token.
Inspiré par Microsoft FastContext-1.0-4B-SFT mais 100% déterministe (stdlib Python, pas de LLM, pas de GPU).
Usage
# Explorer un dossier
python -m skills.fast_context.cli explore /path/to/project "find DB connection patterns"
# Types de requête supportés
python -m skills.fast_context.cli explore . "find all imports in main.py"
python -m skills.fast_context.cli explore . "understand function: calibrate()"
python -m skills.fast_context.cli explore . "where are the tests?"
python -m skills.fast_context.cli explore . "queue usage patterns"
python -m skills.fast_context.cli explore . "audit security: eval, exec, shell"
# Mode verbeux
python -m skills.fast_context.cli explore . "find async patterns" --verbose
# Limiter les résultats
python -m skills.fast_context.cli explore . "import pathlib" --max-results 10
# Utiliser le cache
python -m skills.fast_context.cli explore . "class FastContext" --cacheAPI Python
from skills.fast_context import explore, cached_explore
from skills.fast_context import discover_query_type, QueryType
# Exploration simple
results = explore(".", "find DB connection patterns")
# → [{"file": "src/db.py:15", "snippet": "...", "score": 0.92, "type": "import"}, ...]
# Avec cache
results = cached_explore(".", "find async patterns", ttl=60)
# Découverte du type de requête
qt = discover_query_type("find all imports")
# → QueryType.IMPORTSTypes de requête
| Type | Mots-clés | Action |
IMPORTS | import, dependency, require | grep imports + suggest files |
FUNCTION | function, method, def, understand | grep def → contexte fichier |
TESTS | test, spec, unittest | glob test_* + grep |
PATTERN | pattern, usage, find, where | grep générique |
SECURITY | security, audit, eval, malicious | grep dangereux |
Architecture
FastContext Agent
┌─────────────────────────────────┐
│ agent.py │
│ - discover_query_type(query) │
│ - explore(query, path) → list │
├─────────────────────────────────┤
│ readers.py │
│ - fast_read(file, lines) │
│ - fast_glob(pattern, root) │
│ - fast_grep(pattern, root) │
├─────────────────────────────────┤
│ ranker.py │
│ - score(file, match, query) │
│ - rank_results(results) │
├─────────────────────────────────┤
│ compiler.py │
│ - compile_report(results) │
│ - format_compact(results) │
├─────────────────────────────────┤
│ store.py │
│ - LRUCache(ttl=30) │
└─────────────────────────────────┘Économie tokens estimée
| Type requête | Avant (LLM) | Après (FastContext) | Économie |
| Imports | ~800 tokens | 0 token | -100% |
| Comprendre fonction | ~1200 tokens | 0 token | -100% |
| Trouver tests | ~400 tokens | 0 token | -100% |
| Pattern search | ~600 tokens | 0 token | -100% |
| Audit sécurité | ~2000 tokens | 0 token | -100% |
~5000 tokens/session économisés (estimé sur 5 explorations par session).
Pitfalls
- Ne remplace pas LLM pour compréhension complexe — FastContext livre du contexte brut (fichier:ligne:snippet). Le LLM principal doit encore raisonner dessus. C'est le but : le LLM ne fait QUE raisonner.
- Cache TTL — Le cache LRU évite de rescanner 30 fois le même fichier dans
la même session. TTL par défaut: 30s. Passer
--no-cachepour forcer. - Gros repos — Pour les repos >1000 fichiers,
fast_greputilisesubprocess.run("grep -rl ...")plutôt qu'un glob Python (10x plus rapide). - Binaire/symlinks — Skip automatiquement les fichiers binaires, .git/, node_modules/, pycache/, .venv/.
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.

