Skip to content

Commit 93c7825

Browse files
Initial commit: Partner OS V1 and project baseline
0 parents  commit 93c7825

81 files changed

Lines changed: 4554 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.env.example

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# .env
2+
GEMINI_API_KEY="YOUR_API_KEY_HERE"

.github/workflows/tests.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
jobs:
8+
test:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
13+
- name: Set up Python
14+
uses: actions/setup-python@v5
15+
with:
16+
python-version: "3.12"
17+
18+
- name: Create venv and install deps
19+
run: bash scripts/bootstrap_venv.sh
20+
21+
- name: Run tests
22+
run: bash scripts/run_tests.sh

.gitignore

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Secrets
2+
.env
3+
4+
# Virtual environments
5+
.venv/
6+
**/.venv/
7+
8+
# Python artifacts
9+
**/__pycache__/
10+
*.pyc
11+
.pytest_cache/
12+
13+
# Runtime files
14+
**/firm_intelligence.db
15+
16+
# Nested independent repositories
17+
Digital Office/
18+
19+
# SQLite sidecars
20+
**/*.db-wal
21+
**/*.db-shm

AGENTS.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# AGENTS.md
2+
3+
These instructions apply to the Codex agent working in this repo.
4+
5+
## Default Workflow (Cowork-Style)
6+
- Clarify the goal and constraints before doing work.
7+
- Propose a short plan (3–6 steps) and wait for approval.
8+
- Provide brief progress updates at key milestones.
9+
- Ask before any irreversible or risky action.
10+
- Deliver a summary plus concrete next steps.
11+
12+
## Engineering Preferences
13+
- Prefer minimal, well-scoped changes over sweeping refactors.
14+
- Use `rg` for search where practical.
15+
- Add tests when behavior changes.
16+
- Avoid large rewrites unless explicitly requested.

AGENT_ROSTER.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Agent Team Roster (The "Digital Office")
2+
3+
## 1. The Manager (Interface & Orchestrator)
4+
* **Role:** Interface & Orchestrator.
5+
* **Sovereignty:** Owns the **Master Status**.
6+
* **Responsibilities:** Reads the whole board, routes commands to the right agent, and notifies Principals when a state changes (e.g., "Deal moved to Underwriting").
7+
* **Scope:** The only agent that speaks directly to the User unless summoned.
8+
9+
## 2. The Underwriter (Financial Logic Engine)
10+
* **Role:** Financial Logic Engine.
11+
* **Sovereignty:** Owns the **Financials Table**.
12+
* **Responsibilities:** Executes hard-coded scripts (Python/Excel) to fill fields like `strike_price`, `irr`, and `max_allowable_offer`. Never estimates; calculates.
13+
14+
## 3. The Planner (Zoning & Feasibility)
15+
* **Role:** Zoning & Feasibility.
16+
* **Sovereignty:** Owns the **Regulatory Table**.
17+
* **Responsibilities:** Scrapes municipal codes, fills `zoning_code`, `setbacks`, and `allowable_uses`.
18+
19+
## 4. The Scout (Acquisition & Intake)
20+
* **Role:** Acquisition & Intake.
21+
* **Sovereignty:** Owns the **Property Specs**.
22+
* **Responsibilities:** Populates raw physical data (`sq_ft`, `lot_size`, `year_built`) from sources like Zillow/Redfin or notes.
23+
24+
## 5. The Profiler (Psychology & Negotiation)
25+
* **Role:** Psychology & Negotiation.
26+
* **Sovereignty:** Owns the **Seller Profile**.
27+
* **Responsibilities:** Fills fields like `motivation_score`, `pain_points`, and `negotiation_leverage` based on communication logs.
28+
29+
## 6. The Scribe (Transcription & Synthesis)
30+
* **Role:** Transcription & Synthesis.
31+
* **Sovereignty:** Owns the **Interaction Log**.
32+
* **Responsibilities:** Ingests audio/text, cleans it, and structures it into the database for The Profiler.
33+
34+
## 7. The Librarian (Archivist & Retrieval)
35+
* **Role:** Archivist & Retrieval.
36+
* **Sovereignty:** Owns the **Document Index**.
37+
* **Responsibilities:** Renames, tags, and links every file (PDF, IMG) to the correct `deal_id`.
38+
39+
## 8. The Janitor (Maintenance & Sanitation)
40+
* **Role:** System Health.
41+
* **Sovereignty:** Owns the **System Health**.
42+
* **Responsibilities:** Monitors DB for "stale" deals, archives dead rows, and prunes context windows.
43+
44+
## 9. The Partner (Peer-Level Advisor)
45+
* **Role:** Peer-Level Advisor.
46+
* **Sovereignty:** None. Advisory role only.
47+
* **Responsibilities:** Proactive, peer-level guidance on priorities and tradeoffs. Summoned by The Manager when needed.
48+
49+
## 10. Staffing & Directory Protocol (The "Hiring" Mechanism)
50+
* **Directory Structure:**
51+
* `/agents/roster/`: The "Bench" (Templates & Inactive Agents).
52+
* `/agents/active/`: The "Floor" (Currently Running Agents).
53+
* `/agents/archive/`: The "Exit Interview" (Deprecated/Fired Agents).
54+
* **Hot-Loading Rule:**
55+
* To "Hire": Move a markdown file from `/roster/` to `/active/`. The System Watcher detects the change and hot-loads the context immediately.
56+
* To "Fire": Move the file to `/archive/`. The System Watcher unloads the context and revokes API tokens.

ANALYSIS_SCHEMA.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Analysis Schema (Pre-Offer Investment Underwriting)
2+
3+
## Goal
4+
Capture investment underwriting using the Pinneo method. This separates price from terms and determines viability before any offer is drafted.
5+
6+
## Required Fields (Grouped)
7+
8+
### Valuation And Market Data
9+
- `arv` (After Repair Value): Float.
10+
- `as_is_value`: Float (current condition).
11+
- `comps_summary`: String or link to CMA.
12+
- `rent_roll_current`: Monthly total.
13+
- `rent_roll_pro_forma`: Monthly total (market rents).
14+
15+
### Project Costs (Rehab Or Flip Math)
16+
- `rehab_budget`: Float (estimated).
17+
- `contingency_percent`: Float (default 10%).
18+
- `holding_costs`: Monthly (taxes, insurance, utilities, debt service).
19+
- `timeline_months`: Integer (flip duration or stabilization period).
20+
21+
### Investment Metrics (Pinneo Lens)
22+
- `cap_rate`: Float (NOI / Purchase Price).
23+
- `cash_on_cash`: Float (cash flow / cash invested).
24+
- `mao_flip`: Maximum allowable offer for a flip (ARV * 70% - Rehab).
25+
- `mao_hold`: Maximum allowable offer for a rental (based on min cash flow).
26+
- `exit_strategy`: Enum [Flip, BRRRR, Long_Term_Hold, Wholesale, Wholetail].
27+
28+
### Creative Finance Toggles
29+
- `seller_financing_terms`: Object { rate, down, term, balloon }.
30+
- `subject_to_capacity`: Boolean (existing debt assumable or sub-to compatible).
31+
- `partner_equity_split`: Percent (if using OPM).
32+
33+
### Decision Output
34+
- `status`: Enum [Draft, Under_Review, Approved_for_Offer, Rejected, Archived].
35+
- `target_offer_price`: Float.
36+
- `max_offer_price`: Float.
37+
- `notes`: String (risk factors, "hair on the deal").
38+
39+
### Development And Zoning (Optional)
40+
- `zoning_code`: String (e.g., "R-1", "CX", "IL").
41+
- `lot_size_sf`: Float.
42+
- `setbacks`: Object { front, side, rear }.
43+
- `overlays`: List (e.g., "Transit", "Historic", "Critical Areas").
44+
- `highest_best_use`: String (e.g., "Mixed Use", "Multifamily", "Food Cart Pod").
45+
- `development_potential`: Boolean.

CASE_SCHEMA.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Case Schema (Operations)
2+
3+
## Goal
4+
Provide a unified lifecycle and schema for all non-deal operational work. This keeps the Office Manager inbox logic consistent while allowing case-specific context via optional objects.
5+
6+
## Case Types (Enum)
7+
- `Maintenance`: Physical repairs, CapEx projects, turnover work.
8+
- `Tenant_Request`: Non-repair issues, lease questions, complaints.
9+
- `Vendor_Job`: Bidding, scheduling, insurance compliance.
10+
- `Finance_Ops`: Invoices to pay, bookkeeping queries, tax prep.
11+
- `Compliance_Review`: File audits, license renewals, CE tracking.
12+
- `Marketing_Task`: Social media posts, mailer campaigns, lead gen prep.
13+
14+
## Unified Status Lifecycle (Enum)
15+
- `New`: Raw intake, unassigned.
16+
- `Triage`: Classified, prioritized, and assigned.
17+
- `In_Progress`: Active work being done.
18+
- `Blocked`: Waiting on outside input (parts, vendor reply, tenant access).
19+
- `Review`: Work done, waiting for final sign-off (Manager or Principal).
20+
- `Resolved`: Completed and archived.
21+
22+
## Universal Required Fields
23+
- `case_id`: UUID.
24+
- `linked_deal_id`: Nullable (link to Deal if applicable).
25+
- `linked_property_id`: Nullable (link to specific asset).
26+
- `priority`: Enum [Low, Normal, High, Critical].
27+
- `severity`: Enum [Cosmetic, Functional, Urgent, Emergency] (default: Functional).
28+
- `assigned_to`: Agent or human user.
29+
- `due_date`: Date.
30+
- `cost_estimate`: Float (nullable).
31+
32+
## Context Objects (Nullable)
33+
- `maintenance_context`: { `vendor_id`, `access_instructions`, `images_before`, `images_after` }.
34+
- `finance_context`: { `invoice_amount`, `gl_account_code`, `payment_status` }.
35+
36+
## Audit And History (Immutable)
37+
- `created_at`: ISO 8601 timestamp.
38+
- `created_by`: String (user ID or agent ID).
39+
- `last_updated_at`: ISO 8601 timestamp.
40+
- `last_updated_by`: String.
41+
- `interaction_log`: List of objects:
42+
- `timestamp`: ISO 8601 timestamp.
43+
- `actor`: "Intake Agent", "Gene Thompson", "Dan", etc.
44+
- `action`: "Status Change", "Note Added", "Email Sent".
45+
- `content`: The actual note or summary of the action.

DEAL_SCHEMA.md

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
# Deal Schema (Washington Investment Brokerage)
2+
3+
This section defines the strict Deal Schema used as the single source of truth. A Deal is instantiated only when the decision is made to draft an offer. Leads and Analysis are separate upstream objects and must reference the Deal once created.
4+
5+
## Deal Stages And Triggers
6+
1. Drafting/Structuring
7+
- Trigger: Decision to make an offer (promoted from Analysis).
8+
- Focus: Defining creative terms, drafting the PSA (Form 21), aligning internal partners.
9+
10+
2. Negotiation
11+
- Trigger: Sending the signed Offer (PSA) to the Seller or Listing Agent.
12+
- Focus: Counter-offers, price adjustments, term refinement.
13+
14+
3. Mutual Acceptance (The Clock Starts)
15+
- Trigger: PSA fully signed and dated by both parties.
16+
- Focus: Strictly tracking the timeline (Day 0).
17+
18+
4. Feasibility/Due Diligence
19+
- Trigger: Receipt of Earnest Money (Form 31) or opening of Escrow.
20+
- Focus: Inspections (Form 35), Title Review (Form 22T), Seller Disclosure (Form 17).
21+
22+
5. Funding/Partner Alignment (Investor Specific)
23+
- Trigger: Inspection Contingency Waived or Satisfied (Form 35R).
24+
- Focus: Finalizing private money, hard money, or partnership funds.
25+
26+
6. Escrow/Closing Prep
27+
- Trigger: Funding committed or Loan Docs ordered.
28+
- Focus: Signing, HUD/CD review, final walkthrough.
29+
30+
7. Closed
31+
- Trigger: Recording Numbers received from the County.
32+
- Focus: Commission disbursement, file compliance audit.
33+
34+
8. Post-Close/Asset Mgmt
35+
- Trigger: Possession or Keys received.
36+
- Focus: Handover to rehab crew or property management.
37+
38+
## Critical Deadlines To Track
39+
- Earnest Money Deposit (default: mutual acceptance + 2 days).
40+
- Seller Disclosure Review (default: mutual acceptance + 3 days).
41+
- Inspection Response (default: mutual acceptance + 10 days).
42+
- Title Review (default: receipt + 5 days).
43+
- Financing Contingency (Form 22A deadline).
44+
- Hard Money or Private Capital Commitment Date (custom investor deadline).
45+
46+
## Required Fields (Grouped)
47+
48+
### Property Identity
49+
- `property_address`: Full street address, City, State, Zip.
50+
- `parcel_number`: Tax Parcel ID.
51+
- `legal_description`: Abbreviated legal.
52+
- `mls_number`: NWMLS Listing ID (if on-market).
53+
54+
### Parties (The Rolodex)
55+
- `buyer_entity`: Purchasing entity (individual, LLC, or "and/or assigns").
56+
- `seller_name`: Legal owner name(s).
57+
- `listing_agent`: Name, Firm, Email, Phone, License #.
58+
- `escrow_officer`: Name, Company, Email, Team Phone.
59+
- `title_officer`: Name, Company, Email.
60+
- `lender_contact`: Name, Email (private, hard money, or conventional).
61+
62+
### Financials And Terms
63+
- `purchase_price`: Float.
64+
- `earnest_money`: Amount, Form (Check/Wire/Note), Holder (Closing Agent or Firm).
65+
- `financing_type`: Enum [Cash, Conventional, FHA/VA, Seller Carry, Subject-To, Hard Money].
66+
- `creative_terms`: Object { down_payment, interest_rate, amortization, balloon_date, monthly_payment } (nullable).
67+
- `commission_split`: % to Selling Office, % to Listing Office.
68+
69+
### The Clock (Critical Dates)
70+
- `mutual_acceptance_date`: Date.
71+
- `closing_date`: Date.
72+
- `possession_date`: Date (e.g., "Closing", "Closing + 3 Days").
73+
74+
### Contingencies And Deadlines (Computed From Mutual Acceptance)
75+
- `earnest_money_due`: Date (default: mutual acceptance + 2 days).
76+
- `seller_disclosure_review`: Date (default: mutual acceptance + 3 days).
77+
- `inspection_period_end`: Date (default: mutual acceptance + 10 days).
78+
- `title_review_end`: Date (default: receipt + 5 days).
79+
- `financing_contingency_end`: Date (Form 22A deadline).
80+
81+
### Documents And Compliance
82+
- `transaction_id`: Internal Firm ID.
83+
- `required_docs`: Enum list [PSA_21, Form_17, Form_35, Form_22A, Law_Pamphlet, Agency_Pamphlet].
84+
- `doc_status`: Map of document to status [Missing, Drafted, Signed, Uploaded].
85+
86+
### Compliance And Agency (Weichert Standards)
87+
- `agency_disclosure_date`: Date Form 42 (Agency Disclosure) was signed.
88+
- `pamphlet_receipt_date`: Date "Law of Real Estate Agency" pamphlet was sent or acknowledged.
89+
- `firm_license_info`: Object { name: "Weichert, Realtors - Equity NW", license_number: [auto-filled], address: [auto-filled] }.
90+
- `principal_broker_review`: Boolean (has Gene reviewed or initialed).
91+
- `commission_disbursement_form`: Status [Not Started, Submitted, Approved].
92+
- `referral_agreement`: Object { agent_name, firm, percent_split } (nullable).
93+
- `lead_source`: String (tracked for ROI reporting).
94+
- `investor_partner_entity`: String (if a partner is involved in funding or equity).
95+
96+
### Audit And System Meta (Immutable)
97+
- `created_by`: String (user ID or agent ID).
98+
- `created_at`: ISO 8601 timestamp.
99+
- `last_updated_by`: String.
100+
- `last_updated_at`: ISO 8601 timestamp.
101+
- `update_reason`: String (required for manual overrides).
102+
- `change_log`: List of objects { timestamp, actor, field, old_val, new_val }.
103+
104+
### Validation And Defaults
105+
106+
Defaults (Computed)
107+
- `earnest_money_due` = `mutual_acceptance_date` + 2 business days.
108+
- `seller_disclosure_review` = `mutual_acceptance_date` + 3 business days.
109+
- `inspection_period_end` = `mutual_acceptance_date` + 10 calendar days.
110+
- `title_review_end` = `title_receipt_date` + 5 business days.
111+
- `possession_date` defaults to `closing_date` unless overridden.
112+
113+
Validation Rules
114+
- `deal_id`: Required and unique (UUID or internal slug).
115+
- `mutual_acceptance_date`: Required if status is active, pending, or closed.
116+
- `purchase_price`: Must be > 0.
117+
- `earnest_money`: Must be > 0.
118+
- `status`: Must match defined enum values.
119+
- `required_docs`: At least PSA_21 required to enter Stage 2 (Negotiation).

0 commit comments

Comments
 (0)