Skip to content

docs: add /titan-forge skill (Titan Paradigm execution phase)#485

Merged
carlos-alm merged 3 commits into
mainfrom
docs/titan-forge-skill
Mar 17, 2026
Merged

docs: add /titan-forge skill (Titan Paradigm execution phase)#485
carlos-alm merged 3 commits into
mainfrom
docs/titan-forge-skill

Conversation

@carlos-alm
Copy link
Copy Markdown
Contributor

Summary

  • Adds /titan-forge skill — the missing execution phase of the Titan Paradigm that reads sync.json and makes the actual code changes
  • One phase per invocation, resumable across sessions, validates each commit with /titan-gate
  • Phase-specific strategies for dead code removal, shared abstractions, error handling, decomposition, and general fixes
  • Updates docs/examples/claude-code-skills/README.md with FORGE in pipeline diagram, skills table, usage examples, and command reference

Test plan

  • Verify /titan-forge is recognized as a skill by Claude Code
  • Run /titan-forge --dry-run after a /titan-sync to confirm plan parsing
  • Run a full phase execution on a test worktree

Adds the FORGE phase to the Titan Paradigm — reads sync.json produced
by /titan-sync and executes it one phase at a time: understands each
target with codegraph, makes the refactoring change, validates with
/titan-gate, commits, and advances state. Resumable across sessions.
@claude
Copy link
Copy Markdown

claude Bot commented Mar 17, 2026

Claude finished @carlos-alm's task —— View job


PR Review: /titan-forge skill addition

Reviewing PR #485 that adds the /titan-forge skill for Titan Paradigm execution phase.

Review Progress

  • Read and analyze all changed files
  • Phase 1: Root cause analysis
  • Phase 2: Configuration change detection
  • Phase 3: Test integrity check
  • Phase 4: Code quality assessment
  • Phase 5: Backlog compliance evaluation
  • Provide final assessment and recommendation

Root Cause Analysis

Problem Being Solved: Completes the Titan Paradigm skills suite by adding the missing execution phase that reads sync.json plans and makes actual code changes.

Why This Approach: Documents a systematic approach to code execution with phase-by-phase progress tracking, validation gates, and rollback procedures.

Risk Assessment: Low technical risk (documentation only), but architectural concern regarding codegraph's scope boundaries.

Backlog Compliance

  • Zero-dep: ✓ — Uses existing codegraph commands, git, npm test
  • Foundation-aligned: ✗ — Violates Principle 8 ("we are not a coding tool")
  • Problem-fit: 2/5 — Agent orchestration, doesn't solve core orientation problem
  • Breaking: No — Pure documentation
  • Tier: 3 (needs deliberate exception for Principle 8 violation)

Critical Concerns

Foundation Principle Violation

This skill directly contradicts FOUNDATION.md Principle 8:

"We are not an application. We are not a coding tool. We are not an AI agent."
"We don't generate code, suggest fixes, refactor, or translate natural language to code."

The /titan-forge skill:

  • Makes code changes (line 133: "Apply the change")
  • Edits files with phase-specific strategies (lines 73-102)
  • Runs multi-step automated workflows
  • Makes decisions about code structure

Scope Creep Risk

The README acknowledges this is outside codegraph's scope:

"These skills are outside codegraph's core scope as a code intelligence engine."

However, the commit message and PR description present it as a standard feature addition without addressing the foundational conflict.

Documentation Quality

✅ The skill is well-documented with:

  • Clear step-by-step execution flow
  • Proper error handling and rollback procedures
  • Edge case coverage
  • Integration patterns with other Titan skills

Final Recommendation

  • Rating: ⭐⭐☆☆☆ (2/5)
  • Action: REQUEST CHANGES
  • Reasoning: While technically sound documentation, this represents a significant architectural decision that conflicts with established principles. The PR needs either (1) a written justification for why Principle 8 should be relaxed for experimental skills, or (2) restructuring to keep codegraph as a pure intelligence engine while these workflow patterns live elsewhere.

If proceeding, consider:

  1. Moving Titan skills to a separate @optave/codegraph-workflows package
  2. Adding explicit warnings that these violate core principles
  3. Documenting the exception rationale in FOUNDATION.md

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Mar 17, 2026

Greptile Summary

This PR adds /titan-forge — the execution phase of the Titan Paradigm — which reads sync.json, applies code changes target-by-target, validates each commit with /titan-gate, and advances persistent state across sessions. The README is also updated to place FORGE correctly in the pipeline diagram, skills table, usage examples, and command/artifact reference tables.

Key changes:

  • New skill file at .claude/skills/titan-forge/SKILL.md and its documentation mirror at docs/examples/claude-code-skills/titan-forge/SKILL.md (identical blobs): 6-phase execution loop with resumability, subphase tracking, and dry-run/single-target support.
  • docs/examples/claude-code-skills/README.md: FORGE integrated into the pipeline, artifact table, codegraph command table, and usage example.

Issues found:

  • Cycle-detection FAIL should halt the phase (Step 9 vs. Edge Cases contradiction): Step 9 routes all /titan-gate FAILs to step 11 ("continue to next target"), but the Edge Cases section says a new cycle should stop the phase immediately. An LLM following numbered steps will continue past a cycle failure, potentially committing further broken changes on top of a corrupted graph.
  • Premature phase completion for --target and --dry-run runs (Step 3): Step 3 marks the phase complete as soon as the current loop finishes, with no guard for partial-execution modes. A single --target retry or a --dry-run walk will permanently close the phase in completedPhases, causing the next bare invocation to skip all remaining unprocessed targets silently.

Confidence Score: 3/5

  • Safe to merge as documentation, but two logic bugs in the skill's execution loop should be addressed before the skill is used in production refactor runs.
  • The README updates are clean and accurate. The skill itself is well-structured, resumable, and addresses the three issues flagged in prior review rounds. However, two new confirmed logic bugs remain: the cycle-detection FAIL path can silently continue past a broken graph, and partial-execution modes (--target, --dry-run) prematurely close the phase in state, causing subsequent full runs to skip unprocessed targets. Neither bug would cause harm in dry-run mode, but both would produce incorrect outcomes in a live refactor session.
  • .claude/skills/titan-forge/SKILL.md and docs/examples/claude-code-skills/titan-forge/SKILL.md (identical content) — Step 9 cycle handling and Step 3 phase-completion guard both need fixes.

Important Files Changed

Filename Overview
.claude/skills/titan-forge/SKILL.md Core skill file for titan-forge execution phase. Well-structured with clear steps, resumability, and subphase tracking. Two logic issues: cycle-detection FAIL should halt the phase (Step 9 sends it to step 11 "continue" instead), and Step 3 phase-completion fires for partial runs (--target, --dry-run), permanently skipping unprocessed targets.
docs/examples/claude-code-skills/titan-forge/SKILL.md Documentation mirror of .claude/skills/titan-forge/SKILL.md — identical content (same git blob). Carries the same two logic bugs as the active skill file.
docs/examples/claude-code-skills/README.md README updated to integrate FORGE into the pipeline diagram, skills table, usage examples, and artifact/command reference tables. Changes are accurate and consistent with the new skill's behaviour.

Sequence Diagram

sequenceDiagram
    actor User
    participant FORGE as /titan-forge
    participant State as titan-state.json
    participant Gate as /titan-gate
    participant Git as git

    User->>FORGE: invoke (--phase N / --target / --dry-run / --yes)
    FORGE->>Git: fetch + merge origin/main
    FORGE->>State: read sync.json, titan-state.json, gauntlet artifacts
    FORGE->>State: initialize execution block (if first run)
    FORGE-->>User: print plan + confirm (unless --yes)

    loop For each target in phase
        FORGE->>State: set currentTarget
        FORGE->>FORGE: codegraph context + fn-impact
        FORGE->>FORGE: check if already fixed (complexity --health)
        FORGE->>FORGE: apply code change (phase strategy)
        FORGE->>Git: npm test
        alt tests fail
            FORGE->>Git: git checkout -- <files>
            FORGE->>State: add to failedTargets, continue
        else tests pass
            FORGE->>Gate: invoke /titan-gate
            alt gate FAIL (cycle)
                Note over FORGE,Gate: Edge case says "stop immediately"<br/>but Step 9→11 says "continue" ⚠️
                FORGE->>Git: git checkout -- <files>
                FORGE->>State: add to failedTargets
            else gate FAIL (other)
                FORGE->>Git: git checkout -- <files>
                FORGE->>State: add to failedTargets, continue
            else gate PASS
                FORGE->>Git: git add + git commit
                FORGE->>State: record SHA, add to completedTargets
            end
        end
    end

    FORGE->>State: add phase to completedPhases, advance currentPhase
    FORGE-->>User: Phase N complete report + next phase prompt
Loading

Last reviewed commit: 3edd802

Comment thread .claude/skills/titan-forge/SKILL.md Outdated
Comment on lines +138 to +142
```
If tests fail → go to rollback (step 10).

9. **Run /titan-gate:**
Use the Skill tool to invoke `titan-gate`. If FAIL → go to rollback (step 10).
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Wrong rollback step number referenced

Both Step 8 and Step 9 direct the agent to "go to rollback (step 10)", but Step 10 is actually the success handler ("On success: git add … git commit …"). The rollback/failure logic is in Step 11 ("On failure (test or gate)"). An LLM executing this skill will read "step 10" literally and apply the success path instead of rolling back, silently committing a broken change.

Suggested change
```
If tests fail → go to rollback (step 10).
9. **Run /titan-gate:**
Use the Skill tool to invoke `titan-gate`. If FAIL → go to rollback (step 10).
If tests fail → go to rollback (step 11).
9. **Run /titan-gate:**
Use the Skill tool to invoke `titan-gate`. If FAIL → go to rollback (step 11).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 3edd802 — rollback step references corrected from step 10 to step 11 in both Step 8 and Step 9.

Comment on lines +16 to +20
**Arguments** (from `$ARGUMENTS`):
- No args → run next incomplete phase
- `--phase N` → jump to specific phase
- `--target <name>` → run single target only (for retrying failures)
- `--dry-run` → show what would be done without changing code
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 --yes flag undocumented

Step 0.8 reads: "Ask for confirmation before starting (unless $ARGUMENTS contains --yes)", but --yes does not appear in the argument-hint frontmatter or the Arguments list here. Users (and the LLM agent itself when constructing the invocation) cannot discover this flag from the skill's own help text.

Suggested change
**Arguments** (from `$ARGUMENTS`):
- No args → run next incomplete phase
- `--phase N` → jump to specific phase
- `--target <name>` → run single target only (for retrying failures)
- `--dry-run` → show what would be done without changing code
**Arguments** (from `$ARGUMENTS`):
- No args → run next incomplete phase
- `--phase N` → jump to specific phase
- `--target <name>` → run single target only (for retrying failures)
- `--dry-run` → show what would be done without changing code
- `--yes` → skip confirmation prompt before starting

The argument-hint in the frontmatter should also be updated:

argument-hint: <--phase N> <--target name> <--dry-run> <--yes>

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 3edd802 — added --yes to the Arguments list and updated the argument-hint frontmatter.

Comment on lines +46 to +58
5. **Initialize execution state** (if first run). Add to `titan-state.json`:
```json
{
"execution": {
"currentPhase": 1,
"completedPhases": [],
"currentTarget": null,
"completedTargets": [],
"failedTargets": [],
"commits": []
}
}
```
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Subphase tracking missing from execution state schema

The Rules section (line 227) states: "Subphase awareness — phases 3-6 have subphases. Each subphase = one commit. Track at subphase level." However, the execution state block initialized here has no subphase fields (currentSubphase, completedSubphases). If the agent is interrupted mid-subphase (e.g., during Phase 3 error-handling commits), re-running will restart the entire phase rather than picking up from the correct subphase, potentially re-applying already-committed changes.

Consider adding subphase tracking to the schema:

Suggested change
5. **Initialize execution state** (if first run). Add to `titan-state.json`:
```json
{
"execution": {
"currentPhase": 1,
"completedPhases": [],
"currentTarget": null,
"completedTargets": [],
"failedTargets": [],
"commits": []
}
}
```
```json
{
"execution": {
"currentPhase": 1,
"completedPhases": [],
"currentTarget": null,
"currentSubphase": null,
"completedTargets": [],
"completedSubphases": [],
"failedTargets": [],
"commits": []
}
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 3edd802 — added currentSubphase and completedSubphases fields to the execution state schema.

@carlos-alm carlos-alm force-pushed the docs/titan-forge-skill branch from ea74e4c to 3edd802 Compare March 17, 2026 10:19
@carlos-alm
Copy link
Copy Markdown
Contributor Author

@greptileai

@carlos-alm carlos-alm merged commit 7543a55 into main Mar 17, 2026
26 checks passed
@carlos-alm carlos-alm deleted the docs/titan-forge-skill branch March 17, 2026 10:35
@github-actions github-actions Bot locked and limited conversation to collaborators Mar 17, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant