Skip to content

Repository-wide refactor audit

Branch: development
Status: Governance audit (2026-06-13)
Related: Repository-wide refactor governance · Source compliance audit · Grant ingestion filter audit

This audit inventories places where workflows, scripts, prompts, policies, or packet artifacts still assume source-type-specific extraction — treating intake channel as refactor scope. It supports the governance correction in repository-wide-refactor-governance.md.

Corpus files were not modified as part of this audit.


Executive summary

Area Drift severity Status after governance pass
Core workflow docs High Updatedsource-packet-workflow.md, source-evaluation-policy.md
Refactor prompts (template + intake app) High Updated — repository-wide assessment + candidate sections
Grant governance framing Medium Updated — scope note; layer rules when implicated
Audit-driven refactor policy Low Updated — cross-link + candidate preservation
Bulk intake scripts High (implementation gap) Not changed — still grant-layer primary
Existing packet refactor prompts Medium Not regenerated — ORS/AGIF packets retain grant-centric prompts
Layer intake templates Medium Documented — templates are field guides, not scope limits
Intake form source_type field Low Documented — metadata label only

1. Policy and workflow documentation

Location Assumption found Remediation
docs/source-packet-workflow.md "Grant / award packets:" implied grant-only refactor path Replaced with repository-wide section + grant rules when implicated
docs/source-evaluation-policy.md Grant and publication sections read as parallel intake pipelines Added repository-wide evaluation section; reframed grant/publication as when implicated
docs/reports/grant-ingestion-governance.md Title/framing suggests grant packets are self-contained Added Scope (read first) — layer policy, not packet scope
docs/reports/audit-driven-refactor-policy.md Example discovery = "faculty profile intake" only Generalized to any layer; linked candidate preservation
docs/reports/grant-ingestion-filter-audit.md Implementation plan grant-PI-centric; "Resolve PIs via faculty profile packets" Gap — add follow-up: facility/candidate extraction from same sources
docs/reports/publication-intake-rules.md Publication-layer rules OK as layer guide — add cross-link in future pass
docs/reports/grant-data-intake-template.md Grant YAML field template OK as layer guide — not packet scope
docs/global-hypertext-provenance-audit.md "Create people.yaml from grant PDF names alone" OK — conservative rule; does not forbid candidates

2. Refactor prompts and templates

Location Assumption found Remediation
sources/inbox/_template/refactor_prompt.md grant-ingestion-governance.md (when packet includes grants/awards) without full-layer mandate; grant block before task Updated — repository-wide block, sections L/M, grant rules subordinate
intake_app/packet.py _refactor_prompt_block() No repository-wide assessment; grant rules absent but also no candidate preservation mandate Updated — full impact + classification + sections L/M
sources/inbox/_template/evidence_checklist.md Claim ledger only; no candidate table Updated — candidate knowledge section
sources/inbox/2026-06-14-ors-annual-reports-2020-2025/refactor_prompt.md Grant-centric (generated before correction) Gap — regenerate or hand-edit on next ORS pass
sources/inbox/2026-06-14-agif-reports-2018-2025/ Script-driven grant merge; refactor_output.md grant counts only Gap — facility names in titles not in candidate registry
sources/inbox/2026-06-13-kyle-grice-faculty-profile-*/refactor_prompt.md People/publication focused (appropriate content, narrow prompt) Gap — regenerate from template on next touch
intake_app/tests/test_packet.py Guardrails omit repository-wide phrases Updated — assert new required phrases

3. Intake application

Location Assumption found Remediation
intake_app/packet.py SOURCE_TYPES faculty_profile, grant_award, publication, … Documented — intake metadata only; prompt now overrides scope
intake_app/templates/form.html (if present) User selects source type Gap — UI copy should state "describes primary source, not refactor scope"
intake_app/README.md Describes packet files; no repository-wide rule Gap — add pointer to governance doc

4. Bulk intake scripts (implementation gap — not modified)

These scripts write grant-layer data directly without emitting a full candidate registry for non-grant signals:

Script Behavior Drift
scripts/intake_ors_annual_reports.py Parses ORS PDFs → grants.yaml, PGL, GRL when FACILITY_PATTERNS match Grant-primary; lab names in titles not preserved as candidates
scripts/intake_agif_reports.py Same pattern for AGIF appendices Same; 17+ titles mention labs/clinics; 0 candidate output
scripts/intake_circle_report.py Header states "does not document facility hardware or individual grants" Explicit scope limit — contradicts repository-wide rule if used as sole packet outcome
scripts/backfill_grant_governance_notes*.py Grant notes only OK — grant-layer maintenance

Recommended: shared extracted/candidates.yaml schema + script hooks (Phase 2).


5. Packet artifacts (historical)

Packet Observed drift
2026-06-14-ors-annual-reports-2020-2025 Grant merge + 3 GRL; no candidates.yaml for unresolved facility mentions
2026-06-14-agif-reports-2018-2025 52 grants applied; facility signals in project titles not indexed
2026-06-14-circle-report-2024 Summary YAML only; no cross-layer candidate pass
2026-06-13-grice-lab-pilot Lab-focused (appropriate) — prompt predates governance
Faculty profile packets Publication/people focus — may miss grant mentions on profile

No corpus rollback required — governance applies to future refactors and script runs.


6. Why source-type-specific extraction is contrary to IKaC

  1. Single corpus — The Resource Map is one evidence graph. Siloed extraction duplicates effort and loses cross-layer links (e.g. AGIF award → lab name → facility candidate → PI person).
  2. Provenance chain — IKaC requires auditable paths from source → claim. Discarding facility mentions because the intake form said "grant_award" breaks the chain.
  3. Hypertext reciprocity — Relationships span layers. Grant-only scripts never surface reciprocal facility or publication edges from the same PDF.
  4. Candidate knowledge — Institutional knowledge includes unresolved signals. Source-type pipelines treat unresolved non-primary-layer data as noise.
  5. Human + AI refactor model — Source packets exist so Cursor reads rich context. Narrow prompts replicate the rejected regex-scraper pattern at a higher level.

Phase Work Owner
1 Publish governance + update core docs/prompts/templates Done (this pass)
2 Define extracted/candidates.yaml schema in _template/ Maintainer
3 Update intake_ors_annual_reports.py / intake_agif_reports.py to emit candidates for unmatched facility/lab/person strings Maintainer
4 Regenerate or hand-update refactor prompts on active inbox packets (ORS, AGIF, CIRCLE) Per-packet
5 Intake app UI copy + README cross-link Small PR
6 Re-run AGIF/ORS packet refactors with full L/M sections; promote candidates where evidence allows Human review
7 Update grant-ingestion-filter-audit.md implementation plan with candidate extraction milestones Docs

8. Verification checklist (governance pass)

  • [x] docs/source-packet-workflow.md — repository-wide section + sections L/M
  • [x] docs/source-evaluation-policy.md — repository-wide evaluation
  • [x] docs/reports/audit-driven-refactor-policy.md — cross-link
  • [x] docs/reports/grant-ingestion-governance.md — scope note
  • [x] docs/reports/repository-wide-refactor-governance.md — created
  • [x] sources/inbox/_template/refactor_prompt.md — updated
  • [x] sources/inbox/_template/evidence_checklist.md — candidate section
  • [x] intake_app/packet.py — prompt block updated
  • [x] intake_app/tests/test_packet.py — guardrails extended
  • [ ] Bulk scripts — deferred (implementation Phase 2)
  • [ ] Active inbox packet prompts — deferred (Phase 4)