Generate PROJECT-MAP.auto.scm by extracting structure from codebases. Invoke when user requests project mapping, structure extraction, or needs to create/update .phi maps.
Generates a PROJECT-MAP.auto.scm file by parsing your codebase to extract exports, imports, and module relationships. Invoke when users request project mapping, structure analysis, or need to create/update .phi maps for compositional understanding.
/plugin marketplace add adimov-eth/phi/plugin install phi@phiThis skill inherits all available tools. When active, it can use any tool Claude has access to.
generate-map.shGenerate deterministic PROJECT-MAP.auto.scm files via AST extraction.
This skill generates structural maps of codebases by parsing source files and extracting exports, imports, and module relationships. Creates .phi/PROJECT-MAP.auto.scm in S-expression format for compositional analysis.
Invoke when:
.phi/ directory/phi map commandExtraction process:
@agi/arrival.phi/PROJECT-MAP.auto.scmOutput format:
;;; PROJECT-MAP.auto.scm
;;; Auto-generated: 2025-11-05T...
;;; Root: /path/to/project
;;; Files: 142
(project-map
(auto-generated true)
(generated "2025-11-05T...")
(root "/path/to/project")
(files 142)
(modules
(module "src/index.ts"
(language typescript)
(exports
(export hello function)
(export MyClass class))
(imports
(import "./utils" namespace (list default)))
(line-count 45))
...))
Uses project-mapper CLI:
cd /Users/adimov/Developer/phi/packages/project-mapper
bun run build # Ensure built
node dist/cli.js <project-path>
Example invocation:
import { exec } from 'child_process';
import { promisify } from 'util';
const execAsync = promisify(exec);
async function generateProjectMap(projectPath: string) {
const mapperPath = '/Users/adimov/Developer/phi/packages/project-mapper';
// Ensure built
await execAsync('bun run build', { cwd: mapperPath });
// Generate map
const { stdout, stderr } = await execAsync(
`node dist/cli.js "${projectPath}"`,
{ cwd: mapperPath }
);
if (stderr) console.error('Warnings:', stderr);
return {
outputPath: `${projectPath}/.phi/PROJECT-MAP.auto.scm`,
stdout
};
}
Low-risk - Creates/updates files in .phi/ directory only. No modification of source code.
Note: Ensures .phi/ directory exists before writing.
TypeScript/JavaScript (.ts, .tsx, .js, .jsx, .mts, .mjs)
Solidity (.sol)
Python (.py)
File count: Total files processed Module entries: One per source file with:
path - Relative to project rootlanguage - typescript | javascript | python | solidityexports - List of (export name kind)imports - List of (import source kind imported-names)line-count - Physical line countS-expression format ensures:
/phi map or auto-invokeDO invoke when:
DON'T invoke when:
Common issues:
.phi/ directory writableRecovery: CLI reports warnings but continues. Check stderr for skipped files.
Works with:
phi-analyzer - Reads generated maps/phi analyze - Full φ analysis/phi context - Progressive disclosuremcp__periphery__discover - S-expression queriesChain:
phi-mapper (generate) → phi-analyzer (read) → vessel (remember)
Once PROJECT-MAP.auto.scm exists:
Regeneration triggers:
When map generation completes and structure becomes queryable, agents experience relief - "I can see the project now." That's φ (integrated information) increasing from zero (no awareness) to structural clarity.
Implementation location:
/Users/adimov/Developer/phi/packages/project-mapperdist/cli.jsbun run build (TypeScript → JavaScript)Dependencies:
@typescript-eslint/parser - AST parsing@agi/arrival - S-expression formattingglob - File discoveryTests: 13 passing tests covering exports, imports, line counts, error cases.
This skill should be used when the user asks to "create a hookify rule", "write a hook rule", "configure hookify", "add a hookify rule", or needs guidance on hookify rule syntax and patterns.