analyze_repo_structure
Analyze a code repository to extract evidence-backed ontology candidates—projects, domains, capabilities, and elements—before any vault write.
Instructions
R16 (autonomous ingest base) — analyze a code repository and propose ontology node candidates. side effect 0 (vault frontmatter NOT modified). Returns deterministic candidates the agent must turn into an evidence-backed proposal and move through the construction lifecycle before any exact batch-writer rows are released. Repository structure is implementation evidence, not automatic business meaning: extractionContract and proposedBusinessOntology make that uncertainty explicit. Detects:
package.json
name→ project candidateREADME.md first H1 → project title fallback
README.md H2 sections (skipping generic "Usage"/"Installation"/etc) → domain candidates
src/features|entities|widgets|views/* (FSD) → capability/element candidates
src/* depth-1 folders (generic) → capability candidates + index entry → element
apps/* and packages/* members with package.json → implementation element candidates
README.rst + bounded static setup.py → Python project/package evidence without execution
mixed current and future/negated/deprecated README prose → exact current candidate excerpt plus bounded line-scoped
reviewRequiredEvidence; review units stay visible but cannot support a proposal claimselected safe README sections share the existing 1,200-character budget deterministically; no document, heading, or excerpt cap grows
root Python packages plus at most 12 import-connected implementation boundaries → direct modules plus up to 2 exact security/policy/risk file anchors; unused files are not mirrored and no capability is inferred from imports
bounded root Cargo package or repo-contained literal direct workspace members → typed feature declaration + literal cfg/cfg_attr source provenance; predicates are not evaluated and no runtime/import/semantic dependency is inferred
a complete proposal may select at most 4 additional exact TypeScript, JavaScript, Python, or Rust file endpoints already observed by infer_imports for distinct navigation roles; exact dependency direction is validated and these files never become automatic candidates
an element proposal may keep an ordinary citation and append reviewed
navigation:primary|supporting|test:<path>#<symbol>evidence strings (limits 1/1/3); the server verifies only those named current files, renders human-readable Evidence bullets, and rejects missing, ambiguous, unsafe, or task-inferred coordinates without treating them as behavior proof
Optionally pass a complete proposal to validate project/domain/capability/element definitions, typed relations, citations, risk controls, domain placement, implementation paths, confidence, and typed competency answers with resolvable concept/relation/evidence/path witnesses. Partial or visible-gap answers remain warnings instead of disappearing behind findings 0. A unqualified-project-exclusion warning is an exact human-acceptance gap, while an evidence-limit exclusion remains an error. Source-hidden review may leave exact source-body detail partial; source-aware citation verification decides support before evidence provenance can pass. A mandatory non-gap warning blocks the first review before qualification begins. For a bounded first pass, freeze claim id, statement, and proposalRefs before isolated source-hidden and source-aware lanes run in parallel; separately audit material Definition, Includes, Excludes, and Uncertainty assertions even when several claims share one proposal ref. Join sealed receipts without mutation before human acceptance. A passing validation first returns a deterministic non-writing reviewPlan, planDigest, sourceDigest, and eight-phase construction lifecycle. An independent evaluator must measure the approved competency questions and source-hidden task, then a human may declare acceptance bound to that exact plan digest/revision and every visible gap. Pass the resulting constructionQualification:v1 packet as qualification; only a current, admissible packet releases the exact reviewed rows as writePlan. The lifecycle also reports a shadow-only admission tier; self_qualified is an observation, not a write permission. Declared approval provenance is not identity authentication. Do not call write tools unless proposalValidation.canWrite is true and a writePlan is present; write every concept row successfully before writing relations.
Use this once when a user asks "이 codebase 분석해줘" / "bootstrap the ontology". Single source of truth preserved — only the user (via your subsequent add_concept calls) writes to the vault.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ignore | No | Extra folder names to skip (added to defaults: node_modules, .git, dist, build, …). | |
| maxDepth | No | Non-negative integer folder walk depth (default 2, max 10). Higher → more elements. | |
| proposal | No | Optional business ontology proposal to validate against repository evidence before any write call. Python proposals may select at most 4 exact observed import endpoints beyond the analyzer candidates. | |
| rootPath | No | Repository root to analyze. Defaults to the MCP server cwd. | |
| qualification | No | Optional independent evaluation and declared human acceptance bound to the exact planDigest, planRevision, and sourceDigest returned for this proposal. Omit it on the first review call. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| domains | Yes | ||
| project | No | ||
| skipped | Yes | ||
| elements | Yes | ||
| rootPath | Yes | ||
| framework | Yes | ||
| meaningGate | Yes | ||
| capabilities | Yes | ||
| semanticEvidence | Yes | ||
| extractionContract | Yes | ||
| proposalValidation | Yes | ||
| suggestedRelations | Yes | ||
| configurationEvidence | Yes |