Personal_AI_Infrastructure icon indicating copy to clipboard operation
Personal_AI_Infrastructure copied to clipboard

bug(research): Stale references, orphaned agent, and phantom file paths in Research skill

Open rikitikitavi2012-debug opened this issue 9 months ago • 4 comments

Summary

The Research skill (v3.0) contains several stale references to deleted files, an orphaned agent that depends on an uninstalled CLI tool, and phantom file paths that point to non-existent workflows. Found during a systematic audit of the Research skill and agent context files.

Bugs Found

1. CodexResearcher is fully orphaned

  • Files: agents/CodexResearcher.md, skills/Agents/CodexResearcherContext.md
  • Problem: CodexResearcher depends on codex CLI (codex exec --sandbox danger-full-access), which is not installed and not part of PAI dependencies. The agent is not referenced in any Research workflow (Quick/Standard/Extensive all use Claude+Gemini+Grok).
  • Suggested fix: Remove both files, clean any remaining references.

2. PerplexityResearcher references non-existent workflow

  • File: agents/PerplexityResearcher.md (line 171)
  • Problem: References ~/.claude/skills/Research/Workflows/PerplexityResearch.md — this file was removed (confirmed by MigrationNotes.md line 45: "Conduct.md and PerplexityResearch.md were later removed").
  • Suggested fix: Update the Research Methodology section to reflect actual tools (WebSearch/WebFetch).

3. DeepInvestigation.md uses PerplexityResearcher inconsistently

  • File: skills/Research/Workflows/DeepInvestigation.md (lines 206, 240)
  • Problem: References subagent_type: "PerplexityResearcher" while all other workflows use the Claude+Gemini+Grok trio. PerplexityResearcher doesn't add unique capability — all researcher agents use WebSearch as their actual tool.
  • Suggested fix: Replace with GrokResearcher to maintain the consistent Claude+Gemini+Grok trio across all workflows.

4. ClaudeResearch.md is redundant TypeScript with broken path

  • File: skills/Research/Workflows/ClaudeResearch.md
  • Problem: Contains TypeScript code (not a workflow spec) with a broken import path (${PAI_DIR}/commands/perform-claude-research.md). QuickResearch.md already provides the same capability (single ClaudeResearcher with WebSearch).
  • Suggested fix: Remove the file, update SKILL.md routing to point to QuickResearch.md.

5. REDESIGN-SUMMARY.md has phantom references

  • File: skills/Agents/REDESIGN-SUMMARY.md (lines 68-69)
  • Problem: References skills/PAI/CONSTITUTION.md and skills/PAI/CoreStack.md — both files no longer exist in v3.0 (consolidated into skills/PAI/SKILL.md).
  • Suggested fix: Update references to skills/PAI/SKILL.md.

Verification

All bugs confirmed present in upstream at Releases/v3.0/.claude/:

# CodexResearcher exists but codex CLI not available
agents/CodexResearcher.md ✓
skills/Agents/CodexResearcherContext.md ✓

# Stale workflow reference
agents/PerplexityResearcher.md:171 → PerplexityResearch.md (deleted)

# Inconsistent researcher type
skills/Research/Workflows/DeepInvestigation.md:206,240 → PerplexityResearcher

# Redundant TypeScript workflow
skills/Research/Workflows/ClaudeResearch.md → broken ${PAI_DIR} path

# Phantom file references
skills/Agents/REDESIGN-SUMMARY.md:68-69 → CONSTITUTION.md, CoreStack.md (deleted)

Impact

  • CodexResearcher: Users may try to invoke it and get failures (codex CLI not found)
  • Stale references: Agents loading context get pointed to non-existent files
  • Phantom paths: New contributors may waste time looking for files that don't exist

Environment

  • PAI v3.0.0
  • Claude Code with Opus 4.6
  • Linux/WSL2

Happy to submit a PR with fixes if helpful.

rikitikitavi2012-debug avatar Feb 27 '26 00:02 rikitikitavi2012-debug

Closing — verified that the Research skill's agent references (ClaudeResearcher, GeminiResearcher, PerplexityResearcher, etc.) all exist in .claude/agents/. No stale references found in current codebase.

kaimagnus avatar Mar 01 '26 02:03 kaimagnus

Err... sorry but I also cannot find any PAI/CoreStack.md or PAI/CONSTITUTION.md and they are mentioned here, and in other places, even in v4.0.3:

https://github.com/danielmiessler/Personal_AI_Infrastructure/blob/1f96d6d0875a8691e3c35a1148e9fc1377134e7a/Releases/v4.0.3/.claude/skills/Agents/EngineerContext.md?plain=1#L34-L35

Could you clarify?

esciara avatar Mar 02 '26 16:03 esciara

It seems that at least for the Engineer agent, the constitution has been move here:

https://github.com/danielmiessler/Personal_AI_Infrastructure/blob/1f96d6d0875a8691e3c35a1148e9fc1377134e7a/Releases/v4.0.3/.claude/agents/Engineer.md?plain=1#L164

https://github.com/danielmiessler/Personal_AI_Infrastructure/blob/1f96d6d0875a8691e3c35a1148e9fc1377134e7a/Releases/v4.0.3/.claude/agents/Engineer.md?plain=1#L236-L258

esciara avatar Mar 02 '26 16:03 esciara

Here is my local fix:

PAI Phantom References Audit

Date: 2026-03-02 Related Issue: https://github.com/danielmiessler/Personal_AI_Infrastructure/issues/812


Summary

A comprehensive audit of ~/.claude/ found 78 phantom references — file paths referenced in markdown/code that point to files that do not exist on disk. These cause silent failures every time an agent starts up and tries to load its context.


Corrections Made This Session

Before the audit, we made the following changes:

# File Action Detail
1 agents/PythonEngineer.md Created New Python-specialist Engineer agent (Marcus Webb variant, green color, Python-first)
2 skills/Agents/PythonEngineerContext.md Created Python Engineer context absorbing all content from skills/python-development/SKILL.md
3 agents/Engineer.md line 300 Fixed Changed "Python > TypeScript (we hate TypeScript)" → "TypeScript > Python (we hate Python)" — resolved contradiction with EngineerContext.md
4 skills/python-development/SKILL.md Replaced Now redirects to PythonEngineer agent and its context file

Critical Phantom References (Highest Impact)

1. PAI/CoreStack.md — MISSING (12 references)

Impact: Every single agent context file tries to load this on startup.

Referenced from:

  • skills/Agents/EngineerContext.md:34
  • skills/Agents/PythonEngineerContext.md:34
  • skills/Agents/ArchitectContext.md:35
  • skills/Agents/DesignerContext.md:34
  • skills/Agents/ArtistContext.md:34
  • skills/Agents/QATesterContext.md:34
  • skills/Agents/ClaudeResearcherContext.md:36
  • skills/Agents/CodexResearcherContext.md:36
  • skills/Agents/GeminiResearcherContext.md:36
  • skills/Agents/GrokResearcherContext.md:36
  • skills/Agents/PerplexityResearcherContext.md:36
  • skills/Agents/REDESIGN-SUMMARY.md:69

Where the content actually lives: Scattered across agent definitions as inline preferences (e.g., "TypeScript > Python, bun > npm"). Also referenced as PAI/USER/TECHSTACKPREFERENCES.md in PAI/DOCUMENTATIONINDEX.md:57 — but that file is also missing.

Recommendation: Create PAI/CoreStack.md consolidating all stack preferences from agent definitions into one canonical source.


2. PAI/CONSTITUTION.md — MISSING (12 references)

Impact: Every single agent context file tries to load this on startup.

Referenced from: Same 12 files as CoreStack.md above.

Where the content actually lives: The "Nine Articles of Development" are embedded inline in agents/Engineer.md (lines 236-258) and agents/PythonEngineer.md. Also summarized in PAI/SKILL.md.

Recommendation: Extract the Constitution from Engineer.md into PAI/CONSTITUTION.md as the single source of truth. Have both Engineer agents reference it instead of duplicating inline.


3. skills/Development/ — ENTIRE DIRECTORY MISSING (4 agent contexts, 7 files)

Impact: Engineer, PythonEngineer, Architect, and QATester agents all fail to load development standards.

Missing files:

  • skills/Development/SKILL.md
  • skills/Development/METHODOLOGY.md
  • skills/Development/TESTING.md
  • skills/Development/TestingPhilosophy.md
  • skills/Development/References/cli-testing-standards.md
  • skills/Development/References/stack-integrations.md
  • skills/Development/References/APIDesign.md

Where the content actually lives: Testing practices are partially in skills/python-development/SKILL.md (now in skills/Agents/PythonEngineerContext.md). TDD philosophy is inline in agents/Engineer.md. No standalone files exist for methodology, CLI testing standards, or stack integrations.

Recommendation: Create the skills/Development/ directory with at least SKILL.md, TESTING.md, and TestingPhilosophy.md extracted from existing inline content.


4. PAI/SecurityProtocols.md — MISSING (4 references)

Referenced from:

  • skills/Agents/EngineerContext.md:50
  • skills/Agents/PythonEngineerContext.md:50
  • skills/Agents/ArchitectContext.md:52
  • skills/Agents/REDESIGN-SUMMARY.md:73

Where the content actually lives: Nowhere. The PAI/PAISECURITYSYSTEM/ directory is also referenced but missing.

Recommendation: Create PAI/SecurityProtocols.md or remove the references.


5. skills/FrontendDesign/ — ENTIRE DIRECTORY MISSING (1 agent context, 6 files)

Impact: Designer agent fails to load all frontend design standards.

Missing files:

  • skills/FrontendDesign/SKILL.md
  • skills/FrontendDesign/Standards.md
  • skills/FrontendDesign/References/AccessibilityGuidelines.md
  • skills/FrontendDesign/References/ResponsivePatterns.md
  • skills/FrontendDesign/References/ComponentPatterns.md
  • skills/FrontendDesign/Workflows/DesignReview.md

Recommendation: Create the directory or remove references from skills/Agents/DesignerContext.md.


Wrong Path References (File Exists at Different Location)

Referenced As Actual Location Source File
skills/PAI/SKILL.md PAI/SKILL.md (no skills/ prefix) agents/Algorithm.md:47
skills/Fabric/* skills/Utilities/Fabric/ PAI/THEFABRICSYSTEM.md, skills/Research/Workflows/Fabric.md
skills/BrowserAutomation/ skills/Utilities/Browser/SKILL.md agents/QATester.md:209
skills/Science/Protocol.md skills/Thinking/Science/Protocol.md PAI/SKILLSYSTEM.md:227
skills/Createskill/Workflows/CanonicalizeSkill.md skills/Utilities/CreateSkill/Workflows/CanonicalizeSkill.md PAI/SKILLSYSTEM.md:513
skills/art/Tools/Generate.ts (lowercase) skills/Media/Art/Tools/Generate.ts Multiple Art workflows
skills/Remotion/Tools/Theme.ts skills/Media/Remotion/Tools/Theme.ts skills/Media/Remotion/ArtIntegration.md
skills/Parser/Workflows/ExtractYoutube.md skills/Utilities/Parser/Workflows/ExtractYoutube.md skills/Media/Remotion/Workflows/ContentToAnimation.md:43

Recommendation: Fix the paths in the source files to point to actual locations.


Research Agents — 26 Phantom Workflow Files

All 5 researcher context files reference skills/Research/Standards.md (missing) plus specialized workflows that were planned but never created:

ClaudeResearcherContext.md: AcademicResearch.md, QueryDecomposition.md, SourceSynthesis.md, StrategicAnalysis.md

CodexResearcherContext.md: TechnicalResearch.md, APIResearch.md, MultiModelResearch.md, LiveDataResearch.md

GeminiResearcherContext.md: MultiPerspectiveAnalysis.md, ScenarioPlanning.md, ComprehensiveCoverage.md, ParallelResearch.md

GrokResearcherContext.md: SocialAnalysis.md, XResearch.md, FactChecking.md, UnbiasedAnalysis.md

PerplexityResearcherContext.md: InvestigativeResearch.md, CitationTracking.md, SourceVerification.md, DeepDiveAnalysis.md

Plus skills/Research/Workflows/PerplexityResearch.md — documented as removed in MigrationNotes.md ("consolidated into QuickResearch.md") but still referenced in agents/PerplexityResearcher.md:171.

Recommendation: Either create these workflow files or remove the references from context files. The agents function without them but expect to load them.


Artist/Media Phantom References

Phantom File Source File Notes
skills/Media/Art/Standards.md skills/Agents/ArtistContext.md:39 No alternate location found
skills/Media/Art/Workflows/Video.md skills/Agents/ArtistContext.md:49 No alternate location found
skills/Media/Art/Workflows/YouTubeThumbnail.md skills/Agents/ArtistContext.md:50 YouTubeThumbnailChecklist.md exists (different name)
PAI/Aesthetic.md skills/Media/Art/Workflows/Comparisons.md:52 No alternate location found
skills/Images/Workflows/BackgroundRemoval.md skills/Media/Art/Workflows/Visualize.md:104 No alternate location found

USER Content Placeholders (Lower Priority)

These are template paths in PAI/USER/ for personal content. The directory structure exists but files were never populated:

  • Identity: ABOUTME.md, RESUME.md, CONTACTS.md, WRITINGSTYLE.md, RHETORICALSTYLE.md, OPINIONS.md, DEFINITIONS.md
  • DA Identity: DAIDENTITY.md, DAWRITINGSTYLE.md, OUR_STORY.md
  • TELOS (19 files): TELOS.md, MISSION.md, GOALS.md, CHALLENGES.md, BELIEFS.md, PREDICTIONS.md, WISDOM.md, BOOKS.md, MOVIES.md, AUTHORS.md, LEARNED.md, WRONG.md, FRAMES.md, MODELS.md, NARRATIVES.md, STRATEGIES.md, PROJECTS.md, PROBLEMS.md, TRAUMAS.md
  • Preferences: TECHSTACKPREFERENCES.md, RESPONSEFORMAT.md, ASSETMANAGEMENT.md, CORECONTENT.md, PRODUCTIVITY.md
  • SKILLCUSTOMIZATIONS (10 empty dirs): Agents/, Art/, Remotion/, USMetrics/, AnnualReports/, Apify/, BrightData/, WebAssessment/, PrivateInvestigator/, ExtractWisdom/

Recommendation: These are by-design placeholders. Low priority — populate as needed.


Miscellaneous

Phantom File Source File Notes
PAI/BROWSERAUTOMATION.md PAI/CONTEXT_ROUTING.md:18 No alternate location
PAI/DEPLOYMENT.md PAI/CONTEXT_ROUTING.md:23 No alternate location
FEEDSYSTEM.md PAI/DOCUMENTATIONINDEX.md:20 No alternate location
ARBOLSYSTEM.md PAI/DOCUMENTATIONINDEX.md:24 No alternate location
TERMINALTABS.md PAI/DOCUMENTATIONINDEX.md:72, PAI/THEHOOKSYSTEM.md:606 No alternate location
PAI/FLOWS/flow-index.json PAI/FLOWS.md:93 Only README.md in that dir
PAI/DOCUMENTATION/FileBasedMCPs.md skills/Scraping/Apify/SKILL.md:43 Entire directory missing

Recommended Fix Priority

  1. Create PAI/CONSTITUTION.md — Extract from Engineer.md, single source of truth (12 agents blocked)
  2. Create PAI/CoreStack.md — Consolidate stack preferences (12 agents blocked)
  3. Create skills/Development/ directory — At minimum SKILL.md, TESTING.md, TestingPhilosophy.md (4 agents blocked)
  4. Fix wrong-path references — 8 files pointing to wrong locations (easy fixes)
  5. Create PAI/SecurityProtocols.md — Or remove references (4 agents blocked)
  6. Create skills/FrontendDesign/ — Or remove references from DesignerContext (1 agent blocked)
  7. Clean up research workflow references — Create or remove 26 phantom files (5 agents affected)
  8. Fix Artist/Media references — 5 phantom files (1 agent affected)
  9. USER content — Populate as needed (template placeholders, low priority)

esciara avatar Mar 02 '26 17:03 esciara