fenic
CLAUDE.md673 starsChanged 5 months agoApache-2.0View on GitHub
The @AGENTS.md line above pulls in the cross-agent quick-reference for writing fenic pipelines (also read natively by Codex, Cursor, Gemini CLI, etc.); the rest of this file covers developing fenic itself. For deep authoring help, the fenic-mechanics skill auto-loads in Claude Code. Fenic is a PySpark-inspired DataFrame framework specifically designed for AI and LLM applications. It provides semantic operators for LLM-powered data transformations, native support for unstructured data (markdown, transcripts, JSON), and efficient batch inference across multiple model providers (OpenAI,…
In this repository5 other files it gives its agents.
- AGENTS.mdAGENTS.md
- docs/agents.mdAGENTS.md
- .cursor/rules/fenic.mdcCursor rule
- fenic-mechanicsSkill
- update-fenic-skillSkill
The file
We split this CLAUDE.md into the rules it gives an agent
5 rules. About 0 are common, 0 are distinctive, and 5 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 78
Session-Centric Design: All operations flow through Session.get_or_create().
- Very specific: line 110
New DataFrame Operation: Add method to DataFrame class, create corresponding logical plan node
- Very specific: line 111
New Semantic Operation: Add to SemanticExtension class in api/dataframe/semantic_extension.py
- Very specific: line 112
New Function: Add to appropriate module in api/functions/
- Very specific: line 118
Use @pytest.mark.cloud for tests requiring cloud backend
≈ “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
CLAUDE.md
@AGENTS.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. The @AGENTS.md line above pulls in the cross-agent quick-reference for writing fenic pipelines (also read natively by Codex, Cursor, Gemini CLI, etc.); the rest of this file covers developing fenic itself. For deep authoring help, the fenic-mechanics skill auto-loads in Claude Code.
Project Overview
Fenic is a PySpark-inspired DataFrame framework specifically designed for AI and LLM applications. It provides semantic operators for LLM-powered data transformations, native support for unstructured data (markdown, transcripts, JSON), and efficient batch inference across multiple model providers (OpenAI, Anthropic, Google).
Development Commands
Setup and Dependencies
# Initial setup (installs dependencies and builds Rust extensions)
just setup
# Sync Python dependencies
just sync
# Build Rust extensions (required after Rust code changes)
just sync-rust
# Sync with cloud extras
just sync-cloudTesting
# Run local tests (excludes cloud tests)
just test
# or
just test-local
# Run cloud-related tests
just test-cloud
# Run specific test file
uv run pytest tests/path/to/test_file.py
# Run specific test
uv run pytest tests/path/to/test_file.py::test_function_nameLinting and Formatting
# Ruff is configured for linting (Google-style docstrings)
# Auto-formats code examples in docstrings
uv run ruff check .
uv run ruff format .Documentation
# Preview documentation locally
just preview-docsArchitecture Overview
Directory Structure
src/fenic/: Main Python source codeapi/: Public API - Session, DataFrame, Functions, IOcore/: Core logic - logical plans, expressions, types, optimizer_backends/: Execution backends (local using Polars, cloud using gRPC)_inference/: LLM inference clients for different providers
rust/: Rust source for performance-critical operations (text chunking, markdown/JSON parsing)tests/: Test suite (pytest-based)examples/: Example applications demonstrating fenic usage
Key Architectural Components
- Session-Centric Design: All operations flow through
Session.get_or_create(). The session manages configuration, execution engine, and resource lifecycle. - Lazy Evaluation: DataFrame operations build logical plans without immediate execution. Execution is triggered by actions like
show(),collect(), orcount(). - Logical vs Physical Plans:
- Logical plans (
src/fenic/core/_logical_plan/) define what to compute - Physical plans (
src/fenic/_backends/local/physical_plan/) define how to compute - Optimizer rules transform logical plans before execution
- Logical plans (
- Semantic Operators: First-class support for LLM operations through the
semanticnamespace on DataFrames:semantic.map(),semantic.extract(),semantic.classify()semantic.join(),semantic.group_by(),semantic.reduce()
- Backend Abstraction: Supports both local execution (using Polars) and cloud execution (using gRPC). Backend is selected via session configuration.
- Type System: Strong typing with schema inference throughout. All operations validate types at plan construction time.
Working with Semantic Operations
Semantic operations are accessed through the DataFrame's semantic property:
# Example: Extract structured data from text
df.semantic.extract(
"content_column",
schema=MyPydanticModel,
model="gpt-4o-mini"
)Adding New Features
- New DataFrame Operation: Add method to
DataFrameclass, create corresponding logical plan node - New Semantic Operation: Add to
SemanticExtensionclass inapi/dataframe/semantic_extension.py - New Function: Add to appropriate module in
api/functions/ - New Rust Extension: Implement in
rust/src/, expose via PyO3 bindings
Testing Considerations
- Tests are organized by feature area in
tests/ - Use
@pytest.mark.cloudfor tests requiring cloud backend - Mock LLM responses when possible to avoid API calls in tests
- Integration tests in
examples/demonstrate real-world usage
Important Notes
- The project uses
uvas the package manager (not pip or poetry) - Rust extensions must be rebuilt after changes using
just sync-rust - LLM provider API keys must be set as environment variables
- The codebase follows Google-style docstrings
- Ruff is configured for linting with specific rules (see
ruff.toml)
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.

