agentleFS
cocoindex-iococoindex-io/cocoindex/examples/AGENTS.md

cocoindex / examples

AGENTS.md12k starsChanged 5 months agoApache-2.0View on GitHub

Guidance for AI coding agents (Claude Code, Cursor, etc.) working in this examples/ directory. Most top-level Python subfolders are self-contained, runnable CocoIndex v1 apps; rust/ contains Rust ports with per-example READMEs. CocoIndex v1 is a fundamental redesign from v0. Without context, LLMs tend to hallucinate the v0 flow-builder DSL and deprecated decorators. Install the official skill first — it teaches the correct v1 API. Quickest portable path for Codex and other Agent Skills-compatible clients is the hosted skill: Or clone…

  • Reads credentials
  • Installs packages

Trending

Quiet since July.about the whole repository

Dec 2025: 6 mentionsJan 2026: 0 mentionsFeb 2026: 0 mentionsMar 2026: 13 mentionsApr 2026: 8 mentionsMay 2026: 10 mentionsJun 2026: 1 mentionJul 2026: 1 mentionAug 2026: 0 mentionsSep 2026: 0 mentionsOct 2026: 0 mentionsNov 2026: 0 mentions
Dec 2025Jun 2026Nov 2026
Mentions a month of the cocoindex-io/cocoindex repository that our weekly crawl found. There is no adoption data for this file yet.

Who's talking about cocoindex-io/cocoindex

The biggest 5 of 93 mentions linking to the repository that our crawl found. Each line is their own headline.

See all 93

Talked about on Bluesky, GitHub and Hacker News (93 times).

On Bluesky · 50

45 more on Bluesky

On GitHub · 35

30 more on GitHub

On Hacker News · 8

3 more on Hacker News
  • Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.

    Of the AGENTS.md files we read, the 11,773 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.

  • In this repository3 other files it gives its agents.

The file

We split this AGENTS.md into the rules it gives an agent

4 rules. About 0 are common, 1 is distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use the example's README as the source of truth.

    line 60
  2. Very specific:

    When an example needs credentials or service configuration, required env vars are templated in that example's .env.example — cp it to .env …

    line 80
  3. Very specific:

    Keep each Python example self-contained: its own pyproject.toml and README.md.

    line 148
  4. Very specific:

    Don't commit generated artifacts (cocoindex.db, __pycache__, build output) — they're already git-ignored.

    line 153

≈ “Common” is an estimate: at least 1 in 5 of the 16,595 AGENTS.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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

AGENTS.md — CocoIndex examples

Guidance for AI coding agents (Claude Code, Cursor, etc.) working in this examples/ directory. Most top-level Python subfolders are self-contained, runnable CocoIndex v1 apps; rust/ contains Rust ports with per-example READMEs.

Before you write CocoIndex code: install the skill

CocoIndex v1 is a fundamental redesign from v0. Without context, LLMs tend to hallucinate the v0 flow-builder DSL and deprecated decorators. Install the official skill first — it teaches the correct v1 API. Quickest portable path for Codex and other Agent Skills-compatible clients is the hosted skill:

mkdir -p .agents/skills/cocoindex/references
curl -fsSL https://cocoindex.io/docs/skill.md -o .agents/skills/cocoindex/SKILL.md
for f in api_reference connectors patterns setup_database setup_project; do
  curl -fsSL https://cocoindex.io/docs/references/$f.md -o .agents/skills/cocoindex/references/$f.md
done

Or clone the repo and copy the folder:

git clone --depth=1 https://github.com/cocoindex-io/cocoindex.git /tmp/cocoindex-skill
mkdir -p .agents/skills && cp -r /tmp/cocoindex-skill/skills/cocoindex .agents/skills/

For Claude Code's native project path, use .claude/skills/cocoindex instead of .agents/skills/cocoindex; the skill format is the same.

The skill itself lives at skills/cocoindex/ (SKILL.md + references/). For Cursor, copy SKILL.md into .cursor/rules/. Full machine-readable docs: https://cocoindex.io/docs/llms.txt (index) and https://cocoindex.io/docs/llms-full.txt (everything, including example walkthroughs). Regular docs pages also have raw Markdown twins by replacing the trailing slash with .md (e.g. https://cocoindex.io/docs/programming_guide/core_concepts.md).

The v1 mental model

target_state = transform(source_state). You declare what the target should look like; the Rust engine keeps it in sync, reprocessing only what changed (state is tracked in a local LMDB store — no database is required for the engine itself, only when an example writes to one). Key APIs: @coco.fn, mount / use_mount / mount_each, ContextKey, target-state declarations. See the skill for details.

Running examples

Most Python examples are standalone projects with their own pyproject.toml:

cd <example_dir>
cp .env.example .env          # if present — fill in the blanks (see below)
pip install -e .              # or: uv pip install -e .
cocoindex update main         # catch-up: scan sources, sync, exit
cocoindex update -L main      # live mode: catch up, then watch for changes (where supported)

Use the example's README as the source of truth. Known exceptions:

  • multi_codebase_summarization, audio_to_text, patient_intake_extraction_baml, patient_intake_extraction_dspy: cocoindex update main.py
  • conversation_to_knowledge: cocoindex update conv_knowledge.app
  • image_search, image_search_colpali: start the API with python -m uvicorn api:app --reload --host 0.0.0.0 --port 8000; it runs the CocoIndex app in live mode, then start the frontend from frontend/.
  • csv_to_kafka, kafka_to_lancedb: cocoindex update -L main.py
  • rust/<example>: follow that example's README. Many use cargo run -- index for indexing and cargo run -- query "..." for search; a few take custom paths or service-specific subcommands.

Some examples expose a query/CLI demo via python main.py "<query>"; check the example's README.md. Examples that need extra services or a code-gen step (e.g. baml generate) say so in their README.

Environment / credentials

When an example needs credentials or service configuration, required env vars are templated in that example's .env.example — cp it to .env and fill in the blanks; both python main.py and the cocoindex CLI load .env automatically. Common ones:

  • POSTGRES_URL — for Postgres/pgvector targets. Local instance: docker compose -f ../../dev/postgres.yaml up -d from inside an example directory.
  • OPENAI_API_KEY / GEMINI_API_KEY — for examples that call an LLM.
  • Service-specific (QDRANT_URL, LANCEDB_URI, NEO4J_*, KAFKA_*, GOOGLE_SERVICE_ACCOUNT_CREDENTIAL, …) — see that example's .env.example.

Examples with no .env.example (e.g. files_transform, pdf_to_markdown) run fully locally with no credentials.

Never commit secrets. The .env files tracked in this repo hold only non-secret defaults (COCOINDEX_DB, local service URLs); keep API keys and credentials in your local .env edits and out of commits.

The examples

A walkthrough URL means there's a step-by-step guide at https://cocoindex.io/docs/examples/<slug>/; otherwise start from the example's README.

Vector indexes (embed → store → search by meaning)

  • text_embedding — Markdown → pgvector; the simplest end-to-end index. (walkthrough: text-embedding)
  • code_embedding — repo → Tree-sitter chunks → pgvector; query code in English. (walkthrough: index-codebase)
  • text_embedding_qdrant / text_embedding_lancedb / text_embedding_turbopuffer — same flow, different vector store.
  • code_embedding_lancedb — code chunks → LanceDB.
  • pdf_embedding — PDFs → markdown → chunks → pgvector.
  • paper_metadata — extract title/authors/abstract from PDFs → Postgres + embeddings.
  • amazon_s3_embedding / gdrive_text_embedding / oci_object_storage_embedding — same flow, remote source (S3 / Google Drive / OCI).
  • postgres_source — read from an existing Postgres table as the source.
  • entire_session_search — semantic search over AI coding sessions captured by Entire.
  • sec_edgar_analytics — multi-format SEC filings → Apache Doris with a vector and a full-text index; hybrid (semantic + keyword) RRF search. (walkthrough: sec-edgar-analytics)

Multimodal

  • image_search — CLIP embeddings + Qdrant, queried via FastAPI + React.
  • image_search_colpali — ColPali multi-vector model + Qdrant MaxSim.
  • multi_format_indexing — PDFs + images as page screenshots → ColPali → Qdrant; no OCR, no chunking. (walkthrough: multi-format-indexing)
  • face_recognition — detect faces (dlib) → 128-d embeddings → Qdrant face search. (walkthrough: face-recognition)
  • audio_to_text — transcribe audio with LiteLLM → Postgres.
  • slides_to_speech — slides → vision-LLM notes → Pocket TTS narration → LanceDB semantic search. (walkthrough: slides-to-speech)

Structured extraction (LLM / BAML / DSPy)

  • multi_codebase_summarization — LLM per-file summaries across many repos. (walkthrough: multi-codebase-summarization)
  • hn_trending_topics — scrape HackerNews → LLM topic extraction → Postgres.
  • manuals_llm_extraction — PDF manuals → Markdown (docling) → typed module records → Postgres. (walkthrough: manuals-llm-extraction)
  • patient_intake_extraction_baml / patient_intake_extraction_dspy — structured PDF extraction with BAML / DSPy (Gemini vision).

Knowledge graphs

  • conversation_to_knowledge — YouTube podcasts → SurrealDB knowledge graph. (walkthrough: podcast-to-knowledge-graph)
  • docs_to_knowledge_graph — Markdown docs → Neo4j concept graph of LLM-extracted triples. (walkthrough: docs-to-knowledge-graph)
  • product_recommendation — product catalog → LLM taxonomy extraction → Neo4j recommendation graph. (walkthrough: product-recommendation)
  • meeting_notes_graph_neo4j / meeting_notes_graph_falkordb — Google Drive meeting notes → Neo4j / FalkorDB graph.
  • meeting_notes_graph_surrealdb — local Markdown meeting notes → SurrealDB graph.

Custom sources / targets / streaming

  • pdf_to_markdown — incremental PDF → Markdown with docling (local, no services). (walkthrough: pdf-to-markdown)
  • files_transform — watch Markdown files → HTML, live mode (local, no services).
  • csv_to_kafka — watch CSVs → publish rows to Kafka.
  • kafka_to_lancedb — consume Kafka → route to LanceDB tables.

Rust

  • rust/ — Rust ports of many of the above, using the CocoIndex Rust API.

Conventions for edits

  • Keep each Python example self-contained: its own pyproject.toml and README.md; add .env.example when credentials or configurable services are required. When you add an example, also add a line to EXAMPLE_CATALOG in the docs repo (docs/src/data/examples.ts) so it appears in /docs/llms.txt.
  • Match the surrounding code's low comment density.
  • Don't commit generated artifacts (cocoindex.db, __pycache__, build output) — they're already git-ignored.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.