Skip to content

Commit 95d832f

Browse files
committed
docs: finalized documentation audit, branding alignment, and feature documentation
1 parent 339a561 commit 95d832f

10 files changed

Lines changed: 116 additions & 43 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
> **"One Engine. Two Worlds. Total Accountability."**
1313
14-
[**Full Documentation 📚**](https://daretechie.github.io/CommitVigil/) | [**Safety Validation Report 🛡️**](https://daretechie.github.io/CommitVigil/validation/safety_validation_report/)
14+
[**Full Documentation 📚**](https://daretechie.github.io/CommitVigil/) | [**Live Site 🌐**](https://daretechie.github.io/CommitVigil/) | [**Safety Validation Report 🛡️**](https://daretechie.github.io/CommitVigil/validation/safety_validation_report/)
1515

1616
---
1717

docs/guides/quickstart.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,21 @@ docker-compose up --build
1212
## 🏗️ Local Setup
1313
1. **Install dependencies**:
1414
```bash
15+
# Recommendation: Use uv for high-performance dependency resolution
1516
uv sync
17+
# OR standard poetry
18+
poetry install
1619
```
1720
2. **Configure Environment**:
1821
Create a `.env` file based on `.env.example`.
1922
> **Important**: Set `API_KEY_SECRET` to a secure value for production. Set `AUTH_ENABLED=False` for local testing without auth.
2023
3. **Run the API**:
2124
```bash
22-
uv run uvicorn src.main:app --reload
25+
poetry run uvicorn src.main:app --reload
2326
```
2427
4. **Run the Worker**:
2528
```bash
26-
uv run arq src.worker.WorkerSettings
29+
poetry run arq src.worker.WorkerSettings
2730
```
2831

2932
---

docs/overviews/agents.md

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,17 @@ The final decision is a personalized intervention:
2222
- **Tone: Confrontational** - For repeat deflection.
2323

2424
## 4. Safety Audit (`SafetySupervisor`)
25-
The "Overwatch" layer acts as a final sanity check before any intervention is sent. It prevents:
26-
- **HR Violations**: Blocking discussions on salary or firing.
27-
- **Tone Drift**: Catching if an agent accidentally becomes too aggressive.
28-
- **Ambiguity**: Flagging if the agent's confidence in its own verdict is low.
25+
The "Overwatch" layer acts as a final sanity check before any intervention is sent. It enforces the **Industry-Specific Semantic Firewall**:
26+
- **Healthcare (HIPAA)**: Hard-blocks unauthorized PII or clinical mandates.
27+
- **Finance (SEC)**: Prevents market manipulation or non-compliant financial advice.
28+
- **HR Violations**: Guards against illegal firing or salary negotiations.
29+
30+
## 5. Cultural Persona Architecture
31+
CommitVigil adapts the **ToneAdapter** to the cultural context of the user:
32+
- **Japanese (`ja`)**: High-context, polite, and face-saving interventions.
33+
- **German (`de`)**: Direct, technical, and objective accountability.
34+
- **African Ubuntu (`en-AF`)**: Communal, relationship-centric, and narrative-driven check-ins.
35+
- **British (`en-UK`)**: Nuanced, polite persistence.
2936

3037
---
3138

docs/overviews/ethics.md

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,28 +11,31 @@ One of our most discussed features is the **"Confrontational"** tone. Here is ho
1111
* **The Burnout Safety Valve**: If the `ExcuseDetector` identifies signs of fatigue, the system **blocks** confrontational escalation and triggers a "Burnout Alert" for the manager instead.
1212
* **Tone Drift & Cooling-off**: To prevent morale fatigue, the system implements **mathematical tone-damping**. If a user receives **3 consecutive "Firm" or "Confrontational" follow-ups**, the logic automatically locks the agent into a `NEUTRAL` or `SUPPORTIVE` state for 48 hours (configurable via `COOLING_OFF_PERIOD_HOURS`).
1313

14-
## 2. Nuanced Hard-Blocking (The "Ethics Firewall")
15-
We explicitly distinguish between "Business Aggression" and "HR Violations." The **Safety Supervisor** enforces a **Semantic Firewall**:
16-
* **BLOCKED (HR Territory)**: Discussions involving `Salary`, `PIP` (Performance Improvement Plans), `Firing`, or `Legal Threats` are immediately blocked. This is a hard-coded safety guarantee.
17-
* **ALLOWED (Business Territory)**: Aggressive discussions about `Pricing Models`, `Budgeting`, or `Resource Allocation` are permitted as valid professional discourse.
14+
## 2. Industry-Specific Semantic Firewall 🧱
15+
CommitVigil provides hard-coded safety guarantees for regulated industries:
16+
* **Healthcare (HIPAA)**: The system hard-blocks unauthorized medical mandates or PII disclosure.
17+
* **Finance (SEC)**: Prevents the agent from accidentally facilitating market manipulation or providing unregulated financial advice.
18+
* **HR Territory**: Discussions involving `Salary`, `PIP` (Performance Improvement Plans), or `Firing` are immediately escalated to human review.
1819

1920

2021

21-
## 2. Cultural & Contextual Sensitivity
22-
"Deflection" is relative. What is seen as blunt in one culture is polite in another:
22+
## 3. Continuous Learning & ROI Metrics 📈
23+
CommitVigil doesn't just act; it learns:
24+
* **Manager Feedback Loop**: Every intervention can be reviewed by a supervisor. Their "Accept/Modify/Reject" decisions are persisted.
25+
* **ROI Dashboard**: The system calculates the **Intervention Acceptance Rate** to quantify the AI's alignment with management intent.
2326

2427
* **Sensitivity Calibration**: CommitVigil supports **Cultural Tone Profiles**. Managers can calibrate the "Pressure Sensitivity" of the agents to match their specific team norms (e.g., High-Directness vs. High-Context locales).
2528
* **Domain-Specific Jargon**: The NLP models are refined to recognize that certain industry vernacular (e.g., *"I'm swamped"*) may be a routine status update rather than an excuse in specific high-velocity teams.
2629

27-
## 3. Privacy & Data Integrity
30+
## 4. Privacy & Data Integrity
2831

2932
Monitoring at the granularity of Slack threads and Git commits requires a strict privacy stance:
3033

3134
* **Scoped Monitoring**: CommitVigil is designed to monitor designated `#project` channels, not private DMs or unrelated chatter.
3235
* **Source-Level Only**: Commit monitoring is restricted to commit messages and PR metadata—not the proprietary logic within the source code files themselves.
3336
* **Identity Anonymization**: Internal IDs are used for analysis; real names can be masked in the database if necessary.
3437

35-
## 3. Handling Ambiguity (The "100% Visibility" Claim) 🧠
38+
## 5. Handling Ambiguity (The "100% Visibility" Claim) 🧠
3639
Ambiguity is the greatest challenge in Engineering NLP. Here is how we move toward high accuracy:
3740

3841
* **Confidence Scores**: Every extraction (Commitment, Risk, Excuse) is accompanied by a `confidence_score`.

docs/reference/api.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,13 @@ CommitVigil provides a clean RESTful interface for all operations.
3030
show_root_heading: true
3131
show_source: false
3232

33+
## 🏢 Enterprise Departmental Audits
34+
35+
::: src.api.routes.get_departmental_audit
36+
options:
37+
show_root_heading: true
38+
show_source: false
39+
3340
### Exporting Reports
3441
The audit endpoint supports three formats via the `report_format` query parameter:
3542
- **`json`** (Default): Standard API response for integration.

src/api/routes.py

Lines changed: 63 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,11 @@ async def get_performance_audit(user_id: str, report_format: str = "json"):
145145
analyst = SlippageAnalyst()
146146
detector = TruthGapDetector()
147147

148-
from src.schemas.performance import SlippageAnalysis, TruthGapAnalysis, SlippageStatus
148+
from src.schemas.performance import (
149+
SlippageAnalysis,
150+
TruthGapAnalysis,
151+
SlippageStatus,
152+
)
149153

150154
try:
151155
slippage = await analyst.analyze_performance_gap(promised, reality)
@@ -158,13 +162,13 @@ async def get_performance_audit(user_id: str, report_format: str = "json"):
158162
fulfillment_ratio=0.0,
159163
detected_gap="The developer promised to refactor the API, fix CSS, and update docs, but only updated some typos in README. No major code changes detected.",
160164
risk_to_system_stability=0.8,
161-
intervention_required=True
165+
intervention_required=True,
162166
)
163167
gap = TruthGapAnalysis(
164168
gap_detected=True,
165169
truth_score=0.1,
166170
explanation="The user claims to be 90% done with the refactor, but the technical evidence only shows updates to typos in the README with no major code changes detected.",
167-
recommended_tone="skeptical"
171+
recommended_tone="skeptical",
168172
)
169173

170174
# 3. Compile Report
@@ -201,6 +205,7 @@ async def log_safety_feedback(feedback: CorrectionFeedback):
201205
)
202206
return {"status": "logged", "message": "Safety feedback recorded for model tuning."}
203207

208+
204209
@router.get("/reports/department/{department}", dependencies=[Depends(get_api_key)])
205210
async def get_departmental_audit(department: str):
206211
"""
@@ -218,13 +223,36 @@ async def get_departmental_audit(department: str):
218223
members = list(result.scalars().all())
219224

220225
if not members:
221-
logger.info("no_department_members_found_falling_back_to_demo_mock", department=department)
226+
logger.info(
227+
"no_department_members_found_falling_back_to_demo_mock",
228+
department=department,
229+
)
222230
members = [
223-
UserHistory(user_id="lead_rockstar", reliability_score=98.5, department=department),
224-
UserHistory(user_id="senior_reliable", reliability_score=92.0, department=department),
225-
UserHistory(user_id="mid_slipping", reliability_score=45.0, department=department),
226-
UserHistory(user_id="junior_burnout", reliability_score=62.0, department=department),
227-
UserHistory(user_id="new_hire_risk", reliability_score=38.0, department=department)
231+
UserHistory(
232+
user_id="lead_rockstar",
233+
reliability_score=98.5,
234+
department=department,
235+
),
236+
UserHistory(
237+
user_id="senior_reliable",
238+
reliability_score=92.0,
239+
department=department,
240+
),
241+
UserHistory(
242+
user_id="mid_slipping",
243+
reliability_score=45.0,
244+
department=department,
245+
),
246+
UserHistory(
247+
user_id="junior_burnout",
248+
reliability_score=62.0,
249+
department=department,
250+
),
251+
UserHistory(
252+
user_id="new_hire_risk",
253+
reliability_score=38.0,
254+
department=department,
255+
),
228256
]
229257

230258
# ROI Calculation: Intervention Acceptance
@@ -238,11 +266,31 @@ async def get_departmental_audit(department: str):
238266
return AuditReportGenerator.generate_departmental_audit(
239267
department=department,
240268
members=[
241-
UserHistory(user_id="lead_rockstar", reliability_score=98.5, department=department),
242-
UserHistory(user_id="senior_reliable", reliability_score=92.0, department=department),
243-
UserHistory(user_id="mid_slipping", reliability_score=45.0, department=department),
244-
UserHistory(user_id="junior_burnout", reliability_score=62.0, department=department),
245-
UserHistory(user_id="new_hire_risk", reliability_score=38.0, department=department)
269+
UserHistory(
270+
user_id="lead_rockstar",
271+
reliability_score=98.5,
272+
department=department,
273+
),
274+
UserHistory(
275+
user_id="senior_reliable",
276+
reliability_score=92.0,
277+
department=department,
278+
),
279+
UserHistory(
280+
user_id="mid_slipping",
281+
reliability_score=45.0,
282+
department=department,
283+
),
284+
UserHistory(
285+
user_id="junior_burnout",
286+
reliability_score=62.0,
287+
department=department,
288+
),
289+
UserHistory(
290+
user_id="new_hire_risk",
291+
reliability_score=38.0,
292+
department=department,
293+
),
246294
],
247-
intervention_rate=0.88
295+
intervention_rate=0.88,
248296
)

src/core/database.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,14 +79,14 @@ async def update_user_reliability(
7979
user.total_commitments += 1
8080
if was_failure:
8181
user.failed_commitments += 1
82-
82+
8383
# 1.5 Cooling-off Logic: Reset strict intervention counter if enough time has passed
8484
if user.last_intervention_at:
8585
last_int = user.last_intervention_at
8686
# SQLite returns naive datetimes; ensure comparison is aware
8787
if last_int.tzinfo is None:
8888
last_int = last_int.replace(tzinfo=timezone.utc)
89-
89+
9090
time_since_last = datetime.now(timezone.utc) - last_int
9191
if time_since_last > timedelta(hours=settings.COOLING_OFF_PERIOD_HOURS):
9292
user.consecutive_firm_interventions = 0

src/core/reporting.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -240,12 +240,12 @@ def generate_departmental_audit(
240240
total_rel = sum(m.reliability_score for m in members)
241241
avg_rel = round(total_rel / len(members), 2)
242242

243-
top_perf = [
244-
m.user_id for m in members if m.reliability_score >= 90.0
245-
][:5] # Top 5
246-
critical = [
247-
m.user_id for m in members if m.reliability_score < 50.0
248-
][:5] # Bottom 5
243+
top_perf = [m.user_id for m in members if m.reliability_score >= 90.0][
244+
:5
245+
] # Top 5
246+
critical = [m.user_id for m in members if m.reliability_score < 50.0][
247+
:5
248+
] # Bottom 5
249249

250250
# Heuristic: If reliability is dropping rapidly across the team, flag it.
251251
# For this demo, we'll assume a static check.

src/schemas/agents.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,9 @@ class UserHistory(SQLModel, table=True):
125125
reliability_score: float = Field(default=100.0)
126126

127127
# Enterprise Attributes
128-
department: str = Field(default="engineering", index=True) # engineering, hr, research, finance
128+
department: str = Field(
129+
default="engineering", index=True
130+
) # engineering, hr, research, finance
129131
industry_type: str = Field(default="generic") # healthcare, finance, generic
130132
language_preference: str = Field(default="en") # en, en-UK, ja, de
131133

tests/test_database.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,14 +86,15 @@ async def test_git_email_flow():
8686
@pytest.mark.asyncio
8787
async def test_cooling_off_reset():
8888
from src.core.database import AsyncSessionLocal
89+
8990
user_id = "cooling_off_user"
90-
91+
9192
# 1. Setup user with strict interventions and a recent timestamp
9293
async with AsyncSessionLocal() as session:
9394
user = UserHistory(
9495
user_id=user_id,
9596
consecutive_firm_interventions=5,
96-
last_intervention_at=datetime.now(timezone.utc)
97+
last_intervention_at=datetime.now(timezone.utc),
9798
)
9899
session.add(user)
99100
await session.commit()
@@ -103,11 +104,13 @@ async def test_cooling_off_reset():
103104
statement = select(UserHistory).where(UserHistory.user_id == user_id)
104105
results = await session.execute(statement)
105106
db_user = results.scalar_one()
106-
db_user.last_intervention_at = datetime.now(timezone.utc) - timedelta(hours=settings.COOLING_OFF_PERIOD_HOURS + 1)
107+
db_user.last_intervention_at = datetime.now(timezone.utc) - timedelta(
108+
hours=settings.COOLING_OFF_PERIOD_HOURS + 1
109+
)
107110
await session.commit()
108111

109112
# 3. Update with firm tone. It should detect cooling off, reset to 0, then increment to 1.
110113
await update_user_reliability(user_id, was_failure=True, tone_used="firm")
111-
114+
112115
_, _, consecutive_firm = await get_user_reliability(user_id)
113116
assert consecutive_firm == 1 # Reset to 0 then +1

0 commit comments

Comments
 (0)