fenic / rules
Cursor rule673 starsChanged 5 months agoApache-2.0View on GitHub
fenic (import fenic as fc) — namespace/import rules, semantic-operator calling conventions, and silent-failure traps for writing correct fenic code. After edits, run `fenic check`.
In this repository5 other files it gives its agents.
- AGENTS.mdAGENTS.md
- docs/agents.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- fenic-mechanicsSkill
- update-fenic-skillSkill
The file
Files
---
description: fenic (import fenic as fc) — namespace/import rules, semantic-operator calling conventions, and silent-failure traps for writing correct fenic code. After edits, run `fenic check`.
globs: **/*.py
alwaysApply: false
---
# Writing fenic
fenic is a PySpark-style **semantic DataFrame** library (`import fenic as fc`).
You likely know its DataFrame surface; below are the mechanics that DON'T match
PySpark/pandas intuition. (This mirrors `AGENTS.md`; full detail lives in the
`.claude/skills/fenic-mechanics/` skill.)
> After writing or editing a fenic pipeline, run **`fenic check <file>`** — a
> static lint (no execution) that flags namespace/import mistakes (`fenic.functions`,
> `fc.array` vs `fc.arr`, `fc.explode`, …).
## Must-knows
- `import fenic as fc`; everything is flat on `fc`. There is **no
`fenic.functions`**, no `fenic.api.types`, and no unified `OpenAIModelConfig`.
- Function namespaces: `fc.text` / `fc.json` / `fc.markdown` / `fc.semantic` /
`fc.embedding` / `fc.dt`, and **`fc.arr`** for array ops (`fc.array` is the
array-literal *constructor*, not the ops namespace).
- `explode` / `unnest` are **DataFrame methods** — `df.explode("c")`,
`df.unnest("c")` — never `fc.explode`.
- Language vs embedding models are **separate classes** (`fc.OpenAILanguageModel`
vs `fc.OpenAIEmbeddingModel`) in separate config keys (`language_models` /
`embedding_models`); `default_language_model` / `default_embedding_model` are
required when more than one is registered. Anthropic uses split
`input_tpm` / `output_tpm`, not a single `tpm`.
- Semantic templates use Jinja2 `{{ var }}` + matching column kwargs:
`fc.semantic.predicate("... {{ x }} ...", x=fc.col("x"))`. `parse_pdf` is
**`fc.semantic.parse_pdf`** (under `semantic`, not `markdown`).
## Traps `fenic check` can't catch — get these right by hand
- `fc.json.jq(col, q)` returns an **array** → `.get_item(0)` before a scalar `.cast`.
- A semantic template with **single braces** `{x}` is not interpolated (silent).
- `fc.dt.datediff(end, start)` returns `end - start` (argument order matters).
- `fc.dt.to_timestamp(col, fmt)` takes **Spark/Java** patterns (`yyyy-MM-dd HH:mm:ss`),
**not** Python `%`-tokens.
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.

