# Gather relevant external context

## Offer concrete export help

Tell the owner: “Project history helps explain how these repositories were built.
I can gather relevant records from the sources you authorize. If a source is not
connected, please export the matching project or channels and add the files.”
Ask which sources/projects/channels and date range may be shared, only where the
existing request has not already established this scope. Never imply exports are
mandatory or that unavailable data has been collected.

| Source | Prefer direct authorized access | Owner export fallback |
| --- | --- | --- |
| Linear | Exact repository project; paginate issues, descriptions, comments and linked design docs | Export the matching project/issues as CSV, JSON or Markdown. Check whether comments and attachments are included; request these separately when relevant. |
| Slack / Discord | Named project channels/threads within the approved period | Ask a workspace owner for an available channel export; JSON/ZIP or selected Markdown threads. Exclude unrelated DMs. Export availability depends on workspace permissions. |
| Notion / Google Docs / Drive | Linked specs, architecture, release plans, decision records | Markdown, text or PDF exports of selected pages/docs, including relevant children and referenced attachments. |
| GitHub | Repo issues, PR discussions, milestones and release notes with pagination | Repository-scoped JSON/Markdown exports. Preserve provenance and distinguish these from Git commit history. |
| Coding-agent traces | Local Claude, Codex and other coding-tool sessions matching the authorized company/repositories; follow `contextCollection.agentTraces` in `/agent/workflow.json` for discovery and preparation | Reviewed JSONL/JSON, Markdown/text or ZIP exports preserving prompts, replies, tool calls/results and session relationships. Report unavailable or incomplete sessions. |
| Meetings | Approved project transcripts | Project-specific text/Markdown exports; inspect full records, not only generated summaries. |

Use source APIs/MCP when available. Browser automation may help export, but must
not be required. Without it, provide the precise selection above and let the
owner download it; continue accessible sources in parallel. Do not scrape broad
personal history or silently install/connect integrations.

## Relevance and coverage

For every source record, determine relevance from canonical repository URLs,
project mappings, explicit issue links and surrounding content. Avoid name-only
matches. Keep a local coverage matrix with one row per repository/source:
source identity, approved scope/date range, retrieval time, pages/cursors read,
record count, omissions, evidence for relevance and destination upload IDs.
Use “unavailable”, “partial”, “not relevant” and “complete within stated scope”
accurately. Do not infer completeness from a successful first page.

For company-wide context or agent traces such as `Acme/`, retain that provenance
and include explicit repository names and record-level references. The upload API
uses an exact connected `owner/repo` as its anchor; set `organizationWide: true`
when the owner authorizes company scope so the service can match relevant
repositories. On the website, use that company's Upload context control and
confirm the organization destination. Verify matched destinations in the upload
list; unmatched files remain for review. For repository-only traces, leave
`organizationWide` false and upload only to the matching repository. Ask about
ambiguous mappings; never attach every session to every accessible repo.

## Prepare and upload

Normalize machine exports into UTF-8 Markdown/text or structured JSON/CSV, keeping
stable IDs, source URLs, timestamps, relationships and meaningful content. Include
a short provenance/coverage header. Preserve original records privately; do not
replace missing source content with invented summaries. Split large exports by
project/time window without losing links or records. Read the live manifest for
file size/chunk limits. PDF/image/ZIP extraction depends on the configured context
service; use text exports when they preserve meaning more reliably.

Review secrets, personal/customer data, attachments and archive contents before
upload. The **original uploaded file is saved for administrator review**, not only
its extracted text. Automated secret scans do not establish semantic PII absence.
Keep unredacted originals, replacement maps and credentials out of uploaded files.
Maintain hashes for reviewed derivatives and deduplicate using the private ledger
plus the upload list; filename alone does not establish identical content.

Upload automatically once relevance, sharing scope and review are established.
Record transfer confirmation separately from extraction, include complete IDs in
the repository scan, and report uncollected or failed context explicitly.
