{"id":51636864,"url":"https://github.com/adimyth/ai-contract-review","last_synced_at":"2026-07-13T15:02:32.366Z","repository":{"id":368040588,"uuid":"1283288449","full_name":"adimyth/ai-contract-review","owner":"adimyth","description":"AI-powered contract pre-screening - extracts clauses, flags deviations, suggests redlines, and recommends an action in seconds.","archived":false,"fork":false,"pushed_at":"2026-06-28T19:19:17.000Z","size":1311,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-28T21:05:31.898Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://ai-contract-review-f0zh.onrender.com","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/adimyth.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-06-28T18:56:04.000Z","updated_at":"2026-06-28T19:19:21.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/adimyth/ai-contract-review","commit_stats":null,"previous_names":["adimyth/ai-contract-review"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/adimyth/ai-contract-review","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adimyth%2Fai-contract-review","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adimyth%2Fai-contract-review/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adimyth%2Fai-contract-review/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adimyth%2Fai-contract-review/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/adimyth","download_url":"https://codeload.github.com/adimyth/ai-contract-review/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adimyth%2Fai-contract-review/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35426086,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-13T02:00:06.543Z","response_time":119,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-07-13T15:02:31.024Z","updated_at":"2026-07-13T15:02:32.356Z","avatar_url":"https://github.com/adimyth.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Contract Review AI\n\nAI-powered contract pre-screening tool. Upload a PDF or DOCX contract (or pick from the bundled samples), and the AI analyses it against a playbook of standard legal positions — flagging deviations, suggesting redlines, scoring risk, and recommending an action in seconds.\n\nBuilt with FastAPI + Claude / OpenAI + vanilla JS. Stateless — no files are stored after each request.\n\n## How it works\n\nThe review runs as a two-step AI pipeline:\n\n**Step 1 — Extraction**\n\nThe uploaded document is parsed to plain text, then sent to the AI with a forced tool call (`extract_contract`). The model returns structured JSON: contract type, parties, effective date, and every meaningful clause with its verbatim text.\n\n**Step 2 — Analysis (streaming)**\n\nThe extracted clauses are sent to the AI alongside the full playbook. A second forced tool call (`analyse_contract`) produces:\n\n- **Risk level** — Low / Medium / High\n- **Recommended action** — Auto-approve / Fast-track / Full review / Escalate\n- **Executive summary** — plain-English overview for a non-lawyer\n- **Clause-by-clause analysis** — status (Standard / Minor deviation / Non-standard / Missing), severity, issue description, and a suggested redline for every non-standard clause\n- **Auto-approved clauses** — clauses that match the playbook and need no human attention\n\nResults stream to the browser as Server-Sent Events so clause cards appear one-by-one while the analysis is still running.\n\n## API keys and sessions\n\nThere is no backend authentication. API keys are handled entirely client-side:\n\n- On first visit the app prompts for an API key (Anthropic or OpenAI).\n- The key is stored in **`sessionStorage`** — it lives only for the current browser tab and is wiped when the tab is closed. It is never persisted anywhere on the server.\n- Each request sends the key in an `X-Api-Key` header. The backend uses it to construct a per-request AI client and discards it immediately after the response.\n- If no key is provided, the backend returns an error asking the user to supply one.\n\n**Provider detection** is automatic: keys starting with `sk-ant-` route to Anthropic (Claude); any other key routes to OpenAI.\n\n## Running locally\n\nThe frontend is served by FastAPI as static files — there is no separate frontend build step.\n\n```bash\n# 1. Install dependencies\npip install -r requirements.txt\n\n# 2. Start the server\nuvicorn backend.main:app --reload --port 8000\n```\n\nOpen http://localhost:8000. Enter your Anthropic or OpenAI API key when prompted, then upload a contract or click **\"Try a sample\"**.\n\n\n## Bundled sample contracts\n\nAll samples are public, open-source contracts (CC BY 4.0):\n\n| File | Description |\n|------|-------------|\n| `commonpaper_mutual_nda_v1.pdf` | Common Paper Mutual NDA v1.0 |\n| `bonterms_mutual_nda_v1.pdf` | Bonterms Mutual NDA v1.0 |\n| `bonterms_cloud_terms_v1.pdf` | Bonterms Cloud Terms v1.0 — enterprise SaaS agreement |\n| `bonterms_psa_v1.2.pdf` | Bonterms Professional Services Agreement v1.2 |\n\n## Customising the playbook\n\nStandard legal positions live in `backend/playbook.py`. Edit the `STANDARD_POSITIONS` dict there — no other code changes needed. The playbook is read verbatim by the AI prompt and also exposed via `GET /api/playbook` for the in-app modal.\n\n## API surface\n\n```\nPOST /api/review          multipart/form-data (PDF or DOCX, max 10 MB) -\u003e SSE stream\nGET  /api/samples         list bundled sample contracts\nGET  /api/samples/{name}  serve a bundled contract file\nGET  /api/playbook        return playbook rules as JSON\nGET  /                    serve the frontend\n```\n\n## Deployment (Render)\n\n1. Push to GitHub\n2. Create a **Web Service** on Render pointing at the repo — it picks up `render.yaml` automatically\n3. No environment variables needed — keys are supplied by users at runtime\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadimyth%2Fai-contract-review","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fadimyth%2Fai-contract-review","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadimyth%2Fai-contract-review/lists"}