Project Onboarding
Contracts
| File |
Purpose |
contracts/input.yaml |
project_path, focus_area, depth |
contracts/output.yaml |
project_summary, project_size, key_files[], conventions[], semantic_type_candidates[], risky_areas[], likely_change_points[], artifacts[], artifact_updated, questions[] |
project_path is required; depth defaults to standard when not specified
- Migration note: assistant-onboard contracts are v2. Output
project_size is scan-derived and required; medium and large projects must return inspected semantic-type and design-pressure candidate arrays, while small projects may omit them.
key_files entries include path and purpose; conventions entries include pattern and example
risky_areas and likely_change_points make the orientation actionable for future development work
questions must be specific to unclear areas discovered during onboarding
Systematic protocol for learning a new codebase. Produces structured project orientation that accelerates future work. Project-local orientation artifacts are optional and must follow the active agent/workplace policy; do not assume third-party memory tooling is available.
Core principle: Understand before acting. Map the territory before navigating it.
Company-safe defaults:
- Read local project files and run read-only/local discovery commands only.
- Do not install analyzers, upload source, or call external services without explicit approval.
- Do not store secrets, customer data, private URLs, or transient task progress in orientation artifacts.
- Prefer agent-agnostic project notes; if the environment has a configured agent memory path, use that path, otherwise report the orientation in the response without writing files.
Goal
Build a compact, evidence-based orientation for the project so future development starts from real structure, commands, conventions, and gaps.
Success Criteria
- Surface scan, architecture mapping, pattern recognition, and gap reporting are complete for the selected depth.
- Key files include path and purpose; conventions include pattern and concrete example.
- Build/test/run commands are identified from project files when available.
- Risky areas and likely change points are called out for future development work.
- Architecture mapping identifies meaningful ownership/lifecycle boundaries, design-pressure candidates (control/early exit, disposal/resources, registration, representative paths), and semantic type candidates or explicit primitive boundaries without inventing a redesign.
- Medium and large onboarding never silently defaults architecture candidate arrays: explicit
[] is valid only after inspection; small projects may omit them.
- Questions are specific to discovered gaps, not generic prompts.
- Orientation artifacts are reported accurately.
Constraints
- Ask every material question when the focus area or depth changes which files are inspected and cannot be inferred; group questions by topic with why, risk if guessed, and a safe default where available rather than enforcing a numeric quota.
- Do not edit production code during onboarding.
- Do not claim full coverage from a representative sample; label gaps and assumptions clearly.
- Do not create or overwrite orientation/memory files unless the user or project policy allows it.
- Do not persist secrets, credentials, private endpoints, or temporary task status.
When to Activate
- First time working with a repository
- User explicitly asks to learn/understand a codebase
- No project-local orientation artifact exists for the project
- Existing project-local orientation is stale (> 60 days old with significant changes)
Onboarding Protocol
Phase 1: Surface Scan (fast, always do)
Print: >> Onboarding: Surface scan
Read in this order (stop early if small project):
When the active adapter supports parallel reads, batch independent reads such as README, agent instructions, .gitignore, root listing, build files, and CI config. If parallel reads are unavailable, use the order below.
- README.md / docs index — stated purpose, setup instructions
- Agent/project instructions — AGENTS.md, CLAUDE.md, CONTRIBUTING.md,
.cursorrules, or equivalent
- .gitignore — what's excluded reveals what's used
- Root directory listing — project shape
- Build files — .csproj, package.json, pyproject.toml, Makefile, Dockerfile, go.mod, Cargo.toml, etc.
- CI/CD config — .github/workflows, azure-pipelines.yml, GitLab CI, build scripts
Extract:
- Project name and purpose
- Tech stack (language, framework, major dependencies)
- Build and test commands
- Project structure pattern (monorepo, single project, multi-project solution)
Phase 2: Architecture Map (medium+ projects)
Print: >> Onboarding: Architecture mapping
For medium+ projects, build the architecture map directly from local source. Use a Code Mapper only when the user or an applicable instruction specifically requires delegated mapping; otherwise do not create a persistent or automatic mapper role.
Classify project_size from the surface scan as small, medium, or large. For medium and large projects, inspect and return both architecture candidate arrays; use explicit [] only when inspection found no candidates. Do not silently default either array. Small projects may omit these optional architecture arrays.
Map:
- Entry points: where execution starts
- Layer boundaries: how code is organized (by feature, by layer, hybrid)
- Key abstractions: interfaces/base classes that define the architecture
- Data model: entities, their relationships, persistence strategy
- External integrations: databases, APIs, message queues
- Configuration: what's configurable, where settings live
- Ownership and lifecycle boundaries: which component owns each important resource/state transition and cancellation/failure path
- Design-pressure candidates: evidence about early exit/control, resource/disposal ownership, bounded resource envelopes, extension registration, and representative paths
- Semantic type candidates: domain/public/lifecycle/unit concepts currently hidden behind generic primitives, plus explicit wire/storage/foreign/framework exception boundaries
Phase 3: Pattern Recognition
Print: >> Onboarding: Pattern recognition
Identify the project's conventions by reading 3-5 representative files:
- Naming conventions (PascalCase, camelCase, prefixes)
- Error handling pattern (exceptions, Result types, error codes)
- Logging approach (structured, unstructured, what framework)
- Testing patterns (framework, naming, organization)
- DI patterns (registration style, lifetime choices)
- Code organization within files (ordering of members, regions)
Phase 4: Knowledge Gaps and Risky Areas
Print: >> Onboarding: Identifying unknowns and risk areas
List what you still don't understand:
- Areas of code that seem complex or unusual
- Patterns that deviate from convention
- Dependencies whose purpose isn't clear
- Configuration values that need context
Also identify practical development guidance:
- Risky areas: auth, permissions, persistence, migrations, external integrations, shell/file operations, weak tests, unclear ownership
- Likely change points: files/directories most future tasks are likely to touch
- Verification entry points: focused test/build commands and smoke checks discovered locally
Present only specific gaps to the user. Do not ask generic "anything else?" questions.
Phase 5: Generate Project Orientation
Print: >> Onboarding: Generating project orientation
Create or update a project-local orientation artifact only when allowed by user/project policy. Prefer the active agent's configured project note path; examples include {agent_state_dir}/memory.md, or a documented repo-local equivalent. If no safe path is known, do not write a file; return the orientation in the response.
# [Project Name]
## Purpose
[What it does, who uses it]
## Tech Stack
- Language: [language] [version]
- Framework: [framework] [version]
- Database: [database]
- Key dependencies: [list]
## Architecture
- Pattern: [pattern name]
- Entry points: [list with paths]
- Layers: [list with descriptions]
- Ownership/lifecycle boundaries: [evidence-backed summary]
- Semantic type candidates or primitive exceptions: [only where source shows a meaningful boundary]
- Design-pressure candidates: [only where source shows a relevant control, ownership, resource, extension, or representative-path implication]
## Conventions
- Naming: [convention]
- Error handling: [pattern]
- Testing: [framework, naming convention]
- DI: [registration pattern]
## Build and Test Commands
```bash
[build command]
[test command]
Key Files
Risky Areas
- [path/surface]: [risk and why it matters]
Likely Change Points
- [path/directory]: [when future work should look here]
Verification Entry Points
- [command]: [what it validates]
Gotchas
- [non-obvious thing 1]
- [non-obvious thing 2]
### Phase 6: Report
Print: `>> Onboarding complete`
Present a concise summary:
Project: [name]
Stack: [tech stack summary]
Architecture: [pattern]
Size: [small/medium/large] (~[N] files, ~[N]k lines)
Commands: [build/test/run summary]
Conventions: [key conventions]
Risky areas: [auth/data/integration/test gaps/etc.]
Likely change points: [top directories/files]
Unknowns: [any remaining gaps]
Project orientation: [saved to path | returned in response only]
Ready to work on this codebase.
## Output
Return:
- **Project summary** - purpose, stack, architecture, approximate size, and primary build/test/run commands.
- **Key files** - important paths with their role in the system.
- **Conventions** - discovered patterns with concrete examples.
- **Risky areas** - surfaces that need extra care in future work and why.
- **Likely change points** - files/directories future features or fixes will likely touch.
- **Type and boundary candidates** - evidence-backed semantic type candidates or documented primitive-boundary exceptions to consider before changing public/domain interfaces.
- **Design-pressure candidates** - evidence-backed control, ownership/disposal, resource-envelope, extension-registration, or representative-path implications to consider before choosing an abstraction.
- **Artifacts** - orientation files created or updated, or "none" if no files changed.
- **Gaps** - unknowns, assumptions, and specific questions for the user.
- **Status** - onboarded, partially onboarded, or blocked by missing access/context.
## Incremental Onboarding
When returning to a known project after significant time:
1. Read existing project-local orientation if present and policy-allowed (`{agent_state_dir}/memory.md`, or configured equivalent)
2. Check `git log --since="[last session date]"` for changes when git history is available
3. Update orientation only with stable conventions or structural changes; otherwise report refresh results without writing
4. Print: `>> Refreshed project context — [N] changes since last session`
## Rules
- **Never skip Phase 1** — even for "quick" tasks in a new repo
- **Don't read everything** — sample representative files, don't read every file
- **Ask about unknowns** — don't guess business logic or domain concepts; ask every material unknown concisely by topic with why/risk/default.
- **Keep memory concise** — under 100 lines, focused on stable development conventions
- **Update, don't overwrite** — if memory.md exists, update sections, don't regenerate
## Stop Rules
- Stop and ask every material, non-discoverable question when project path, focus area, or onboarding depth cannot be inferred and changes the inspection plan; group them by topic and keep them concise.
- Stop and report blocked status when required files cannot be read.
- Do not proceed to code changes as part of onboarding.
1---2name: assistant-onboard3description: Map an unfamiliar codebase and its patterns. Use for onboarding, project orientation, or explicit codebase-learning requests.4---56# Project Onboarding78## Contracts910| File | Purpose |11|---|---|12| [`contracts/input.yaml`](contracts/input.yaml) | project_path, focus_area, depth |13| [`contracts/output.yaml`](contracts/output.yaml) | project_summary, project_size, key_files[], conventions[], semantic_type_candidates[], risky_areas[], likely_change_points[], artifacts[], artifact_updated, questions[] |1415- `project_path` is required; `depth` defaults to standard when not specified16- Migration note: assistant-onboard contracts are v2. Output `project_size` is scan-derived and required; medium and large projects must return inspected semantic-type and design-pressure candidate arrays, while small projects may omit them.17- `key_files` entries include path and purpose; `conventions` entries include pattern and example18- `risky_areas` and `likely_change_points` make the orientation actionable for future development work19- `questions` must be specific to unclear areas discovered during onboarding2021Systematic protocol for learning a new codebase. Produces structured project orientation that accelerates future work. Project-local orientation artifacts are optional and must follow the active agent/workplace policy; do not assume third-party memory tooling is available.2223Core principle: **Understand before acting. Map the territory before navigating it.**2425Company-safe defaults:26- Read local project files and run read-only/local discovery commands only.27- Do not install analyzers, upload source, or call external services without explicit approval.28- Do not store secrets, customer data, private URLs, or transient task progress in orientation artifacts.29- Prefer agent-agnostic project notes; if the environment has a configured agent memory path, use that path, otherwise report the orientation in the response without writing files.3031## Goal3233Build a compact, evidence-based orientation for the project so future development starts from real structure, commands, conventions, and gaps.3435## Success Criteria3637- Surface scan, architecture mapping, pattern recognition, and gap reporting are complete for the selected depth.38- Key files include path and purpose; conventions include pattern and concrete example.39- Build/test/run commands are identified from project files when available.40- Risky areas and likely change points are called out for future development work.41- Architecture mapping identifies meaningful ownership/lifecycle boundaries, design-pressure candidates (control/early exit, disposal/resources, registration, representative paths), and semantic type candidates or explicit primitive boundaries without inventing a redesign.42- Medium and large onboarding never silently defaults architecture candidate arrays: explicit `[]` is valid only after inspection; small projects may omit them.43- Questions are specific to discovered gaps, not generic prompts.44- Orientation artifacts are reported accurately.4546## Constraints4748- Ask every material question when the focus area or depth changes which files are inspected and cannot be inferred; group questions by topic with why, risk if guessed, and a safe default where available rather than enforcing a numeric quota.49- Do not edit production code during onboarding.50- Do not claim full coverage from a representative sample; label gaps and assumptions clearly.51- Do not create or overwrite orientation/memory files unless the user or project policy allows it.52- Do not persist secrets, credentials, private endpoints, or temporary task status.5354## When to Activate5556- First time working with a repository57- User explicitly asks to learn/understand a codebase58- No project-local orientation artifact exists for the project59- Existing project-local orientation is stale (> 60 days old with significant changes)6061## Onboarding Protocol6263### Phase 1: Surface Scan (fast, always do)6465Print: `>> Onboarding: Surface scan`6667Read in this order (stop early if small project):6869When the active adapter supports parallel reads, batch independent reads such as README, agent instructions, `.gitignore`, root listing, build files, and CI config. If parallel reads are unavailable, use the order below.70711. **README.md / docs index** — stated purpose, setup instructions722. **Agent/project instructions** — AGENTS.md, CLAUDE.md, CONTRIBUTING.md, `.cursorrules`, or equivalent733. **.gitignore** — what's excluded reveals what's used744. **Root directory listing** — project shape755. **Build files** — .csproj, package.json, pyproject.toml, Makefile, Dockerfile, go.mod, Cargo.toml, etc.766. **CI/CD config** — .github/workflows, azure-pipelines.yml, GitLab CI, build scripts7778Extract:79- Project name and purpose80- Tech stack (language, framework, major dependencies)81- Build and test commands82- Project structure pattern (monorepo, single project, multi-project solution)8384### Phase 2: Architecture Map (medium+ projects)8586Print: `>> Onboarding: Architecture mapping`8788For medium+ projects, build the architecture map directly from local source. Use a **Code Mapper** only when the user or an applicable instruction specifically requires delegated mapping; otherwise do not create a persistent or automatic mapper role.8990Classify `project_size` from the surface scan as `small`, `medium`, or `large`. For medium and large projects, inspect and return both architecture candidate arrays; use explicit `[]` only when inspection found no candidates. Do not silently default either array. Small projects may omit these optional architecture arrays.9192Map:93- **Entry points**: where execution starts94- **Layer boundaries**: how code is organized (by feature, by layer, hybrid)95- **Key abstractions**: interfaces/base classes that define the architecture96- **Data model**: entities, their relationships, persistence strategy97- **External integrations**: databases, APIs, message queues98- **Configuration**: what's configurable, where settings live99- **Ownership and lifecycle boundaries**: which component owns each important resource/state transition and cancellation/failure path100- **Design-pressure candidates**: evidence about early exit/control, resource/disposal ownership, bounded resource envelopes, extension registration, and representative paths101- **Semantic type candidates**: domain/public/lifecycle/unit concepts currently hidden behind generic primitives, plus explicit wire/storage/foreign/framework exception boundaries102103### Phase 3: Pattern Recognition104105Print: `>> Onboarding: Pattern recognition`106107Identify the project's conventions by reading 3-5 representative files:108- Naming conventions (PascalCase, camelCase, prefixes)109- Error handling pattern (exceptions, Result types, error codes)110- Logging approach (structured, unstructured, what framework)111- Testing patterns (framework, naming, organization)112- DI patterns (registration style, lifetime choices)113- Code organization within files (ordering of members, regions)114115### Phase 4: Knowledge Gaps and Risky Areas116117Print: `>> Onboarding: Identifying unknowns and risk areas`118119List what you still don't understand:120- Areas of code that seem complex or unusual121- Patterns that deviate from convention122- Dependencies whose purpose isn't clear123- Configuration values that need context124125Also identify practical development guidance:126- **Risky areas**: auth, permissions, persistence, migrations, external integrations, shell/file operations, weak tests, unclear ownership127- **Likely change points**: files/directories most future tasks are likely to touch128- **Verification entry points**: focused test/build commands and smoke checks discovered locally129130Present only specific gaps to the user. Do not ask generic "anything else?" questions.131132### Phase 5: Generate Project Orientation133134Print: `>> Onboarding: Generating project orientation`135136Create or update a project-local orientation artifact only when allowed by user/project policy. Prefer the active agent's configured project note path; examples include `{agent_state_dir}/memory.md`, or a documented repo-local equivalent. If no safe path is known, do not write a file; return the orientation in the response.137138```markdown139# [Project Name]140141## Purpose142[What it does, who uses it]143144## Tech Stack145- Language: [language] [version]146- Framework: [framework] [version]147- Database: [database]148- Key dependencies: [list]149150## Architecture151- Pattern: [pattern name]152- Entry points: [list with paths]153- Layers: [list with descriptions]154- Ownership/lifecycle boundaries: [evidence-backed summary]155- Semantic type candidates or primitive exceptions: [only where source shows a meaningful boundary]156- Design-pressure candidates: [only where source shows a relevant control, ownership, resource, extension, or representative-path implication]157158## Conventions159- Naming: [convention]160- Error handling: [pattern]161- Testing: [framework, naming convention]162- DI: [registration pattern]163164## Build and Test Commands165```bash166[build command]167[test command]168```169170## Key Files171- [path]: [purpose]172- [path]: [purpose]173174## Risky Areas175- [path/surface]: [risk and why it matters]176177## Likely Change Points178- [path/directory]: [when future work should look here]179180## Verification Entry Points181- [command]: [what it validates]182183## Gotchas184- [non-obvious thing 1]185- [non-obvious thing 2]186```187188### Phase 6: Report189190Print: `>> Onboarding complete`191192Present a concise summary:193194```195Project: [name]196Stack: [tech stack summary]197Architecture: [pattern]198Size: [small/medium/large] (~[N] files, ~[N]k lines)199Commands: [build/test/run summary]200Conventions: [key conventions]201Risky areas: [auth/data/integration/test gaps/etc.]202Likely change points: [top directories/files]203Unknowns: [any remaining gaps]204205Project orientation: [saved to path | returned in response only]206Ready to work on this codebase.207```208209## Output210211Return:212- **Project summary** - purpose, stack, architecture, approximate size, and primary build/test/run commands.213- **Key files** - important paths with their role in the system.214- **Conventions** - discovered patterns with concrete examples.215- **Risky areas** - surfaces that need extra care in future work and why.216- **Likely change points** - files/directories future features or fixes will likely touch.217- **Type and boundary candidates** - evidence-backed semantic type candidates or documented primitive-boundary exceptions to consider before changing public/domain interfaces.218- **Design-pressure candidates** - evidence-backed control, ownership/disposal, resource-envelope, extension-registration, or representative-path implications to consider before choosing an abstraction.219- **Artifacts** - orientation files created or updated, or "none" if no files changed.220- **Gaps** - unknowns, assumptions, and specific questions for the user.221- **Status** - onboarded, partially onboarded, or blocked by missing access/context.222223## Incremental Onboarding224225When returning to a known project after significant time:2262271. Read existing project-local orientation if present and policy-allowed (`{agent_state_dir}/memory.md`, or configured equivalent)2282. Check `git log --since="[last session date]"` for changes when git history is available2293. Update orientation only with stable conventions or structural changes; otherwise report refresh results without writing2304. Print: `>> Refreshed project context — [N] changes since last session`231232## Rules233234- **Never skip Phase 1** — even for "quick" tasks in a new repo235- **Don't read everything** — sample representative files, don't read every file236- **Ask about unknowns** — don't guess business logic or domain concepts; ask every material unknown concisely by topic with why/risk/default.237- **Keep memory concise** — under 100 lines, focused on stable development conventions238- **Update, don't overwrite** — if memory.md exists, update sections, don't regenerate239240## Stop Rules241242- Stop and ask every material, non-discoverable question when project path, focus area, or onboarding depth cannot be inferred and changes the inspection plan; group them by topic and keep them concise.243- Stop and report blocked status when required files cannot be read.244- Do not proceed to code changes as part of onboarding.