跪拜 Guibai
← All articles
OpenAI · Full-Stack · Programmer

A Git Submodule Scaffold That Teaches AI Your Full-Stack Codebase Before It Writes a Single Line

By Karl_wei ·
Read original on juejin.cn ↗ Google Translate ↗ Alt translation

Most AI coding tools treat every repo as a blank slate or rely on generic prompts. This workflow bakes a project's real conventions into structured, reviewable artifacts that survive across sessions and models, cutting down on style drift and low-level mistakes in multi-platform codebases.

Summary

A full-stack workspace built around a composite git root repository pulls together mobile, backend, and web submodules. Before any AI coding task runs, a domain-init skill inspects build files, dependencies, and real source code to determine the project type and extract live conventions. The output is a set of per-project assets—profile, context map, verification commands, and a traceable report—that subsequent AI tasks load deterministically.

Domain-init operates on four principles: signal priority to avoid misapplying a frontend spec to a backend, evidence-first rules that must trace back to actual code, domain-filtered context so only relevant governance enters the prompt, and human review gates at every stage. It also ships a quality index that points AI toward specific open-source benchmarks for coding style, testing strategy, and security review, learning how those projects structure rules rather than copying their content.

Once initialized, a task entering from the root reads a workspace map, locates the target sub-project, and follows a fixed loading order: AGENTS.md, the harness core, then the project's profile, context map, and verification spec. The claimed result is a two-day turnaround for A/B feature validation that previously took a week.

Takeaways
Git submodules let a composite root repo lock every platform's code to a known version without interfering with each sub-team's branching strategy.
A workspace-map.md file catalogs which sub-project handles which domain so AI can route a task to the correct codebase immediately.
Domain-init identifies the project type from build files, dependencies, and directory structure before sampling real code to extract live conventions.
Every extracted rule must cite actual code evidence; the model is forbidden from inventing theoretically correct but project-wrong rules.
A project-index.md points AI toward specific open-source benchmarks for coding conventions, testing strategy, and security review so it learns rule structure rather than copying content.
Initialization produces per-project assets—profile, context map, verification commands, and a traceable report—stored inside each submodule, not the root.
Task execution follows a fixed loading order: AGENTS.md, harness core, then project-specific profile, context map, and verification spec.
The authors claim a full A/B feature validation cycle that once took a week now completes in two days with AI plus harness.
Conclusions

Encoding project conventions as structured, reviewable artifacts rather than one-shot prompts creates a persistent governance layer that outlives any single AI session or model swap.

The insistence that rules must cite code evidence—and that humans must judge which patterns are conventions versus historical baggage—is a practical counter to the garbage-in, garbage-out risk of extracting rules from poorly designed legacy codebases.

Pointing AI toward external quality benchmarks to learn rule organization, rather than copying their content, is a subtle but important design choice that avoids polluting a project with foreign conventions.

The claim of compressing a one-week validation cycle into two days is aggressive but plausible if the harness eliminates the manual context-switching and style-correction overhead that dominates multi-platform development.

Concepts & terms
Git submodule
A Git mechanism that embeds one repository inside another as a subdirectory, allowing a parent repo to track a specific commit of the child repo without merging their histories.
Composite root repository
A top-level repository that aggregates multiple independent sub-projects via submodules, serving as a single entry point for full-stack coordination while each sub-project retains its own repository and branching strategy.
Domain-init skill
An AI skill that inspects a codebase's build files, dependencies, and real source code to determine its platform type and extract live conventions into structured, reviewable rule files.
Workspace map
A markdown file that catalogs each sub-project's domain, initialization status, and purpose so an AI agent can route a task to the correct codebase without scanning the entire repository.
Source: juejin.cn ↗ Google Translate ↗ Backup ↗