Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .agents/rules/antigravity-rtk-rules.md
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
# RTK - Rust Token Killer (Google Antigravity)

**Usage**: Token-optimized CLI proxy for shell commands.

## Rule

Always prefix shell commands with `rtk` to minimize token consumption.

Examples:

```bash
rtk git status
rtk cargo test
rtk ls src/
rtk grep "pattern" src/
rtk find "*.rs" .
rtk docker ps
rtk gh pr list
```

## Meta Commands

```bash
rtk gain # Show token savings
rtk gain --history # Command history with savings
rtk discover # Find missed RTK opportunities
rtk proxy <cmd> # Run raw (no filtering, for debugging)
```

## Why

RTK filters and compresses command output before it reaches the LLM context, saving 60-90% tokens on common operations. Always use `rtk <cmd>` instead of raw commands.
11 changes: 11 additions & 0 deletions .coveragerc
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
[run]
branch = True
source = affidiff
omit = */__init__.py

[paths]
source =
src/

[report]
show_missing = True
22 changes: 21 additions & 1 deletion .github/workflows/workflow.yaml
Original file line numberDiff line numberDiff line change
Expand Up@@ -30,9 +30,29 @@ jobs:
- name: Run test suite
run: uv run pytest

code-quality:
name: Code quality checks
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v6
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
enable-cache: true
cache-dependency-glob: "uv.lock"
- name: Setup Python
uses: actions/setup-python@v6
with:
python-version-file: ".python-version"
- name: Install dependencies
run: uv sync --group dev
- name: Run pre-commit
run: uv run prek run -v --show-diff-on-failure --all-files

publish:
name: Build and publish wheels
needs: [ test ]
needs: [ test, code-quality ]
runs-on: ubuntu-latest
environment:
name: pypi
Expand Down
28 changes: 28 additions & 0 deletions .pre-commit-config.yaml
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
repos:
- repo: builtin
hooks:
- id: trailing-whitespace
- id: check-added-large-files
- id: end-of-file-fixer
- id: forbid-new-submodules
- id: mixed-line-ending
- id: check-json
- id: pretty-format-json
args: ["--autofix"]
- id: check-yaml
- id: detect-private-key

- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.16.0
hooks:
- id: ruff
args: [ --config, pyproject.toml, --fix, --exit-non-zero-on-fix ]
types_or: [ python ]
- id: ruff-format
args: [ --config, pyproject.toml ]
types_or: [ python ]

- repo: https://github.com/astral-sh/ty-pre-commit
rev: v0.0.64
hooks:
- id: ty
13 changes: 13 additions & 0 deletions .rtk/filters.toml
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
# Project-local RTK filters — commit this file with your repo.
# Filters here override user-global and built-in filters.
# Docs: https://github.com/rtk-ai/rtk#custom-filters
schema_version = 1

# Example: suppress build noise from a custom tool
# [filters.my-tool]
# description = "Compact my-tool output"
# match_command = "^my-tool\\s+build"
# strip_ansi = true
# strip_lines_matching = ["^\\s*$", "^Downloading", "^Installing"]
# max_lines = 30
# on_empty = "my-tool: ok"
124 changes: 124 additions & 0 deletions AGENTS.md
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
# Project rules

- Each class should expose only those methods and attributes that are used in the other classes/functions. All other attributes and methods should be private (_method). Example:

```python
class A:
def __init__(self):
self._x = 1 # should be private
self.y = 2 # should be public

def _private_method(self):
pass # should be private

def public_method(self):
pass # should be public
```

- Unit tests are not allowed to access private attribute/methods of classes.

- Use uv to run python commands, e.g.

```shell
uv run pytest
```

- Run prek on all files before each commit (stage all the files but do not commit):

```shell
uv run prek run -v --show-diff-on-failure --all-files
```


# DOX framework

- DOX is highly performant AGENTS.md hierarchy installed here
- Agent must follow DOX instructions across any edits

## Core Contract

- AGENTS.md files are binding work contracts for their subtrees
- Work products, source materials, instructions, records, assets, and durable docs must stay understandable from the nearest applicable AGENTS.md plus every parent AGENTS.md above it

## Read Before Editing

1. Read the root AGENTS.md
2. Identify every file or folder you expect to touch
3. Walk from the repository root to each target path
4. Read every AGENTS.md found along each route
5. If a parent AGENTS.md lists a child AGENTS.md whose scope contains the path, read that child and continue from there
6. Use the nearest AGENTS.md as the local contract and parent docs for repo-wide rules
7. If docs conflict, the closer doc controls local work details, but no child doc may weaken DOX

Do not rely on memory. Re-read the applicable DOX chain in the current session before editing.

## Update After Editing

Every meaningful change requires a DOX pass before the task is done.

Update the closest owning AGENTS.md when a change affects:

- purpose, scope, ownership, or responsibilities
- durable structure, contracts, workflows, or operating rules
- required inputs, outputs, permissions, constraints, side effects, or artifacts
- user preferences about behavior, communication, process, organization, or quality
- AGENTS.md creation, deletion, move, rename, or index contents

Update parent docs when parent-level structure, ownership, workflow, or child index changes. Update child docs when parent changes alter local rules. Remove stale or contradictory text immediately. Small edits that do not change behavior or contracts may leave docs unchanged, but the DOX pass still must happen.

## Hierarchy

- Root AGENTS.md is the DOX rail: project-wide instructions, global preferences, durable workflow rules, and the top-level Child DOX Index
- Child AGENTS.md files own domain-specific instructions and their own Child DOX Index
- Each parent explains what its direct children cover and what stays owned by the parent
- The closer a doc is to the work, the more specific and practical it must be

## Child Doc Shape

- Create a child AGENTS.md when a folder becomes a durable boundary with its own purpose, rules, responsibilities, workflow, materials, or quality standards
- Work Guidance must reflect the current standards of the project or user instructions; if there are no specific standards or instructions yet, leave it empty
- Verification must reflect an existing check; if no verification framework exists yet, leave it empty and update it when one exists

Default section order:
- Purpose
- Ownership
- Local Contracts
- Work Guidance
- Verification
- Child DOX Index

## Style

- Keep docs concise, current, and operational
- Document stable contracts, not diary entries
- Put broad rules in parent docs and concrete details in child docs
- Prefer direct bullets with explicit names
- Do not duplicate rules across many files unless each scope needs a local version
- Delete stale notes instead of explaining history
- Trim obvious statements, repeated rules, misplaced detail, and warnings for risks that no longer exist

## Closeout

1. Re-check changed paths against the DOX chain
2. Update nearest owning docs and any affected parents or children
3. Refresh every affected Child DOX Index
4. Remove stale or contradictory text
5. Run existing verification when relevant
6. Report any docs intentionally left unchanged and why

## User Preferences

When the user requests a durable behavior change, record it here or in the relevant child AGENTS.md

## Child DOX Index

- `src/AGENTS.md` - Production source code root containing affidiff package
- `src/affidiff/AGENTS.md` - Core affine diffusion models, parameter classes, moments, and Cython simulation helpers
- `tests/AGENTS.md` - Test suite covering affine diffusion models, parameter classes, moments estimation, and simulation utilities
- `examples/AGENTS.md` - Runnable usage scripts for affine diffusions models and simulation/estimation workflows
- `docs/AGENTS.md` - Sphinx documentation source files and configuration

**Root-owned files** (no child DOX needed):
- `.github/` - CI/CD workflows
- Configuration files: `pyproject.toml`, `.pre-commit-config.yaml`, `.travis.yml`, `.coveragerc`, `.gitignore`, `setup.py`
- Documentation & math assets: `README.md`, `CHANGELOG.md`, `LICENSE.md`, `models.lyx`, `models.pdf`
26 changes: 26 additions & 0 deletions docs/AGENTS.md
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
# Purpose

`docs/` contains Sphinx configuration, build instructions, and source files for generating the documentation website and API reference for `affidiff`.

# Ownership

Owns Sphinx documentation source files and build configurations:
- Build automation Makefile (`docs/Makefile`)
- Documentation sources (`docs/source/`)

# Local Contracts

- Docstrings across production modules must adhere to standard NumPy format (as configured in `pyproject.toml` under `tool.ruff.lint.pydocstyle`).
- Sphinx build files must compile without errors or missing module references.

# Work Guidance

- Ensure new public functions, classes, and parameter types added to `affidiff` are documented and visible in the Sphinx source index.

# Verification

- Build documentation via `Makefile` inside `docs/` directory when Sphinx is installed.

# Child DOX Index

None (leaf boundary).
Loading