Potpie Source Ingestion
Use this skill for explicit ingestion requests. The harness is the intelligence:
it gathers source data, reads it, decides what is durable, resolves identity, and
writes semantic graph mutations with evidence. Potpie validates and stores; it
does not decide what source material means.
Non-Negotiables
- Use a todo/checklist for every repository or multi-source ingestion. Do not
jump directly from a README to graph writes.
- Local inspection is required for repo understanding. Scanner-driven graph
updates are forbidden. Inspect files with
rg, rg --files, git, and
structured tooling; do not run legacy or deterministic ingestion/scanner
commands that walk the tree and write graph facts.
- Use subagents only for read-only discovery slices. The main agent owns source
selection, identity resolution, mutation proposals, commits, and final
synthesis.
- Do not write until each required discovery lane is complete, explicitly
unavailable, or intentionally scoped out by the user.
- Every write needs source refs, source authority, truth class, confidence,
compact summary, and retrieval-grade description.
Phase 0: Scope And Preflight
- Define source kind, pot/project, repo/path/URL, time window, and target memory
shape: baseline, history, docs, infra, debug memory, preferences, or all.
- Verify Potpie scope and graph availability:
potpie --json pot info
potpie --json source list
potpie --json graph status
potpie --json graph catalog --task "harness-led source ingestion"
- If the repo is not registered, register metadata only. Use explicit
--pot
when pot scope is ambiguous:
potpie source add repo . --pot <pot-id-or-name>
- Describe the views you expect to write/read before authoring mutations:
potpie --json graph describe features --view feature_context --examples
potpie --json graph describe infra_topology --view service_neighborhood --examples
potpie --json graph describe recent_changes --view timeline --examples
potpie --json graph describe decisions --view preferences_for_scope --examples
potpie --json graph describe debugging --view prior_occurrences --examples
- If the CLI is unavailable or broken, continue discovery, build the proposed
evidence matrix, and stop before committing graph writes.
Phase 1: Todo Plan
Create and maintain todos with at least these lanes for repository ingestion:
- Scope, pot, source registration, and graph contract preflight.
- Product/docs: README, docs, ADRs, runbooks, public docs, linked websites.
- Local repo map: manifests, packages/apps, entrypoints, route/API surfaces,
tests, framework config, major modules, generated/API specs.
- Runtime/deploy: Dockerfiles, compose, Kubernetes, Terraform, CI workflows,
deploy scripts, environment templates, feature flags.
- API/data/integrations: service clients, adapters, datastores, models,
queues, auth providers, external APIs.
- GitHub/history: repo metadata, topics, releases/tags, recent merged PRs, open
issues, linked tickets/docs, CI/deploy records.
- Preferences/workflows: explicit coding style, test commands, local dev setup,
release/deploy/runbook workflows.
- Synthesis: evidence matrix, candidate graph facts, identity resolution,
proposal, verified commit, and gate-driven follow-up checks.
Update todos as lanes finish. Preserve uncertain findings for the inbox instead
of forcing them into canonical graph claims.
Phase 2: Parallel Discovery
Parallelize independent read-only slices when tools allow it. Recommended
subagent prompts:
- Docs/product: "Read README, docs, ADRs, runbooks, package metadata, and linked
product pages. Return product purpose, features, explicit decisions,
preferences, workflows, and source refs. Do not write mutations."
- Local architecture: "Inspect manifests, top-level apps/packages, entrypoints,
route/API surfaces, tests, and framework config. Return service/module map,
likely features, explicit source files, uncertainty, and no mutations."
- Runtime/deploy: "Inspect Docker/compose/Kubernetes/Terraform/CI/deploy/env
templates. Return environments, deploy shape, config variables, workflows,
datastores, and source refs. Do not write mutations."
- API/data/integrations: "Inspect route specs, client/adapters, models,
datastores, queues, auth, and external integrations. Return candidate
APIContract/DataStore/Adapter/Dependency facts with evidence. No mutations."
- GitHub history: "Use GitHub tools/CLI for repo metadata, releases, recent
merged PRs, open issues, linked tickets/docs, and CI signal. Return timeline,
fixes, decisions, bug patterns, and source refs. No mutations."
- Preferences: "Find explicit preferences in docs, config, tests, contribution
guides, PR templates, and comments. Return only explicit reusable policies
with evidence. No mutations."
The main agent should continue non-overlapping discovery while subagents run.
Phase 3: Local Repo Inspection Targets
Use structured, bounded local inspection. Examples:
rg --files -g 'README*' -g 'docs/**' -g '*ADR*' -g 'package.json' -g 'pyproject.toml' -g 'Cargo.toml' -g 'go.mod'
rg --files -g 'Dockerfile*' -g 'docker-compose*' -g '.github/workflows/**' -g '*.tf' -g 'k8s/**' -g '.env*'
rg -n "FastAPI|APIRouter|express\\(|router\\.|Django|Flask|NextResponse|route\\(" .
rg -n "postgres|mysql|redis|mongo|s3|kafka|rabbit|queue|oauth|stripe|slack|github|linear|jira" .
rg -n "pytest|vitest|jest|playwright|make test|npm test|uv run|cargo test" README* docs .github pyproject.toml package.json Makefile
Do not infer durable facts from filenames alone. Use files to locate sources of
truth, then read the relevant snippets or authored docs.
Phase 4: Hosted/GitHub Hydration
Use the agent's integration tools/connectors, including GitHub app/MCP/CLI
tools when available, not Potpie queue ingestion commands. For GitHub-backed
repo ingestion, gather the items below. Do not use Potpie CLI queue ingestion.
- Repository metadata: full name, default branch, description, topics,
visibility, homepage, license, archived/fork status.
- Documentation: README, contributing guide, CODEOWNERS, PR/issue templates,
docs linked from the repo.
- Releases/tags when they describe shipped behavior or deploy cadence.
- Recent merged PRs: title, body, author, merged date, branch, labels, linked
issues, changed filenames; fetch patches only when author text is insufficient.
- Open/high-signal issues: title, body, labels, state, author, comments when
available; issues can record requests/bugs but do not prove fixes.
- CI/workflows: workflow files and failed/passing runs only when relevant to
durable workflows, release process, or recurring failures.
- Linked systems: Linear/Jira/Confluence/Slack/docs mentioned in repo, PRs, or
issues when corresponding tools are available.
Respect API limits and user scope. Prefer recent/high-signal items over
exhaustive pagination unless the user explicitly asks for full history.
Phase 5: Evidence Matrix
Before writing, build a compact matrix:
| Candidate |
Graph family |
Source refs |
Authority |
Truth class |
Confidence |
Action |
| Feature/service/dependency/etc. |
features/infra/etc. |
file, PR, doc, issue |
authoritative_code, repository_metadata, external_system, user_statement, agent_observation |
authoritative_fact, source_observation, agent_claim, preference, timeline_event |
0.0-1.0 |
commit / inbox / skip |
Guidelines:
- Use
authoritative_fact for explicit docs/config/code ownership facts.
- Use
source_observation for observed source material that may not be policy.
- Use
agent_claim for lower-authority synthesis from multiple weak signals.
- Use
preference only for explicit reusable project preferences.
- Use
timeline_event for source-time activity from PRs, tickets, releases, or
deployments.
- Put uncertain but potentially useful findings into
graph inbox add.
Phase 6: Identity Resolution
Resolve before linking. Use specific filters when known:
potpie graph search-entities "<repo service feature dependency>" --limit 10
potpie graph search-entities "<service>" --type Service --environment prod --limit 10
potpie graph search-entities "<github-or-ticket-id>" --source-ref <github-or-ticket-ref> --limit 10
Reuse canonical keys. If duplicate candidates appear, stop and use inbox or a
review-required correction flow; do not create near-duplicate entities.
Phase 7: Write
Author semantic mutation JSON from the live graph catalog and graph describe
examples. graph mutation-template is only a skeleton helper, not the source of
truth.
potpie --json graph propose --file mutation.json
Inspect proposal status, diff, warnings, rejected operations, conflicts, and
review flags:
invalid or rejected operations: fix the mutation or skip the weak fact.
conflict or duplicate risk: resolve identity or use inbox.
review_required: ask for approval or commit only with the required
--approved-by value when policy allows.
validated / low-risk: commit with --verify.
potpie --json graph commit <plan_id> --verify
potpie --json graph history --plan <plan_id>
For large batches of agent-authored mutations, use graph bulk apply with
dry-run, chunking, manifest, and verify. Bulk apply must only apply facts the
harness already selected.
Phase 8: Verify And Quality Gate
graph commit --verify reads back committed claims and checks quality. When it
warns or fails, drill down with affected reads and quality reports:
potpie graph read --subgraph features --view feature_context --scope anchor_entity_key:<repo-key> --limit 50
potpie graph read --subgraph infra_topology --view service_neighborhood --scope service:<service> --depth 2 --direction both --limit 50
potpie graph read --subgraph recent_changes --view timeline --scope repo:<repo> --limit 50 --format table
potpie --json graph quality duplicate-candidates --limit 20
potpie --json graph quality low-confidence --limit 20
potpie --json graph quality conflicting-claims --limit 20
potpie --json graph quality orphan-entities --limit 20
If the verified commit misses expected facts, fix the mutation or record an inbox item.
Report what was ingested, what was skipped, and what remains uncertain.
Repository Baseline
For repository ingestion, run baseline before change history. Use
potpie-repo-baseline in deep mode when the user asks to ingest or understand a
repo deeply. Record source-backed purpose, application type, features,
service/module map, API contracts, datastores, integrations, environments,
deploy shape, ownership, and explicit project preferences. Then use
potpie-change-timeline for recent or historical activity. Do not infer
baseline architecture from PR titles or issue status.
Represent capabilities as Feature entities. Link repositories or services to
features with PROVIDES, and use IMPLEMENTED_IN only when a source locates
the implementation.
Source Rules
- Tickets and issues can record timeline events, bug patterns, decisions, and
docs. They do not prove a fix unless tied to a merged PR, commit, deployment,
or explicit shipped-resolution source.
- Documents can record preferences, decisions, runbook notes, service notes, and
infra facts only when they explicitly say them.
- Logs and transcripts can record diagnostic signals, investigations, fixes, and
verifications. Keep raw logs out of descriptions except for short distinctive
error text.
1---2name: potpie-source-ingestion3description: Use when the user explicitly asks to ingest, refresh, or deeply understand a repository, PR, issue, ticket, runbook, incident report, document, or web link into Potpie. The harness performs todo-driven discovery, uses local/GitHub/integration tools and read-only subagents when available, builds evidence-backed semantic mutations, and writes through graph propose/verified commit.4---56# Potpie Source Ingestion78Use this skill for explicit ingestion requests. The harness is the intelligence:9it gathers source data, reads it, decides what is durable, resolves identity, and10writes semantic graph mutations with evidence. Potpie validates and stores; it11does not decide what source material means.1213## Non-Negotiables1415- Use a todo/checklist for every repository or multi-source ingestion. Do not16 jump directly from a README to graph writes.17- Local inspection is required for repo understanding. Scanner-driven graph18 updates are forbidden. Inspect files with `rg`, `rg --files`, `git`, and19 structured tooling; do not run legacy or deterministic ingestion/scanner20 commands that walk the tree and write graph facts.21- Use subagents only for read-only discovery slices. The main agent owns source22 selection, identity resolution, mutation proposals, commits, and final23 synthesis.24- Do not write until each required discovery lane is complete, explicitly25 unavailable, or intentionally scoped out by the user.26- Every write needs source refs, source authority, truth class, confidence,27 compact summary, and retrieval-grade description.2829## Phase 0: Scope And Preflight30311. Define source kind, pot/project, repo/path/URL, time window, and target memory32 shape: baseline, history, docs, infra, debug memory, preferences, or all.332. Verify Potpie scope and graph availability:3435```bash36potpie --json pot info37potpie --json source list38potpie --json graph status39potpie --json graph catalog --task "harness-led source ingestion"40```41423. If the repo is not registered, register metadata only. Use explicit `--pot`43 when pot scope is ambiguous:4445```bash46potpie source add repo . --pot <pot-id-or-name>47```48494. Describe the views you expect to write/read before authoring mutations:5051```bash52potpie --json graph describe features --view feature_context --examples53potpie --json graph describe infra_topology --view service_neighborhood --examples54potpie --json graph describe recent_changes --view timeline --examples55potpie --json graph describe decisions --view preferences_for_scope --examples56potpie --json graph describe debugging --view prior_occurrences --examples57```58595. If the CLI is unavailable or broken, continue discovery, build the proposed60 evidence matrix, and stop before committing graph writes.6162## Phase 1: Todo Plan6364Create and maintain todos with at least these lanes for repository ingestion:6566- Scope, pot, source registration, and graph contract preflight.67- Product/docs: README, docs, ADRs, runbooks, public docs, linked websites.68- Local repo map: manifests, packages/apps, entrypoints, route/API surfaces,69 tests, framework config, major modules, generated/API specs.70- Runtime/deploy: Dockerfiles, compose, Kubernetes, Terraform, CI workflows,71 deploy scripts, environment templates, feature flags.72- API/data/integrations: service clients, adapters, datastores, models,73 queues, auth providers, external APIs.74- GitHub/history: repo metadata, topics, releases/tags, recent merged PRs, open75 issues, linked tickets/docs, CI/deploy records.76- Preferences/workflows: explicit coding style, test commands, local dev setup,77 release/deploy/runbook workflows.78- Synthesis: evidence matrix, candidate graph facts, identity resolution,79 proposal, verified commit, and gate-driven follow-up checks.8081Update todos as lanes finish. Preserve uncertain findings for the inbox instead82of forcing them into canonical graph claims.8384## Phase 2: Parallel Discovery8586Parallelize independent read-only slices when tools allow it. Recommended87subagent prompts:8889- Docs/product: "Read README, docs, ADRs, runbooks, package metadata, and linked90 product pages. Return product purpose, features, explicit decisions,91 preferences, workflows, and source refs. Do not write mutations."92- Local architecture: "Inspect manifests, top-level apps/packages, entrypoints,93 route/API surfaces, tests, and framework config. Return service/module map,94 likely features, explicit source files, uncertainty, and no mutations."95- Runtime/deploy: "Inspect Docker/compose/Kubernetes/Terraform/CI/deploy/env96 templates. Return environments, deploy shape, config variables, workflows,97 datastores, and source refs. Do not write mutations."98- API/data/integrations: "Inspect route specs, client/adapters, models,99 datastores, queues, auth, and external integrations. Return candidate100 APIContract/DataStore/Adapter/Dependency facts with evidence. No mutations."101- GitHub history: "Use GitHub tools/CLI for repo metadata, releases, recent102 merged PRs, open issues, linked tickets/docs, and CI signal. Return timeline,103 fixes, decisions, bug patterns, and source refs. No mutations."104- Preferences: "Find explicit preferences in docs, config, tests, contribution105 guides, PR templates, and comments. Return only explicit reusable policies106 with evidence. No mutations."107108The main agent should continue non-overlapping discovery while subagents run.109110## Phase 3: Local Repo Inspection Targets111112Use structured, bounded local inspection. Examples:113114```bash115rg --files -g 'README*' -g 'docs/**' -g '*ADR*' -g 'package.json' -g 'pyproject.toml' -g 'Cargo.toml' -g 'go.mod'116rg --files -g 'Dockerfile*' -g 'docker-compose*' -g '.github/workflows/**' -g '*.tf' -g 'k8s/**' -g '.env*'117rg -n "FastAPI|APIRouter|express\\(|router\\.|Django|Flask|NextResponse|route\\(" .118rg -n "postgres|mysql|redis|mongo|s3|kafka|rabbit|queue|oauth|stripe|slack|github|linear|jira" .119rg -n "pytest|vitest|jest|playwright|make test|npm test|uv run|cargo test" README* docs .github pyproject.toml package.json Makefile120```121122Do not infer durable facts from filenames alone. Use files to locate sources of123truth, then read the relevant snippets or authored docs.124125## Phase 4: Hosted/GitHub Hydration126127Use the agent's integration tools/connectors, including GitHub app/MCP/CLI128tools when available, not Potpie queue ingestion commands. For GitHub-backed129repo ingestion, gather the items below. Do not use Potpie CLI queue ingestion.130131- Repository metadata: full name, default branch, description, topics,132 visibility, homepage, license, archived/fork status.133- Documentation: README, contributing guide, CODEOWNERS, PR/issue templates,134 docs linked from the repo.135- Releases/tags when they describe shipped behavior or deploy cadence.136- Recent merged PRs: title, body, author, merged date, branch, labels, linked137 issues, changed filenames; fetch patches only when author text is insufficient.138- Open/high-signal issues: title, body, labels, state, author, comments when139 available; issues can record requests/bugs but do not prove fixes.140- CI/workflows: workflow files and failed/passing runs only when relevant to141 durable workflows, release process, or recurring failures.142- Linked systems: Linear/Jira/Confluence/Slack/docs mentioned in repo, PRs, or143 issues when corresponding tools are available.144145Respect API limits and user scope. Prefer recent/high-signal items over146exhaustive pagination unless the user explicitly asks for full history.147148## Phase 5: Evidence Matrix149150Before writing, build a compact matrix:151152| Candidate | Graph family | Source refs | Authority | Truth class | Confidence | Action |153|---|---|---|---|---|---|---|154| Feature/service/dependency/etc. | features/infra/etc. | file, PR, doc, issue | authoritative_code, repository_metadata, external_system, user_statement, agent_observation | authoritative_fact, source_observation, agent_claim, preference, timeline_event | 0.0-1.0 | commit / inbox / skip |155156Guidelines:157158- Use `authoritative_fact` for explicit docs/config/code ownership facts.159- Use `source_observation` for observed source material that may not be policy.160- Use `agent_claim` for lower-authority synthesis from multiple weak signals.161- Use `preference` only for explicit reusable project preferences.162- Use `timeline_event` for source-time activity from PRs, tickets, releases, or163 deployments.164- Put uncertain but potentially useful findings into `graph inbox add`.165166## Phase 6: Identity Resolution167168Resolve before linking. Use specific filters when known:169170```bash171potpie graph search-entities "<repo service feature dependency>" --limit 10172potpie graph search-entities "<service>" --type Service --environment prod --limit 10173potpie graph search-entities "<github-or-ticket-id>" --source-ref <github-or-ticket-ref> --limit 10174```175176Reuse canonical keys. If duplicate candidates appear, stop and use inbox or a177review-required correction flow; do not create near-duplicate entities.178179## Phase 7: Write180181Author semantic mutation JSON from the live `graph catalog` and `graph describe`182examples. `graph mutation-template` is only a skeleton helper, not the source of183truth.184185```bash186potpie --json graph propose --file mutation.json187```188189Inspect proposal status, diff, warnings, rejected operations, conflicts, and190review flags:191192- `invalid` or rejected operations: fix the mutation or skip the weak fact.193- `conflict` or duplicate risk: resolve identity or use inbox.194- `review_required`: ask for approval or commit only with the required195 `--approved-by` value when policy allows.196- `validated` / low-risk: commit with `--verify`.197198```bash199potpie --json graph commit <plan_id> --verify200potpie --json graph history --plan <plan_id>201```202203For large batches of agent-authored mutations, use `graph bulk apply` with204dry-run, chunking, manifest, and verify. Bulk apply must only apply facts the205harness already selected.206207## Phase 8: Verify And Quality Gate208209`graph commit --verify` reads back committed claims and checks quality. When it210warns or fails, drill down with affected reads and quality reports:211212```bash213potpie graph read --subgraph features --view feature_context --scope anchor_entity_key:<repo-key> --limit 50214potpie graph read --subgraph infra_topology --view service_neighborhood --scope service:<service> --depth 2 --direction both --limit 50215potpie graph read --subgraph recent_changes --view timeline --scope repo:<repo> --limit 50 --format table216potpie --json graph quality duplicate-candidates --limit 20217potpie --json graph quality low-confidence --limit 20218potpie --json graph quality conflicting-claims --limit 20219potpie --json graph quality orphan-entities --limit 20220```221222If the verified commit misses expected facts, fix the mutation or record an inbox item.223Report what was ingested, what was skipped, and what remains uncertain.224225## Repository Baseline226227For repository ingestion, run baseline before change history. Use228`potpie-repo-baseline` in deep mode when the user asks to ingest or understand a229repo deeply. Record source-backed purpose, application type, features,230service/module map, API contracts, datastores, integrations, environments,231deploy shape, ownership, and explicit project preferences. Then use232`potpie-change-timeline` for recent or historical activity. Do not infer233baseline architecture from PR titles or issue status.234235Represent capabilities as `Feature` entities. Link repositories or services to236features with `PROVIDES`, and use `IMPLEMENTED_IN` only when a source locates237the implementation.238239## Source Rules240241- Tickets and issues can record timeline events, bug patterns, decisions, and242 docs. They do not prove a fix unless tied to a merged PR, commit, deployment,243 or explicit shipped-resolution source.244- Documents can record preferences, decisions, runbook notes, service notes, and245 infra facts only when they explicitly say them.246- Logs and transcripts can record diagnostic signals, investigations, fixes, and247 verifications. Keep raw logs out of descriptions except for short distinctive248 error text.