agentleFS
gali-ai-engineergali-ai-engineer/tender-copilot/CLAUDE.md

tender-copilot

CLAUDE.md0 starsChanged 2 months agoMITView on GitHub

Context for Claude Code. Read this before making changes. Tender Copilot reads an Indian government tender (GeM, CPPP, state portals): the main bid PDF plus attachments (PDF / CSV / XLSX). It produces a report for ONE firm: deadline status, how the bid works, every eligibility criterion checked against the firm's profile, red flags and documents to upload. - Business model: an admin-run bid desk first (an admin reviews every report before release), then firms self-serve. - The engine (copilot/)…

  • Installs packages

The file

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

5 rules. About 0 are common, 3 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    keep the "no null" convention ("" or 0 for missing values).

    line 66
  2. Distinctive:

    keep the structured-output schemas small (they are split into TenderOverview, BidFacts and TenderRequirements because one big schema was …

    line 67
  3. Very specific:

    update samples/fixtures/*.json and the tests in the same change.

    line 69
  4. Very specific:

    Every criterion keeps a verbatim source_quote and page.

    line 72
  5. Distinctive:

    no real firm data in the repo or in tests.

    line 82

≈ “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: Tender Copilot

Context for Claude Code. Read this before making changes.

What this is

Tender Copilot reads an Indian government tender (GeM, CPPP, state portals): the main bid PDF plus attachments (PDF / CSV / XLSX). It produces a report for ONE firm: deadline status, how the bid works, every eligibility criterion checked against the firm's profile, red flags and documents to upload.

  • Business model: an admin-run bid desk first (an admin reviews every report before release), then firms self-serve.
  • The engine (copilot/) works and has been tested on 7 real GeM bids. It is the source of truth for tender logic.
  • The full architecture doc is in Claude Docs: "Tender Copilot: Architecture and Tech Stack". This file summarises it.

Current layout (before the monorepo move)

copilot/            engine: pdf_reader, extractor, grounding, deadlines, matcher, report, schema, llm
cli.py              python cli.py <bid.pdf> [attachments...] --profile <firm.yaml> [--mock samples/fixtures]
app.py              old Streamlit demo (to be replaced by apps/web)
firm_profile.*.yaml example firm profiles
samples/            fictional sample tender + mock fixtures for offline tests
tests/              pytest, offline (MockLLM), no API key needed

Target architecture

packages/copilot/   the engine, moved unchanged
apps/api/           FastAPI: auth (Supabase JWT), uploads, enqueue jobs, serve reports
apps/worker/        claims jobs from Postgres (FOR UPDATE SKIP LOCKED): analyse_bid, match_firm, export_pdf
apps/web/           Next.js (App Router, TypeScript, Tailwind, shadcn/ui): admin console + firm portal
supabase/migrations SQL schema + row-level security
evals/golden/       the 7 tested bids + expected checks

Key design: a bid's analysis (extract + ground + deadline) is firm-independent and cached per bid and file hash in bid_analyses. A report = one firm profile version matched against one analysis.

Core tables: firms, users, memberships, firm_profiles (versioned JSONB), firm_documents, bids, bid_files, bid_analyses, reports (draft / in_review / released), report_feedback, jobs, llm_runs, audit_log.

Stack: Supabase (Postgres, Auth with phone OTP, Storage) in ap-south-1. Vercel for web; Railway or Render for the API and worker. Anthropic API (model from the ANTHROPIC_MODEL env var). Sentry. Resend email. Razorpay and WhatsApp come later.

Commands (Windows PowerShell)

.\.venv\Scripts\Activate.ps1                     # Set-ExecutionPolicy -Scope Process Bypass if blocked
pip install -r requirements.txt
python -m pytest -q                              # offline tests, must pass before any commit
python cli.py samples\sample_tender.pdf --profile firm_profile.example.yaml --mock samples\fixtures
python cli.py tenders\<bid>.pdf tenders\<attachment> --profile firm_profile.hyd.yaml   # real API call

Rules

  1. Tender logic lives only in the engine. The API and web never re-implement eligibility rules; they call the engine and display its output.
  2. Schema changes in copilot/schema.py must:
    • keep the "no null" convention ("" or 0 for missing values);
    • keep the structured-output schemas small (they are split into TenderOverview, BidFacts and TenderRequirements because one big schema was rejected as too complex);
    • update samples/fixtures/*.json and the tests in the same change.
  3. Facts that can be computed in code (dates, days left, verdict guardrails) are computed in code, not by the model. See deadlines.py and the guardrails in matcher.py.
  4. Every criterion keeps a verbatim source_quote and page. Grounding marks unverified quotes; never remove that check.
  5. Prompt changes: run the golden set (evals/golden/, once it exists) and compare caught items before and after. Don't merge a change that drops caught items.
  6. Payable items (EMD, ePBG, CMC bank guarantee) are never "not_met" only because a reseller cannot claim an exemption.
  7. Security:
    • row-level security on every firm-owned table;
    • storage paths firm/<firm_id>/... in private buckets with signed URLs;
    • API keys never reach the browser;
    • no real firm data in the repo or in tests.
  8. Reports stay in draft / in_review until an admin releases them (MVP).
  9. Small commits, one feature per branch, plan mode before large changes.

Known engine behaviour worth keeping

  • GeM bilingual PDFs: Hindi glyphs are stripped by clean_text (25-37% fewer characters).
  • Auto-extension can keep a "closed" bid open. deadline_status reports the latest possible end date.
  • Make in India: the consequence of a missing OEM local-content certificate differs per bid (bid_rejected vs loses_preference). Read it from each bid's wording.
  • MSE relaxation may cover experience only, not turnover. Read it from the numbered clauses, not the label.
  • "Possible spec error" flags rely on model knowledge and can be wrong. Show them as possible, never as certain.

First tasks (in order)

  1. Move to the monorepo layout above; keep cli.py working; all tests green.
  2. Supabase migrations: tables, RLS policies, storage buckets.
  3. FastAPI: upload bid -> create jobs; worker runs analyse_bid + match_firm and stores the results.
  4. Next.js admin: firm list and profile form, bid upload, report view with edit and release.
  5. Firm portal: OTP login, view released reports, edit profile (creates a new version).

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.