Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Repository framing and migration boundary are defined in `README.md`, `RELATIONS

Active supporting docs are:

- `docs/RESEARCH-ENTRYPOINT.md`
- `docs/ARCHITECTURE.md`
- `docs/ACTIVE-DECISIONS.md`
- `docs/CHECKPOINTING.md`
Expand Down
78 changes: 78 additions & 0 deletions docs/RESEARCH-ENTRYPOINT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# Research a question and resume its evidence

`lt research "question"` is the short entry to evidence collection. `longtable research` and the MCP `research` tool use the same implementation. No onboarding interview or separate model account is required.

```sh
lt research "Does generative AI tutoring improve independent learning?" --cwd ./study --json
lt research --run research_<id> --cwd ./study --json
```

The first call searches the registered metadata sources and writes a host-model discovery packet. The final source comparison includes only evidence cited by host-authored claims, never all unreviewed search candidates. The host (Codex, Claude, or another authorized caller) reads the evidence and writes the answer. LongTable itself does not call an external model or pretend that a result list is a synthesized answer. Repeating the same question resumes its saved evidence without network calls. Explicit search wording and term order are preserved, including short terms such as AI, 학교, and 정책. For a multilingual or poorly matched query, the host can refine retrieval without changing the original question: `lt research --run <id> --refresh --search-query "AI education implementation barriers"`. The query is recorded alongside the original question. Use `--refresh` to run a new search; previous revisions remain available and old claims are not silently carried into new evidence. `previousRevision` points to the earlier immutable JSON in `revisions/`; inspect it to compare prior sources/claims, then explicitly reattach any evidence and claims that remain valid. No revision automatically becomes a current research decision.

## Evidence and answer

Each question has `.longtable/research/<id>/run.json`, `packet.json`, `answer.md`, and immutable `revisions/<revision>.json`. A cross-process per-run lock rejects overlapping updates with retry guidance, so a successful update is not silently overwritten. After an interrupted process, inspect the PID in the adjacent `<id>.lock` before clearing a stale lock. These are research sidecars. They do not rewrite `.longtable/state.json`, researcher decisions, or `CURRENT.md`.

The core records are Source (URL, access time, date/version, hash), Evidence (source, locator, excerpt, depth), Claim (support, counterevidence, caveat), and Run (question, source outcomes, gaps, next action). Different arXiv versions and the published DOI record stay separate; matching DOIs link related sources instead of silently collapsing preprint/publication evidence. Publication dates may be year-only, and retraction/correction status is not currently checked automatically.

Search abstracts are marked `abstract`; a discoverable PDF does not count as a read paper. To bring in official reports, ACL/OpenReview material, or other sources retrieved with authorized host tools, save a bounded local text extraction and supply an evidence JSON array:

```json
[
{
"path": "report.txt",
"title": "Official report title",
"url": "https://institution.example/report",
"kind": "official_report",
"locator": "page 12, section 3",
"excerpt": "Exact excerpt present in report.txt",
"depth": "full_text_excerpt",
"publishedAt": "2026-08-01",
"version": "2"
}
]
```

Paths resolve relative to the evidence JSON. Supported kinds are `scholarly`, `official_report`, `web`, and `local_document`; depths are `metadata`, `abstract`, and `full_text_excerpt`. The importer verifies an excerpt against the local file and stores its SHA-256. This verifies the local match, not the authenticity of the declared URL, the accuracy of a PDF extraction, or the semantic support of a claim. The host must inspect the original source and retain an honest locator/depth. A landing-page announcement is not full-text report evidence.

```sh
lt research --run research_<id> --cwd ./study --evidence-file evidence.json --json
```

Read the returned evidence IDs, then attach host-authored claims:

```json
{
"claims": [
{
"id": "claim_1",
"text": "A bounded finding supported by the cited excerpt.",
"support": ["evidence_<existing-id>"],
"counterevidence": [],
"caveat": "State the source and generalization limits."
}
]
}
```

```sh
lt research --run research_<id> --cwd ./study --answer-file answer.json
```

Missing citations, invented excerpts, duplicate claim IDs, and conflicting support/counterevidence references are rejected before changing the saved run. `draft_with_citations` means references passed structural validation; it does not certify the research conclusion. Counterevidence not yet found, full text not yet read, and unavailable sources remain visible.

## Source failures and access

The seven executable routes are Crossref, arXiv, OpenAlex, Semantic Scholar, PubMed, ERIC, and DOAJ. Other repositories and Korean institutional sites are accessible through the host's normal search/browser/local tools followed by evidence import, not through fictitious built-in search connectors. Doctor uses the same registry as execution and reports setup eligibility, not live availability.

Anonymous OpenAlex basic queries are permitted by the [current official authentication documentation](https://help.openalex.org/api/authentication/) (updated 2026-08-19). An optional existing key raises limits; remote quota/authentication failures are still reported. LongTable neither creates accounts nor buys credits. Source-report URLs and errors redact API credentials.

By default, one source failure leaves other results usable (`partial`). All routes failing produces `blocked`. `--require-all` preserves available evidence but leaves source-coverage-dependent conclusions incomplete when any requested route fails. `--require-full-text` retains a gap when a claim lacks full-text support. Neither flag expands access or automates a research commitment. Per-source timeouts include response-body parsing; callers of the library can set `timeoutMs` (default 15 seconds).

## Verification and release

- `npm test`: existing regressions plus failure/deadline/redaction, source registry consistency, CLI/MCP resume, local excerpt matching, counterevidence, and invalid-update preservation.
- `npm run eval:research`: 20 fixed questions across AI/agents, social science/education, and Korean policy. Synthetic fixtures test workflow contracts; the report explicitly does not claim live source recall or semantic answer quality.
- Live source coverage and actual source-supported answers require separately recorded real runs. API success alone does not establish useful full-text coverage.

All workspace packages and internal pins are staged at **0.1.73**. This is not an npm publication. A reviewed local runtime can be installed from a frozen commit into `~/.local/share/longtable/releases/<commit>` using the committed lockfile (`npm ci --ignore-scripts --no-audit --no-fund`, then `npm run build`). Its MCP entry is `packages/longtable-mcp/dist/server.js`, run with Node. Updating a client to this frozen path is separate from publishing the npm release.
87 changes: 44 additions & 43 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "longtable-monorepo",
"version": "0.1.72",
"version": "0.1.73",
"private": true,
"description": "Monorepo for the LongTable product surface and provider-neutral runtime packages",
"workspaces": [
Expand All @@ -21,9 +21,11 @@
"smoke:grilling-interview": "node scripts/e2e-grilling-interview-flow.mjs",
"smoke:search": "node scripts/smoke-search.mjs",
"smoke:scholar-research": "node scripts/smoke-scholar-research.mjs",
"test": "npm run build && npm run smoke:setup && npm run smoke:checkpoints && npm run smoke:hooks && npm run smoke:panel-handoff && npm run smoke:panel-workers && npm run smoke:research-spec-audit && npm run smoke:question-audit && npm run smoke:role-audit && npm run smoke:human-persona && npm run smoke:grilling-interview && npm run smoke:search && npm run smoke:scholar-research && npm run typecheck",
"test": "npm run build && npm run smoke:setup && npm run smoke:checkpoints && npm run smoke:hooks && npm run smoke:panel-handoff && npm run smoke:panel-workers && npm run smoke:research-spec-audit && npm run smoke:question-audit && npm run smoke:role-audit && npm run smoke:human-persona && npm run smoke:grilling-interview && npm run smoke:search && npm run smoke:scholar-research && npm run smoke:research && npm run typecheck",
"pack:check": "npm pack --workspaces --dry-run",
"release:check": "npm run test && npm run pack:check"
"release:check": "npm run test && npm run pack:check",
"smoke:research": "node scripts/smoke-research.mjs",
"eval:research": "node scripts/eval-research.mjs"
},
"engines": {
"node": ">=18.0.0"
Expand Down
4 changes: 2 additions & 2 deletions packages/longtable-checkpoints/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@longtable/checkpoints",
"version": "0.1.72",
"version": "0.1.73",
"private": false,
"description": "Checkpoint policy engine for LongTable",
"type": "module",
Expand All @@ -21,7 +21,7 @@
"typecheck": "tsc -p tsconfig.json --noEmit"
},
"dependencies": {
"@longtable/core": "0.1.72"
"@longtable/core": "0.1.73"
},
"devDependencies": {
"typescript": "^5.6.0"
Expand Down
2 changes: 1 addition & 1 deletion packages/longtable-core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@longtable/core",
"version": "0.1.72",
"version": "0.1.73",
"private": false,
"description": "Provider-neutral domain models and contracts for LongTable",
"type": "module",
Expand Down
14 changes: 7 additions & 7 deletions packages/longtable-mcp/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@longtable/mcp",
"version": "0.1.72",
"version": "0.1.73",
"private": false,
"description": "LongTable MCP transport for workspace state and Researcher Checkpoints",
"type": "module",
Expand All @@ -26,12 +26,12 @@
"self-test": "node ./dist/server.js --self-test"
},
"dependencies": {
"@longtable/checkpoints": "0.1.72",
"@longtable/cli": "0.1.72",
"@longtable/core": "0.1.72",
"@longtable/provider-claude": "0.1.72",
"@longtable/provider-codex": "0.1.72",
"@longtable/setup": "0.1.72",
"@longtable/checkpoints": "0.1.73",
"@longtable/cli": "0.1.73",
"@longtable/core": "0.1.73",
"@longtable/provider-claude": "0.1.73",
"@longtable/provider-codex": "0.1.73",
"@longtable/setup": "0.1.73",
"@modelcontextprotocol/sdk": "^1.29.0",
"zod": "^4.0.0"
},
Expand Down
Loading
Loading