NAI OS

/nai-paper-ingest — filing a GitHub-linked paper into the research library

Detects a paper link in a GitHub issue on this repo, resolves it to its actual PDF even when it's one hop away, and files it for a separate library to pick up later.

You type /nai-paper-ingest <issue-number-or-url>. The orchestrator fetches that one issue with gh issue view and does its own cheap detection — a URL ending in .pdf, or hosted on a tunable allowlist of paper sites (arXiv, DOI, ACM, IEEE, Springer, and a few more). No candidate link, no dispatch, no comment — the cheapest possible short-circuit, decided before any subagent runs.

When a candidate exists, paper-ingester takes it from there: resolve the actual PDF (the arXiv /abs/ and bare /pdf/ forms transform directly, with no fetch at all; anything else gets one WebFetch of the landing page, looking for the PDF link it contains — never a guessed one), download it, read its title and abstract, pick the best-fit existing topic folder, skip it if a near-duplicate is already there, and file it. The orchestrator relays the subagent's outcome as one GitHub comment and stops — it never edits the issue's content or closes it.

%%{init: {'theme':'neutral', 'flowchart':{'htmlLabels':false,'nodeSpacing':45,'rankSpacing':55}}}%%
flowchart TD
    H["Human types<br/>/nai-paper-ingest <issue>"] --> C

    subgraph L1 ["1 - Orchestrator (.claude/commands)"]
        C["/nai-paper-ingest<br/>gh issue view, cheap link detection"]
    end

    C -->|"no candidate link"| END1["STOP — no dispatch,<br/>no comment"]
    C -->|"candidate found"| A

    subgraph L2 ["2 - Subagent (.claude/agents)"]
        A["paper-ingester<br/>resolve &rarr; download &rarr; read &rarr; route &rarr; dedupe &rarr; place"]
    end

    A -.->|"one line per URL"| C
    C ==> CMT["one gh issue comment<br/>never edits/closes the issue"]

    A --> T1
    A --> T2
    subgraph L3 ["3 - Tools (the only route out)"]
        T1["Bash: curl download, mv/cleanup only<br/>.claude/settings.json denies any<br/>mv/cp/curl that targets wiki/"]
        T2["WebFetch: resolve one landing<br/>page's PDF link, nothing broader"]
    end

    T1 ==> PLACE["work/<Topic>/<file>.pdf<br/>outside this repo"]

    classDef orch fill:#dcefe9,stroke:#0f6f63,stroke-width:2px
    classDef tool fill:#f4f1ea,stroke:#8a7a5a
    classDef human fill:#fdf3e0,stroke:#8a5a00,stroke-width:2px
    classDef agent fill:#fff,stroke:#555
    class C orch
    class T1,T2 tool
    class H,END1,CMT,PLACE human
    class A agent
The cheap check lives in the orchestrator, not a subagent — a link that isn't even a candidate never costs a dispatch. Everything that touches the network or a file outside this repo happens in paper-ingester, behind two narrowly-scoped tools.

The library it files into — work/<Topic>/, sibling to a separate library-wiki that turns those raw sources into summaries on its own schedule — is the same one six other agents already read from. See one offline knowledge base, six agents for that shared concept; this page is about the one agent that writes to it.

The boundary here is enforced twice. paper-ingester's own instructions say it never writes to wiki/ — and, since 2026-08-05, .claude/settings.json backs that with a permission-layer deny rule: any mv, cp, or curl Bash command whose arguments reference library-wiki...wiki is blocked before it runs, not merely discouraged in prose. It's a best-effort guard, not a sandboxed one — a sufficiently different command shape could still route around a prefix-matched deny rule — but it closes the realistic accidental case the same way the curl/mv-only tool grant closes the rest of this agent's reach.

Nextnai-analysis