Implementation:0xK3vin MegaMemory git ls files inventory
| Knowledge Sources | |
|---|---|
| Domains | Codebase_Analysis, Shell |
| Last Updated | 2026-10-27 12:00 GMT |
Overview
External shell pipeline for gathering a line-count-ranked file inventory of a project, used to bootstrap a new knowledge graph.
Description
The git ls-files inventory is a shell pipeline embedded in the /bootstrap-memory slash command (commands/bootstrap-memory.md). It lists all tracked and untracked (non-ignored) files in the project, ranks them by line count (largest first), and caps the output to the 150 largest files. This gives the agent a compact inventory to reason about major modules before creating root concepts.
The pipeline is:
{ git ls-files; git ls-files --others --exclude-standard; } 2>/dev/null \
| sort -u | xargs wc -l | sort -rn | head -150
- git ls-files — tracked files
- git ls-files --others --exclude-standard — untracked, non-ignored files
- sort -u — dedupe
- xargs wc -l — line counts
- sort -rn — rank by line count descending
- head -150 — cap to 150 largest files
The command also instructs the agent to READ README.md to ground its module analysis.
External Reference
MegaMemory-Specific Usage
- Run inside the project working directory (must be a git repo, or git ls-files runs under 2>/dev/null)
- The output surfaces into the agent's context for module identification (Step 3 of the bootstrap workflow)
- The 150-file cap keeps the prompt small enough for the LLM to reason over
Code Reference
Source Location
- Repository: 0xK3vin_MegaMemory
- File: commands/bootstrap-memory.md
- Lines: L4 (RUN directive)
Signature
# Literal pipeline in the slash command's RUN directive
{ git ls-files; git ls-files --others --exclude-standard; } 2>/dev/null \
| sort -u | xargs wc -l | sort -rn | head -150
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| cwd | directory | Yes | Project working directory (should be a git repo) |
Outputs
| Name | Type | Description |
|---|---|---|
| stdout | text | Line-count-ranked file listing, max 150 entries |
Usage Examples
Standalone Inventory
# Run the inventory pipeline directly
{ git ls-files; git ls-files --others --exclude-standard; } 2>/dev/null \
| sort -u | xargs wc -l | sort -rn | head -150
# 917 src/db.ts
# 791 src/web.ts
# 724 src/install.ts
# ...
Inside the Bootstrap Workflow
# /user:bootstrap-memory runs the pipeline, then:
# 1. READ README.md
# 2. Identify major modules from the inventory
# 3. list_roots → check existing graph
# 4. create_concept for each root module
# 5. create_concept (with parent_id) for child concepts
# 6. link related concepts