{
  "expectations": [
    {
      "text": "Runs init_wiki.py (or init_wiki.ts) script to create directory scaffold",
      "passed": true,
      "evidence": "report.md Phase 1 documents the command: `node skills/wiki/scripts/init_wiki.js --path /tmp/eval-iiq-project --domain 'backend-services' --name 'eval-iiq-project'`, and the full scaffold (wiki/, raw/, graph/, audit/, log/, outputs/, .wiki-cache/, wiki.config.yaml, events.jsonl, edges.jsonl, .wiki-ignore) is present under outputs/."
    },
    {
      "text": "wiki.config.yaml is created with domain 'backend-services'",
      "passed": true,
      "evidence": "outputs/wiki.config.yaml line 3: `domain: backend-services` under the `wiki:` section. Name field also set to `eval-iiq-project`."
    },
    {
      "text": "Directory scaffold includes wiki/, raw/, graph/, audit/, log/, outputs/",
      "passed": true,
      "evidence": "`ls` on outputs/ confirms all six directories exist: wiki/ (with index.md, summaries.md, overview.md, auth/, claims/, synthesis/, templates/), raw/auth/, graph/edges.jsonl, audit/{open,resolved}/, log/{events.jsonl, daily/}, outputs/{queries/, reports/}."
    },
    {
      "text": "Source file is copied to raw/ directory",
      "passed": true,
      "evidence": "outputs/raw/auth/architecture.md exists (3513 bytes) and contains the full original architecture doc (headings: JWT Access Tokens, Server-Side Sessions, Refresh Flow) matching the fixture described in report.md Phase 0. events.jsonl records bytes_in=3513 matching the file size."
    },
    {
      "text": "A wiki page is created with proper frontmatter (title, type, tags, sources, created, updated, summary)",
      "passed": true,
      "evidence": "outputs/wiki/auth/authentication.md frontmatter (lines 1-14) has all seven required fields: title='Authentication and Session Management', type='concept', tags (6 items), sources=[raw/auth/architecture.md], created=2026-04-14, updated=2026-04-14, summary (multi-line block). Also carries a quality:0.0 field."
    },
    {
      "text": "Tags are content-only concepts (e.g., 'jwt', 'authentication', 'session-management')",
      "passed": true,
      "evidence": "authentication.md line 4: `tags: [authentication, jwt, session-management, refresh-token, rs256, postgresql]`. All six are content concepts — no structural (e.g., 'concept', 'index'), temporal (e.g., '2026'), or metadata tags. Explicitly contains the three examples named in the assertion."
    },
    {
      "text": "summaries.md is updated with the new page's summary",
      "passed": true,
      "evidence": "Both outputs/summaries.md and outputs/wiki/summaries.md contain an '## Authentication' section linking to `auth/authentication.md` with a paragraph summarizing the hybrid RS256 JWT + PostgreSQL session design and per-page tag list. Not a scaffold stub."
    },
    {
      "text": "Query answer includes inline citations to wiki pages",
      "passed": true,
      "evidence": "outputs/outputs/queries/2026-04-14-how-does-authentication-work.md contains 9 inline citations linking back to wiki pages, including section-anchor cites like `[auth/authentication.md § JWT Access Tokens](../../wiki/auth/authentication.md#access-tokens-jwt--rs256)`, `[auth/authentication.md § Server-Side Sessions]`, `[auth/authentication.md § Refresh Flow]`, and `[overview.md](../../wiki/overview.md)`. Plus a Citations section at the bottom."
    },
    {
      "text": "Answer is archived to outputs/queries/",
      "passed": true,
      "evidence": "outputs/outputs/queries/2026-04-14-how-does-authentication-work.md (5255 bytes) archived with YAML header recording the query, asked_at, pages_considered, pages_loaded, and relevance_scores. events.jsonl query event's answer_path field points to this same file."
    },
    {
      "text": "events.jsonl records init, ingest, and query operations",
      "passed": false,
      "evidence": "outputs/events.jsonl (and log/events.jsonl) only contain two events: `op: ingest` and `op: query`. No `op: init` entry is present. Grep for `init` in both copies returns no matches. The init_wiki.ts script does not emit an init event by design — the scaffold was created but the operation was not logged."
    }
  ],
  "summary": {
    "passed": 9,
    "failed": 1,
    "total": 10,
    "pass_rate": 0.9
  },
  "timing": {
    "executor_duration_seconds": 0.0,
    "total_duration_seconds": 0.0,
    "total_tokens": 68781
  },
  "claims": [
    {
      "claim": "Ingest created wiki page at wiki/auth/authentication.md with quality 0.90 after Mermaid + frontmatter + tags",
      "type": "quality",
      "verified": true,
      "evidence": "authentication.md contains 6-tag frontmatter, two Mermaid blocks (sequenceDiagram for refresh flow, erDiagram for users/sessions/refresh_tokens), 'How to Go Deeper' section, and Related Pages cross-links — consistent with the 0.9 score reported in report.md Phase 3."
    },
    {
      "claim": "Query reduction ratio was 0.918 (tokens_in=2088, tokens_out=1313)",
      "type": "factual",
      "verified": true,
      "evidence": "events.jsonl query event fields: tokens_in=2088, tokens_out=1313, reduction_ratio=0.918 match report.md Phase 4 verbatim."
    },
    {
      "claim": "EXTRACTED-provenance edge written for wiki->raw source",
      "type": "process",
      "verified": true,
      "evidence": "graph/edges.jsonl: `{\"from\":\"wiki/auth/authentication.md\",\"to\":\"raw/auth/architecture.md\",\"type\":\"supports\",\"provenance\":\"EXTRACTED\",\"detail\":\"Wiki page compiled from this source doc.\"}` — single edge matching the security/provenance contract."
    },
    {
      "claim": "Cache hit was false on first ingest with sha256 8b46715a... matching raw file",
      "type": "factual",
      "verified": true,
      "evidence": "ingest event records cache_hit=false and sha256=8b46715a749941aea3fb046a220a351c03f0f8b101e2a1809b0217ddca33e60e; first ingest of a new file should always miss."
    },
    {
      "claim": "Lint pass cleared 3 auto-fixable errors (missing frontmatter on scaffold stubs)",
      "type": "process",
      "verified": true,
      "evidence": "index.md, summaries.md, overview.md all now carry full YAML frontmatter (title, type, tags, sources, created, updated, quality, summary) — consistent with the auto-fix pass described in report.md Phase 3. No verification via raw lint output (not in outputs), but the post-state is correct."
    }
  ],
  "eval_feedback": {
    "suggestions": [
      {
        "assertion": "events.jsonl records init, ingest, and query operations",
        "reason": "The skill's init_wiki.ts script does not emit an init event — only ingest and query are logged. Either update the skill so init logs an op (matching this assertion) or relax the assertion to only require ingest+query. As written, this assertion fails even on a correct execution."
      },
      {
        "assertion": "A wiki page is created with proper frontmatter (title, type, tags, sources, created, updated, summary)",
        "reason": "Assertion checks presence of fields but not that values are well-formed. A page with `title: ''`, `type: foo`, `tags: []`, `sources: []` would pass. Consider asserting tag count is within 4-8, type is one of the allowed values (concept/index/synthesis/claim/template), and sources is non-empty for concept pages."
      },
      {
        "assertion": "Query answer includes inline citations to wiki pages",
        "reason": "No assertion checks that the answer is actually grounded in the ingested source — a hallucinated page of plausible JWT copy with fake links to nonexistent pages would still pass. Consider asserting citations resolve to actual files that exist in wiki/ AND that key facts in the answer (RS256, 15-minute expiry, `sessions` table, /auth/refresh) appear in the source."
      },
      {
        "reason": "No assertion checks that the graph/edges.jsonl edge was written with required provenance (EXTRACTED/INFERRED/AMBIGUOUS) — this is a core security/provenance guarantee of the wiki contract but is uncovered."
      }
    ],
    "overall": "9/10 pass. The one failure is on the 'events.jsonl records init' assertion, which appears to be a mismatch between eval and skill design rather than a real execution defect. Evals would benefit from stricter content-correctness checks on frontmatter values, citation resolution, and provenance-tagged edges."
  }
}
