agentleFS
JohnJohnJohnJohnJohnJohnJohnJohn/portall_ws/AGENTS.md

portall_ws

AGENTS.md0 starsChanged 6 months agoMITView on GitHub

Single entry point for any coding agent working on this repo. DeskPricer is a local-only HTTP microservice that prices vanilla European and American equity options and returns Greeks, implied volatility, and PnL attribution. The primary consumer is Excel via WEBSERVICE + FILTERXML; JSON is available for programmatic clients. It is not intended to be run or served as a public/server-style service. Package manager: pip (venv) or uv. Copy-pasteable. Run from repo root. A task is finished when all of these…

  • Installs packages
  • 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,736 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 repositoryOne other file it gives its agents.

The file

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

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

  • ≈1

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈4

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 6

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  • could be automatic: a setting could enforce it
  1. Distinctive:

    No new runtime dependencies were added without approval.

    line 89
  2. Distinctive:

    Never add new runtime dependencies without explicit user approval.

    line 96
  3. Distinctive:

    Never create new top-level folders.

    line 97
  4. Very specific:

    Never modify sample/ (the demo Excel workbook) without approval.

    line 98
  5. Common:

    Never commit secrets, API keys, or hardcoded credentials.

    line 99
  6. Very specific:

    Never run /cleanup in a loop.

    line 100
  7. Distinctive:

    Never change Greek conventions (vega/rho per 1%, theta/charm per calendar day) without approval.

    line 101
  8. Very specific:

    Never modify the XML/JSON response schema shape (meta/inputs/outputs) without approval.

    line 102
  9. Very specific:

    Logging: Use the deskpricer logger only.

    line 116
  10. Very specific:

    Pricing layer: All public functions in pricing/ raise InvalidInputError or UnsupportedCombinationError.

    line 117
  11. Very specific:

    Responses: All endpoints return meta + inputs + outputs.

    line 119

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

DeskPricer — Agent Guide

Single entry point for any coding agent working on this repo.

Project Summary

DeskPricer is a local-only HTTP microservice that prices vanilla European and American equity options and returns Greeks, implied volatility, and PnL attribution. The primary consumer is Excel via WEBSERVICE + FILTERXML; JSON is available for programmatic clients. It is not intended to be run or served as a public/server-style service.

Tech Stack

LayerToolVersion
LanguagePython3.12.7
FrameworkFastAPI0.100+
ValidationPydanticv2
Pricing engineQuantLib1.42.1
ServerUvicorn0.23+
Test runnerpytest7.4+
Fuzzinghypothesis6.82+
Linter / formatterruff0.15+
Type checkermypy1.5+
Buildsetuptools + pyproject.toml—
ExecutablePyInstaller(dev only)

Package manager: pip (venv) or uv.

Directory Map

src/deskpricer/          # Application source
  pricing/                # Pricing engine (BSM fast path, American, IV, cross-greeks)
  worker.py               # Process-pool worker entrypoints
  mcp_server.py           # MCP stdio server (deskpricer-mcp)
  mcp_tools.py            # MCP tool schemas and agent-facing descriptions
  services/               # pricing_service.py orchestration, ql_runtime.py pool
  app.py                  # FastAPI factory, routes, middleware
  schemas.py              # Pydantic request/response models
  errors.py               # Custom exceptions and FastAPI handlers
  responses.py            # XML/JSON serializers, content negotiation
  logging_config.py       # Structured JSON logging
  main.py                 # Uvicorn entrypoint, CLI args

tests/                    # pytest suite (flat, no subfolders)
docs/                     # API reference, Excel guide, architecture
scripts/                  # PyInstaller build, NSSM service install
sample/                   # Demo Excel workbook

Commands

Copy-pasteable. Run from repo root.

# Install (runtime + dev)
pip install -e ".[dev]"

# Run
python -m deskpricer.main

# Run on custom port
python -m deskpricer.main --port 9000

# Test
pytest tests -v

# Lint
ruff check src tests

# Format
ruff format src tests

# Typecheck
mypy src

# Build standalone executable
python scripts/build_executable.py

# Run MCP server (stdio, for AI agents)
deskpricer-mcp

Definition of Done

A task is finished when all of these are true:

  1. pytest tests -v passes (262 tests).
  2. ruff check src tests reports zero errors.
  3. mypy src reports zero errors.
  4. No new runtime dependencies were added without approval.
  5. Application code net line count did not increase (docs/tests/config exempt).

Boundaries

Never do

  • Never add new runtime dependencies without explicit user approval.
  • Never create new top-level folders.
  • Never modify sample/ (the demo Excel workbook) without approval.
  • Never commit secrets, API keys, or hardcoded credentials.
  • Never run /cleanup in a loop. One invocation = one pass. If the user says "keep going until clean," reply with the tests/lint/typecheck status and stop.
  • Never change Greek conventions (vega/rho per 1%, theta/charm per calendar day) without approval.
  • Never modify the XML/JSON response schema shape (meta/inputs/outputs) without approval.

Ask first

  • Adding new HTTP endpoints.
  • Changing the PnL attribution formula or adding new attribution buckets.
  • Adding database persistence or stateful storage.
  • Changing the default pricing engine or day-count convention.
  • Bumping minimum Python or QuantLib versions.

Conventions

  • Naming: snake_case for functions/variables, PascalCase for classes, UPPER_SNAKE for module-level constants.
  • Error handling: Raise InvalidInputError (400) or UnsupportedCombinationError (422) for known bad inputs. Unexpected exceptions bubble to the catchall handler (500 / PRICING_FAILURE). Never leak raw tracebacks to clients.
  • Logging: Use the deskpricer logger only. Structured JSON via JSONFormatter. Never use print() in application code.
  • Pricing layer: All public functions in pricing/ raise InvalidInputError or UnsupportedCombinationError; no raw QuantLib exceptions leak.
  • QuantLib state: QuantLib pricing runs in worker processes via ProcessPoolExecutor. Each worker sets its own ql.Settings.instance().evaluationDate in worker.execute_task(). Do not mutate global QuantLib state on the async event-loop thread.
  • Responses: All endpoints return meta + inputs + outputs. Portfolio returns meta + legs + aggregate. XML is default; JSON via Accept: application/json or ?format=json.
  • Unit basis: All pricing outputs from /greeks, /impliedvol, and /pnl_attribution are per unit (qty = 1). The pricer prices one contract at a time and does not model position sizing. Quantity scaling is the caller's responsibility. In the /portfolio endpoint, each leg returns unscaled unit Greeks; only the aggregate block reflects qty-weighted sums.

Pointers

  • API contract and examples: docs/api.md
  • Excel integration guide: docs/excel_usage.md
  • MCP agent setup: docs/mcp_quickstart.md
  • Module boundaries and data flow: docs/architecture.md
  • Behavioral guidelines: .cursor/rules/karpathy-behavioral-guidelines.mdc

Commands the agent can invoke

  • /cleanup — Execute the procedure defined in .agent/commands/cleanup.md verbatim. Do not paraphrase, do not relax constraints, do not chain multiple passes.
  • /review — Run pytest tests -v, ruff check src tests, mypy src, and report the full results.

Cursor Cloud specific instructions

  • No external services required. DeskPricer is fully self-contained — no database, Docker, Redis, or message queue. All state is in-memory per-request.
  • ruff is not in [dev] extras. The update script installs it separately (pip install ruff). Both ruff and the dev tools (pytest, mypy, hypothesis, httpx) install to ~/.local/bin, which must be on PATH. The update script handles installation; ~/.bashrc adds the path.
  • Use python3, not python. The VM provides python3 on PATH but does not alias python. All commands in AGENTS.md that say python should be run as python3 (e.g. python3 -m deskpricer.main).
  • Starting the server: python3 -m deskpricer.main binds to 127.0.0.1:8765 by default. Use --port <N> to override. Verify with curl http://127.0.0.1:8765/v1/health.
  • Tests use FastAPI's TestClient in-process — no running server needed for pytest tests -v.
  • All standard commands (install, run, test, lint, format, typecheck) are listed in the Commands section above.

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.