Academic Repo Analyzer
Produce a concise repository understanding document plus a machine-readable Semantic Architecture Handoff v1. The handoff describes scientific roles and executable relationships, not the repository's folder layout or engineering boilerplate.
Read keywords.md only when task or framework classification is uncertain. Read references/missing-info-policy.md when evidence is sparse.
Core Principle: Narrative Priority & Non-Intrusive Extraction
- Paper & User Narrative > Code Implementation:
- A paper figure depicts the scientific contribution and conceptual data flow, not the full software engineering artifact.
- Omit engineering plumbing (such as
DataLoader, Trainer, Logger, ConfigParser, DeviceManager, or Optimizer setup) unless the paper specifically contributes a training algorithm or infrastructure system.
- Fact-Checking & Parameter Grounding:
- When a paper draft or user architecture is already present, the repo analyzer acts as a supporting fact-checker (verifying tensor dimensions, loss formulas, exact module names, and execution directions) rather than re-inventing the architecture.
Input contract
- Prefer: repository path, README, dependencies, entry points, core model/algorithm files, configs, and tests that establish behavior.
- Accept: partial repository, isolated model files, core algorithm script.
- Minimum: one README, entry point, or core implementation file.
- Record the source revision when Git metadata is available.
- Treat names and README claims as leads; verify figure-critical claims in code or tests.
Output contract
Keep the human summary to roughly 30–70 lines, then emit the handoff block below.
- Repository overview and scientific task.
- Evidence/completeness statement listing what was inspected.
- Semantic components and their responsibilities.
- Executed/advisory/feedback/persistence connections.
- Authority or trust boundaries when agents, tools, evaluators, or external systems are involved.
- Figure suggestions (Overall Framework, Network Architecture, Module Detail, Concept/Motivation, Protocol/Sequence).
Semantic Architecture Handoff v1.
Workflow
1. Locate evidence
Find the README, dependency files, entry scripts (train, main, eval, inference, predict, run, simulate, benchmark), configs, and core algorithm files. Top-level directories are discovery cues only; they are never counted as architecture modules.
For a large repository, inspect the top level and a justified sample of core files. State the sampling boundary. Do not claim full coverage from keyword hits.
2. Classify task and implementation stack
Identify the scientific objective, primary framework, data/experiment interface, and main execution path with file or symbol evidence. Mark unsupported inferences explicitly.
3. Build the semantic graph
Create one component only when it has a distinct scientific or execution responsibility that belongs in a paper figure. A component may span several files, and one file may implement several components.
For every component record:
- stable
id and short display label;
role:
- General ML / Deep Learning:
input_data, encoder_backbone, fusion_interaction, loss_objective, task_head, model, output;
- Agentic / Interactive:
reasoning, decision, deterministic_execution, observation, memory, persistence, advisory, exception;
- Systems / Modular:
source, scheduler, processor, storage, sink, other;
figure_importance: primary or secondary;
- evidence pointers such as
path:line, class, function, test, or config key;
- one-sentence responsibility and explicit non-authority when scientifically important.
Record connections separately. Use executed, advisory, feedback, persistence, or exception as the connection kind. Do not infer an edge solely because two files import each other.
4. Derive visual groups
Group related components by responsibility or narrative stage. Report:
semantic_component_count: number of evidence-backed components;
visual_group_count: number of meaningful regions in the proposed figure;
peer_module_count: largest set of genuinely equivalent sibling components.
These counts help layout planning. None of them selects a palette by itself.
5. Emit the handoff
{
"schema": "academic-figure/SemanticArchitecture@1",
"source_revision": "<commit-or-unknown>",
"domain": "<controlled-domain>",
"evidence_level": "high|partial|sparse",
"components": [
{
"id": "backbone",
"label": "Encoder Backbone",
"role": "encoder_backbone",
"figure_importance": "primary",
"responsibility": "Extracts multi-scale feature representations.",
"evidence": ["models/backbone.py:ResNet"]
}
],
"connections": [
{
"from": "input_data",
"to": "backbone",
"kind": "executed",
"label": "raw inputs",
"evidence": ["models/pipeline.py:forward"]
}
],
"authority_boundaries": [],
"semantic_component_count": 1,
"visual_group_count": 1,
"peer_module_count": 0,
"figure_types": ["Overall Framework"],
"forbidden_claims": ["<claims the figure must not imply>"]
}
Controlled domain: CV, NLP, Speech/Audio, RL, Robotics, Multimodal, TimeSeries, Generative, Protein/AI4Science, GNN/ScientificComputing, Systems/Infrastructure, ScientificComputing(non-ML), or Other.
Sparse evidence
- No README: infer cautiously from code and label the inference.
- No entry point: limit the result to component-level structure.
- No core implementation: report task/stack only and omit unsupported edges.
- Almost empty repository: provide the minimum missing materials instead of inventing an architecture.
Stop
Stop when the human summary and valid handoff are delivered. Suggest figure planning only when the user wants the next stage.
1---2name: academic-repo-analyzer3description: Analyze ML, AI4Science, Systems, and research repositories into an evidence-backed semantic architecture graph for paper figure planning. Code serves as supporting evidence; paper narrative and user intent remain the primary source of truth.4---56# Academic Repo Analyzer78Produce a concise repository understanding document plus a machine-readable **Semantic Architecture Handoff v1**. The handoff describes scientific roles and executable relationships, not the repository's folder layout or engineering boilerplate.910Read `keywords.md` only when task or framework classification is uncertain. Read `references/missing-info-policy.md` when evidence is sparse.1112## Core Principle: Narrative Priority & Non-Intrusive Extraction13141. **Paper & User Narrative > Code Implementation**:15 - A paper figure depicts the **scientific contribution and conceptual data flow**, not the full software engineering artifact.16 - Omit engineering plumbing (such as `DataLoader`, `Trainer`, `Logger`, `ConfigParser`, `DeviceManager`, or `Optimizer` setup) unless the paper specifically contributes a training algorithm or infrastructure system.172. **Fact-Checking & Parameter Grounding**:18 - When a paper draft or user architecture is already present, the repo analyzer acts as a **supporting fact-checker** (verifying tensor dimensions, loss formulas, exact module names, and execution directions) rather than re-inventing the architecture.1920## Input contract2122- Prefer: repository path, README, dependencies, entry points, core model/algorithm files, configs, and tests that establish behavior.23- Accept: partial repository, isolated model files, core algorithm script.24- Minimum: one README, entry point, or core implementation file.25- Record the source revision when Git metadata is available.26- Treat names and README claims as leads; verify figure-critical claims in code or tests.2728## Output contract2930Keep the human summary to roughly 30–70 lines, then emit the handoff block below.31321. Repository overview and scientific task.332. Evidence/completeness statement listing what was inspected.343. Semantic components and their responsibilities.354. Executed/advisory/feedback/persistence connections.365. Authority or trust boundaries when agents, tools, evaluators, or external systems are involved.376. Figure suggestions (Overall Framework, Network Architecture, Module Detail, Concept/Motivation, Protocol/Sequence).387. `Semantic Architecture Handoff v1`.3940## Workflow4142### 1. Locate evidence4344Find the README, dependency files, entry scripts (`train`, `main`, `eval`, `inference`, `predict`, `run`, `simulate`, `benchmark`), configs, and core algorithm files. Top-level directories are discovery cues only; they are never counted as architecture modules.4546For a large repository, inspect the top level and a justified sample of core files. State the sampling boundary. Do not claim full coverage from keyword hits.4748### 2. Classify task and implementation stack4950Identify the scientific objective, primary framework, data/experiment interface, and main execution path with file or symbol evidence. Mark unsupported inferences explicitly.5152### 3. Build the semantic graph5354Create one component only when it has a distinct scientific or execution responsibility that belongs in a paper figure. A component may span several files, and one file may implement several components.5556For every component record:5758- stable `id` and short display `label`;59- `role`:60 - **General ML / Deep Learning**: `input_data`, `encoder_backbone`, `fusion_interaction`, `loss_objective`, `task_head`, `model`, `output`;61 - **Agentic / Interactive**: `reasoning`, `decision`, `deterministic_execution`, `observation`, `memory`, `persistence`, `advisory`, `exception`;62 - **Systems / Modular**: `source`, `scheduler`, `processor`, `storage`, `sink`, `other`;63- `figure_importance`: `primary` or `secondary`;64- evidence pointers such as `path:line`, class, function, test, or config key;65- one-sentence responsibility and explicit non-authority when scientifically important.6667Record connections separately. Use `executed`, `advisory`, `feedback`, `persistence`, or `exception` as the connection kind. Do not infer an edge solely because two files import each other.6869### 4. Derive visual groups7071Group related components by responsibility or narrative stage. Report:7273- `semantic_component_count`: number of evidence-backed components;74- `visual_group_count`: number of meaningful regions in the proposed figure;75- `peer_module_count`: largest set of genuinely equivalent sibling components.7677These counts help layout planning. None of them selects a palette by itself.7879### 5. Emit the handoff8081```json82{83 "schema": "academic-figure/SemanticArchitecture@1",84 "source_revision": "<commit-or-unknown>",85 "domain": "<controlled-domain>",86 "evidence_level": "high|partial|sparse",87 "components": [88 {89 "id": "backbone",90 "label": "Encoder Backbone",91 "role": "encoder_backbone",92 "figure_importance": "primary",93 "responsibility": "Extracts multi-scale feature representations.",94 "evidence": ["models/backbone.py:ResNet"]95 }96 ],97 "connections": [98 {99 "from": "input_data",100 "to": "backbone",101 "kind": "executed",102 "label": "raw inputs",103 "evidence": ["models/pipeline.py:forward"]104 }105 ],106 "authority_boundaries": [],107 "semantic_component_count": 1,108 "visual_group_count": 1,109 "peer_module_count": 0,110 "figure_types": ["Overall Framework"],111 "forbidden_claims": ["<claims the figure must not imply>"]112}113```114115Controlled domain: `CV`, `NLP`, `Speech/Audio`, `RL`, `Robotics`, `Multimodal`, `TimeSeries`, `Generative`, `Protein/AI4Science`, `GNN/ScientificComputing`, `Systems/Infrastructure`, `ScientificComputing(non-ML)`, or `Other`.116117## Sparse evidence118119- No README: infer cautiously from code and label the inference.120- No entry point: limit the result to component-level structure.121- No core implementation: report task/stack only and omit unsupported edges.122- Almost empty repository: provide the minimum missing materials instead of inventing an architecture.123124## Stop125126Stop when the human summary and valid handoff are delivered. Suggest figure planning only when the user wants the next stage.