agentleFS
typedef-aitypedef-ai/fenic/CLAUDE.md

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,…

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
  1. Very specific:

    Session-Centric Design: All operations flow through Session.get_or_create().

    line 78
  2. Very specific:

    New DataFrame Operation: Add method to DataFrame class, create corresponding logical plan node

    line 110
  3. Very specific:

    New Semantic Operation: Add to SemanticExtension class in api/dataframe/semantic_extension.py

    line 111
  4. Very specific:

    New Function: Add to appropriate module in api/functions/

    line 112
  5. Very specific:

    Use @pytest.mark.cloud for tests requiring cloud backend

    line 118

≈ “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.

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

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-cloud

Testing

# 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_name

Linting 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-docs

Architecture Overview

Directory Structure

  • src/fenic/: Main Python source code
    • api/: Public API - Session, DataFrame, Functions, IO
    • core/: 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

  1. Session-Centric Design: All operations flow through Session.get_or_create(). The session manages configuration, execution engine, and resource lifecycle.
  2. Lazy Evaluation: DataFrame operations build logical plans without immediate execution. Execution is triggered by actions like show(), collect(), or count().
  3. 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
  4. Semantic Operators: First-class support for LLM operations through the semantic namespace on DataFrames:
    • semantic.map(), semantic.extract(), semantic.classify()
    • semantic.join(), semantic.group_by(), semantic.reduce()
  5. Backend Abstraction: Supports both local execution (using Polars) and cloud execution (using gRPC). Backend is selected via session configuration.
  6. 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

  1. New DataFrame Operation: Add method to DataFrame class, create corresponding logical plan node
  2. New Semantic Operation: Add to SemanticExtension class in api/dataframe/semantic_extension.py
  3. New Function: Add to appropriate module in api/functions/
  4. New Rust Extension: Implement in rust/src/, expose via PyO3 bindings

Testing Considerations

  • Tests are organized by feature area in tests/
  • Use @pytest.mark.cloud for 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 uv as 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)

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.