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
- Distinctive: line 89
No new runtime dependencies were added without approval.
- Distinctive: line 96
Never add new runtime dependencies without explicit user approval.
- Distinctive: line 97
Never create new top-level folders.
- Very specific: line 98
Never modify sample/ (the demo Excel workbook) without approval.
- Common: line 99
Never commit secrets, API keys, or hardcoded credentials.
- Very specific: line 100
Never run /cleanup in a loop.
- Distinctive: line 101
Never change Greek conventions (vega/rho per 1%, theta/charm per calendar day) without approval.
- Very specific: line 102
Never modify the XML/JSON response schema shape (meta/inputs/outputs) without approval.
- Very specific: line 116
Logging: Use the deskpricer logger only.
- Very specific: line 117
Pricing layer: All public functions in pricing/ raise InvalidInputError or UnsupportedCombinationError.
- Very specific: line 119
Responses: All endpoints return meta + inputs + outputs.
≈ “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.
Files
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
| Layer | Tool | Version |
| Language | Python | 3.12.7 |
| Framework | FastAPI | 0.100+ |
| Validation | Pydantic | v2 |
| Pricing engine | QuantLib | 1.42.1 |
| Server | Uvicorn | 0.23+ |
| Test runner | pytest | 7.4+ |
| Fuzzing | hypothesis | 6.82+ |
| Linter / formatter | ruff | 0.15+ |
| Type checker | mypy | 1.5+ |
| Build | setuptools + pyproject.toml | — |
| Executable | PyInstaller | (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 workbookCommands
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-mcpDefinition of Done
A task is finished when all of these are true:
pytest tests -vpasses (262 tests).ruff check src testsreports zero errors.mypy srcreports zero errors.- No new runtime dependencies were added without approval.
- 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
/cleanupin 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_casefor functions/variables,PascalCasefor classes,UPPER_SNAKEfor module-level constants. - Error handling: Raise
InvalidInputError(400) orUnsupportedCombinationError(422) for known bad inputs. Unexpected exceptions bubble to the catchall handler (500 /PRICING_FAILURE). Never leak raw tracebacks to clients. - Logging: Use the
deskpricerlogger only. Structured JSON viaJSONFormatter. Never useprint()in application code. - Pricing layer: All public functions in
pricing/raiseInvalidInputErrororUnsupportedCombinationError; no raw QuantLib exceptions leak. - QuantLib state: QuantLib pricing runs in worker processes via
ProcessPoolExecutor. Each worker sets its ownql.Settings.instance().evaluationDateinworker.execute_task(). Do not mutate global QuantLib state on the async event-loop thread. - Responses: All endpoints return
meta+inputs+outputs. Portfolio returnsmeta+legs+aggregate. XML is default; JSON viaAccept: application/jsonor?format=json. - Unit basis: All pricing outputs from
/greeks,/impliedvol, and/pnl_attributionare 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/portfolioendpoint, each leg returns unscaled unit Greeks; only theaggregateblock reflectsqty-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.mdverbatim. Do not paraphrase, do not relax constraints, do not chain multiple passes./review— Runpytest 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.
ruffis not in[dev]extras. The update script installs it separately (pip install ruff). Bothruffand the dev tools (pytest,mypy,hypothesis,httpx) install to~/.local/bin, which must be onPATH. The update script handles installation;~/.bashrcadds the path.- Use
python3, notpython. The VM providespython3onPATHbut does not aliaspython. All commands in AGENTS.md that saypythonshould be run aspython3(e.g.python3 -m deskpricer.main). - Starting the server:
python3 -m deskpricer.mainbinds to127.0.0.1:8765by default. Use--port <N>to override. Verify withcurl http://127.0.0.1:8765/v1/health. - Tests use FastAPI's
TestClientin-process — no running server needed forpytest tests -v. - All standard commands (install, run, test, lint, format, typecheck) are listed in the Commands section above.
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.

