diff --git a/commands/gsd/new-project.md b/commands/gsd/new-project.md
index e73c476b5..5e52346e9 100644
--- a/commands/gsd/new-project.md
+++ b/commands/gsd/new-project.md
@@ -44,7 +44,40 @@ Creates `.planning/` with PROJECT.md and config.json.
fi
```
- **You MUST run both bash commands above using the Bash tool before proceeding.**
+3. **Detect existing code (brownfield detection):**
+ ```bash
+ # Check for existing code files
+ CODE_FILES=$(find . -name "*.ts" -o -name "*.js" -o -name "*.py" -o -name "*.go" -o -name "*.rs" -o -name "*.swift" -o -name "*.java" 2>/dev/null | grep -v node_modules | grep -v .git | head -20)
+ HAS_PACKAGE=$([ -f package.json ] || [ -f requirements.txt ] || [ -f Cargo.toml ] || [ -f go.mod ] || [ -f Package.swift ] && echo "yes")
+ HAS_CODEBASE_MAP=$([ -d .planning/codebase ] && echo "yes")
+ ```
+
+ **You MUST run all bash commands above using the Bash tool before proceeding.**
+
+
+
+**If existing code detected and .planning/codebase/ doesn't exist:**
+
+Check the results from setup step:
+- If `CODE_FILES` is non-empty OR `HAS_PACKAGE` is "yes"
+- AND `HAS_CODEBASE_MAP` is NOT "yes"
+
+Use AskUserQuestion:
+- header: "Existing Code"
+- question: "I detected existing code in this directory. Would you like to map the codebase first?"
+- options:
+ - "Map codebase first" - Run /gsd:map-codebase to understand existing architecture (Recommended)
+ - "Skip mapping" - Proceed with project initialization
+
+**If "Map codebase first":**
+```
+Run `/gsd:map-codebase` first, then return to `/gsd:new-project`
+```
+Exit command.
+
+**If "Skip mapping":** Continue to question step.
+
+**If no existing code detected OR codebase already mapped:** Continue to question step.
@@ -140,6 +173,7 @@ Project initialized:
- Project: .planning/PROJECT.md
- Config: .planning/config.json (mode: [chosen mode])
+[If .planning/codebase/ exists:] - Codebase: .planning/codebase/ (7 documents)
---
diff --git a/commands/gsd/plan-phase.md b/commands/gsd/plan-phase.md
index 1464a433f..0c5dddaf4 100644
--- a/commands/gsd/plan-phase.md
+++ b/commands/gsd/plan-phase.md
@@ -39,6 +39,9 @@ Phase number: $ARGUMENTS (optional - auto-detects next unplanned phase if not pr
**Load phase context if exists (created by /gsd:discuss-phase):**
Check for and read `.planning/phases/XX-name/{phase}-CONTEXT.md` - contains research findings, clarifications, and decisions from phase discussion.
+
+**Load codebase context if exists:**
+Check for `.planning/codebase/` and load relevant documents based on phase type.
diff --git a/get-shit-done/workflows/execute-phase.md b/get-shit-done/workflows/execute-phase.md
index bc12a150f..b8905945d 100644
--- a/get-shit-done/workflows/execute-phase.md
+++ b/get-shit-done/workflows/execute-phase.md
@@ -1148,6 +1148,52 @@ EOF
For commit message conventions and git workflow patterns, see ~/.claude/get-shit-done/references/git-integration.md
+
+**If .planning/codebase/ exists AND files were modified:**
+
+Check if execution modified significant code:
+
+```bash
+# Get list of code files modified in this plan
+MODIFIED_CODE=$(git diff --name-only HEAD~1 2>/dev/null | grep -E '\.(ts|js|py|go|rs|swift|java)$' | grep -v node_modules)
+```
+
+**If significant modifications (>3 code files changed):**
+
+Determine which codebase documents may need update based on what changed:
+
+| Changed Files | Documents to Update |
+|--------------|-------------------|
+| New directories created | STRUCTURE.md |
+| Package dependencies changed | STACK.md, INTEGRATIONS.md |
+| New patterns introduced | ARCHITECTURE.md, CONVENTIONS.md |
+| Test files added/changed | TESTING.md |
+| Config files changed | STACK.md |
+| External service integration | INTEGRATIONS.md |
+
+**Update strategy (incremental, not full remap):**
+
+For each document needing update:
+1. Read current document
+2. Identify what changed (new entries, removed entries, modified sections)
+3. Apply minimal edits to reflect new state
+4. Keep document under 100 lines (summarize if needed)
+
+**Commit codebase updates:**
+```bash
+git add .planning/codebase/*.md
+git commit --amend --no-edit # Include in plan commit
+```
+
+**If no significant changes:**
+Skip codebase update - map is still current.
+
+**If .planning/codebase/ doesn't exist:**
+Skip this step - no codebase map to update.
+
+**Note:** Full remap via `/gsd:map-codebase` is available if incremental updates become stale.
+
+
**Check if issues were created during this phase:**
@@ -1330,4 +1376,5 @@ All [Y] plans finished.
- SUMMARY.md created with substantive content
- STATE.md updated (position, decisions, issues, session)
- ROADMAP.md updated
+- If codebase map exists: map updated with execution changes (or skipped if no significant changes)
diff --git a/get-shit-done/workflows/plan-phase.md b/get-shit-done/workflows/plan-phase.md
index 347537f2f..a3efc64dd 100644
--- a/get-shit-done/workflows/plan-phase.md
+++ b/get-shit-done/workflows/plan-phase.md
@@ -96,6 +96,44 @@ Options:
This ensures planning has full project context.
+
+Check if codebase map exists:
+
+```bash
+ls .planning/codebase/*.md 2>/dev/null
+```
+
+**If .planning/codebase/ exists:**
+
+Determine which codebase documents are relevant based on phase goal:
+
+| Phase Keywords | Load These Documents |
+|----------------|---------------------|
+| UI, frontend, components, layout | CONVENTIONS.md, STRUCTURE.md |
+| API, backend, endpoints, routes | ARCHITECTURE.md, CONVENTIONS.md |
+| database, schema, models, migration | ARCHITECTURE.md, STACK.md |
+| testing, tests, coverage | TESTING.md, CONVENTIONS.md |
+| integration, external, API, service | INTEGRATIONS.md, STACK.md |
+| refactor, cleanup, debt | CONCERNS.md, ARCHITECTURE.md |
+| setup, config, infrastructure | STACK.md, STRUCTURE.md |
+| (default - load minimal set) | STACK.md, ARCHITECTURE.md |
+
+Read the relevant documents and summarize key constraints for this phase:
+- From STACK.md: Technologies that must be used
+- From ARCHITECTURE.md: Patterns that must be followed
+- From CONVENTIONS.md: Code style requirements
+- From CONCERNS.md: Issues to avoid or address
+
+**Add to planning context:**
+Track codebase constraints for inclusion in PLAN.md context section:
+- Which documents loaded
+- Key constraints extracted
+- Patterns to follow
+
+**If .planning/codebase/ doesn't exist:**
+Skip this step - no codebase map available.
+
+
Check roadmap for phases:
```bash
@@ -651,6 +689,16 @@ Output: [What artifacts will be created by this plan]
@.planning/ROADMAP.md
@.planning/STATE.md
+[If codebase map exists (from /gsd:map-codebase):]
+@.planning/codebase/STACK.md
+@.planning/codebase/ARCHITECTURE.md
+[Add other relevant docs based on phase type - see load_codebase_context step]
+
+**Codebase constraints:**
+- [Extracted constraints from codebase documents]
+- [Technologies that must be used]
+- [Patterns that must be followed]
+
[If comprehensive ecosystem research exists (from /gsd:research-phase):]
@.planning/phases/XX-name/{phase}-RESEARCH.md