Skip to content

code-yeongyu/oh-my-openagent / packages/shared-skills/skills/ulw-research

ulw-research

Unverified

Runs maximum-saturation research with a cooperating team, claim-graph gating, and a cited, QA'd deliverable. Use when the user explicitly asks for research or a deep investigation, including any 'ulw' research wording.

FileKindSize
AGENTS.mdmarkdown9.2 KB
ATTRIBUTION.mdmarkdown2.4 KB
SKILL.mdskill md42.2 KB
references/deliverable-phase.mdmarkdown49.1 KB
references/fact-ledger-grammar.mdmarkdown6.8 KB
references/fact-ledger.mdmarkdown24.4 KB
references/fidelity-claim-kinds.mdmarkdown5.2 KB
references/markdown-blocks.mdmarkdown721 B
references/report-gates.mdmarkdown32.0 KB
references/report-visualization.mdmarkdown15.4 KB
references/research-collection.mdmarkdown26.8 KB
references/research-delivery.mdmarkdown14.3 KB
references/unit-rules.mdmarkdown16.3 KB
scripts/claim-kinds.mjsscript11.2 KB
scripts/claim-kinds.test.tsscript13.5 KB
scripts/claim-prefix.test.tsscript4.9 KB
scripts/claims-index.mjsscript5.3 KB
scripts/claims-index.test.tsscript5.7 KB
scripts/cli-support.mjsscript4.1 KB
scripts/cli-support.test.tsscript4.3 KB
scripts/contracts-validation.test.tsscript3.3 KB
scripts/contracts.mjsscript26.1 KB
scripts/contracts.test.tsscript7.9 KB
scripts/conversion-altered.test.tsscript11.0 KB
scripts/conversion-originals.test.tsscript22.7 KB
scripts/conversion-probe-classes.test.tsscript45.2 KB
scripts/conversion-probe.mjsscript13.5 KB
scripts/conversion-probe.test.tsscript11.6 KB
scripts/copy-returns-fidelity-policy.test.tsscript10.4 KB
scripts/copy-returns-polish.test.tsscript12.1 KB
scripts/copy-returns.test.tsscript10.6 KB
scripts/css-hiding.mjsscript9.1 KB
scripts/css-lite.mjsscript7.6 KB
scripts/css-lite.test.tsscript6.4 KB
scripts/delivery-barrier-meaning.test.tsscript12.3 KB
scripts/delivery-barrier.test.tsscript11.4 KB
scripts/design-spec.mjsscript7.2 KB
scripts/design-spec.test.tsscript6.7 KB
scripts/entities.mjsscript2.5 KB
scripts/entry-guard.mjsscript794 B
scripts/fact-commands-fill.mjsscript6.6 KB
scripts/fact-commands-meaning.mjsscript12.6 KB
scripts/fact-commands-polish.mjsscript10.3 KB
scripts/fact-commands-verify.mjsscript12.6 KB
scripts/fact-commands.mjsscript13.8 KB
scripts/fact-derive-2.test.tsscript7.2 KB
scripts/fact-derive.mjsscript4.9 KB
scripts/fact-derive.test.tsscript10.8 KB
scripts/fact-expr.mjsscript4.5 KB
scripts/fact-fill.mjsscript11.7 KB
scripts/fact-fill.test.tsscript10.7 KB
scripts/fact-ledger-grammar.test.tsscript11.8 KB
scripts/fact-ledger-kinds.mjsscript16.5 KB
scripts/fact-ledger-kinds.test.tsscript9.3 KB
scripts/fact-ledger-legacy.test.tsscript8.9 KB
scripts/fact-ledger-schema.mjsscript11.9 KB
scripts/fact-ledger-schema.test.tsscript1.5 KB
scripts/fact-ledger.mjsscript5.5 KB
scripts/fact-ledger.test.tsscript9.7 KB
scripts/fact-locate.mjsscript12.1 KB
scripts/fact-locate.test.tsscript7.2 KB
scripts/fact-pairs.mjsscript8.3 KB
scripts/fact-pairs.test.tsscript6.6 KB
scripts/fact-recompute.mjsscript4.8 KB
scripts/fact-unit-dimensions-2.test.tsscript8.4 KB
scripts/fact-unit-dimensions.test.tsscript11.9 KB
scripts/fact-unit-rules.test.tsscript8.9 KB
scripts/fidelity-binding.mjsscript6.7 KB
scripts/fidelity-binding.test.tsscript4.0 KB
scripts/fidelity-brief.mjsscript6.4 KB
scripts/fidelity-brief.test.tsscript7.8 KB
scripts/fidelity-claims.mjsscript5.1 KB
scripts/fidelity-csv.mjsscript1.1 KB
scripts/fidelity-lexicon.mjsscript8.1 KB
scripts/fidelity-lexicon.test.tsscript6.0 KB
scripts/fidelity-originals.mjsscript9.9 KB
scripts/fidelity-policy.mjsscript10.1 KB
scripts/fidelity-records.mjsscript13.4 KB
scripts/fidelity-snapshot-readability.mjsscript2.2 KB
scripts/fidelity-sources.mjsscript4.3 KB
scripts/fidelity-state.mjsscript2.1 KB
scripts/fidelity-state.test.tsscript1.7 KB
scripts/fidelity-trace.mjsscript6.1 KB
scripts/fidelity-trace.test.tsscript3.3 KB
scripts/fidelity-value-unit.mjsscript13.3 KB
scripts/fidelity-values.mjsscript16.1 KB
scripts/fidelity-values.test.tsscript15.8 KB
scripts/format-extract-css.mjsscript5.1 KB
scripts/format-extract.mjsscript10.3 KB
scripts/format-extract.test.tsscript11.2 KB
scripts/gates-context.test.tsscript2.6 KB
scripts/gates-fidelity.mjsscript6.3 KB
scripts/gates-fidelity.test.tsscript3.3 KB
scripts/gates-figures.mjsscript9.9 KB
scripts/gates-layout.mjsscript6.6 KB
scripts/gates-layout.test.tsscript12.4 KB
scripts/gates-static-headings.test.tsscript961 B
scripts/gates-static.mjsscript8.1 KB
scripts/gates-static.test.tsscript14.9 KB
scripts/gates-structure.mjsscript4.7 KB
scripts/gates-text.mjsscript7.2 KB
scripts/glossary-vocabulary.test.tsscript1.7 KB
scripts/html-foreign-object.mjsscript2.8 KB
scripts/html-lite.mjsscript9.7 KB
scripts/html-lite.test.tsscript7.9 KB
scripts/html-markup.mjsscript7.0 KB
scripts/html-text-map.mjsscript4.8 KB
scripts/html-text-map.test.tsscript15.2 KB
scripts/layout-probe.mjsscript4.6 KB
scripts/layout-probe.test.tsscript4.2 KB
scripts/lexicon.mjsscript2.6 KB
scripts/lexicon.test.tsscript3.2 KB
scripts/markdown-closers.mjsscript4.9 KB
scripts/md-lite-boundaries.test.tsscript2.2 KB
scripts/md-lite.mjsscript7.8 KB
scripts/md-lite.test.tsscript10.3 KB
scripts/meaning-check.mjsscript9.7 KB
scripts/meaning-check.test.tsscript12.0 KB
scripts/number-grammar.mjsscript2.1 KB
scripts/number-grammar.test.tsscript1.8 KB
scripts/numerals.mjsscript12.0 KB
scripts/numerals.test.tsscript6.1 KB
scripts/outcome-start.mjsscript3.8 KB
scripts/outcome-start.test.tsscript5.0 KB
scripts/outcome.mjsscript10.5 KB
scripts/outcome.test.tsscript12.8 KB
scripts/page-source-locator.test.tsscript11.7 KB
scripts/particles-ko.mjsscript4.8 KB
scripts/particles-ko.test.tsscript4.3 KB
scripts/placeholder.mjsscript9.3 KB
scripts/placeholder.test.tsscript3.8 KB
scripts/polish-apply.mjsscript6.8 KB
scripts/polish-apply.test.tsscript19.7 KB
scripts/polish-diff.mjsscript1.7 KB
scripts/polish-diff.test.tsscript10.1 KB
scripts/polish-markup.test.tsscript14.0 KB
scripts/polish-partial.test.tsscript2.5 KB
scripts/polish-project.mjsscript5.8 KB
scripts/polish-rules.mjsscript9.8 KB
scripts/rational.mjsscript5.2 KB
scripts/rational.test.tsscript1.9 KB
scripts/raw-decode.mjsscript4.5 KB
scripts/raw-locator.mjsscript2.4 KB
scripts/raw-snapshot.test.tsscript7.3 KB
scripts/references-fences.test.tsscript1.2 KB
scripts/repair-tracker.mjsscript7.5 KB
scripts/repair-tracker.test.tsscript10.8 KB
scripts/report-tools-2.test.tsscript16.1 KB
scripts/report-tools-3.test.tsscript9.3 KB
scripts/report-tools-4.test.tsscript10.1 KB
scripts/report-tools-5.test.tsscript14.6 KB
scripts/report-tools-commands.mjsscript12.9 KB
scripts/report-tools.mjsscript2.6 KB
scripts/report-tools.test.tsscript12.1 KB
scripts/sentence-split.mjsscript3.0 KB
scripts/sentence-split.test.tsscript4.5 KB
scripts/snapshot-readability.test.tsscript7.0 KB
scripts/source-commands.mjsscript12.4 KB
scripts/source-integrity.test.tsscript18.1 KB
scripts/source-refresh.mjsscript5.2 KB
scripts/source-snapshot.mjsscript9.9 KB
scripts/source-snapshot.test.tsscript6.3 KB
scripts/source-view.mjsscript5.0 KB
scripts/sources-citation.mjsscript12.1 KB
scripts/sources-citation.test.tsscript14.8 KB
scripts/tests/contracts-support.tsscript3.5 KB
scripts/tests/delivery-barrier-session.tsscript3.3 KB
scripts/tests/derive-clock.tsscript341 B
scripts/tests/fact-derive-support.tsscript1.9 KB
scripts/tests/fact-unit-dimensions-support.tsscript1.5 KB
scripts/tests/fact-unit-rules-support.tsscript16.8 KB
scripts/tests/fidelity-values-support.tsscript1.6 KB
scripts/tests/fixtures/assets/figure-1.svgother141 B
scripts/tests/fixtures/bad-report.htmlother2.1 KB
scripts/tests/fixtures/boxes.jsonconfig3.2 KB
scripts/tests/fixtures/conversion-probe.htmlother485 B
scripts/tests/fixtures/design-spec.mdmarkdown458 B
scripts/tests/fixtures/fidelity-brief-locked.mdmarkdown571 B
scripts/tests/fixtures/fidelity-brief-pending.mdmarkdown574 B
scripts/tests/fixtures/fidelity/assets/share.csvother40 B
scripts/tests/fixtures/fidelity/claim-graph.mdmarkdown449 B
scripts/tests/fixtures/fidelity/gen-legacy-dev.mjsscript5.0 KB
scripts/tests/fixtures/fidelity/ledger-basic.jsonconfig5.1 KB
scripts/tests/fixtures/fidelity/ledger-legacy-dev.jsonconfig18.3 KB
scripts/tests/fixtures/fidelity/ledger-verify.jsonconfig9.1 KB
scripts/tests/fixtures/fidelity/polish-edits.jsonconfig303 B
scripts/tests/fixtures/fidelity/report-bad.htmlother821 B
scripts/tests/fixtures/fidelity/report-good.htmlother2.4 KB
scripts/tests/fixtures/fidelity/sources/S4.htmlother680 B
scripts/tests/fixtures/fidelity/sources/S4/acronyms.jsonconfig36 B
scripts/tests/fixtures/fidelity/sources/S4/meta.jsonconfig256 B
scripts/tests/fixtures/fidelity/sources/S4/sentences.jsonlother623 B
scripts/tests/fixtures/fidelity/sources/S4/text.txtmarkdown300 B
scripts/tests/fixtures/fidelity/sources/S5/acronyms.jsonconfig3 B
scripts/tests/fixtures/fidelity/sources/S5/meta.jsonconfig235 B
scripts/tests/fixtures/fidelity/sources/S5/sentences.jsonlother53 B
scripts/tests/fixtures/fidelity/sources/S5/text.txtmarkdown10 B
scripts/tests/fixtures/fidelity/sources/S9.txtmarkdown128 B
scripts/tests/fixtures/good-report.htmlother2.7 KB
scripts/tests/fixtures/reference-report.htmlother2.5 KB

scripts/polish-diff.test.ts

View on GitHub
import { describe, expect, test } from "bun:test"
import { readFileSync } from "node:fs"
import { join } from "node:path"

import { renderValueHtml } from "./placeholder.mjs"
import { DEFECT_CODES } from "./contracts.mjs"
import * as polishDiff from "./polish-diff.mjs"
import * as polishProject from "./polish-project.mjs"
import * as polishRules from "./polish-rules.mjs"

const { diffPolish } = polishDiff

const SPAN = {
  fact_id: "F2",
  kind: "measured",
  quote: "The bridge has a main span of 320 m.",
  raw: "320 m",
  value: "320",
  unit: "m",
  qualifier: null,
}
const MAKER = {
  fact_id: "F5",
  kind: "measured",
  quote: "In May, Samsung Electronics shipped 12 units.",
  raw: "12 units",
  value: "12",
  unit: "units",
  qualifier: null,
}
const SALES = {
  fact_id: "F6",
  kind: "measured",
  quote: "Sales were approximately 7 units.",
  raw: "7 units",
  value: "7",
  unit: "units",
  qualifier: null,
}
const LEDGER = { schemaVersion: 1, rows: [SPAN, MAKER, SALES], events: [] }
const span = renderValueHtml(SPAN, SPAN.raw)
const doc = (body: string) => `<html><body>\n${body}\n</body></html>`
const codes = (list: { code: string }[]) => list.map((item) => item.code)

describe("diffPolish: protected content", () => {
  test("identical documents have no defects", () => {
    const html = doc(`<p>The span was about ${span} [S1].</p><table><tr><td>A</td></tr></table>`)
    expect(diffPolish(html, html, LEDGER)).toEqual([])
  })

  test("one numeral that differs inside a fact span is polish_diff_fail", () => {
    const before = doc(`<p>The span is ${span} [S1].</p>`)
    const after = doc(`<p>The span is ${span.replace(">320 m<", ">321 m<")} [S1].</p>`)
    expect(codes(diffPolish(before, after, LEDGER))).toEqual(["polish_diff_fail"])
  })

  test("one numeral that differs outside fact spans is polish_diff_fail", () => {
    const before = doc("<p>Throughput grew 3.5 times in the pilot [S1].</p>")
    const after = doc("<p>Throughput grew 35 times in the pilot [S1].</p>")
    expect(codes(diffPolish(before, after, LEDGER))).toEqual(["polish_diff_fail"])
  })

  test("a dropped table row is polish_diff_fail", () => {
    const before = doc("<table><tr><td>A</td></tr><tr><td>B</td></tr></table>")
    const after = doc("<table><tr><td>A</td></tr></table>")
    expect(codes(diffPolish(before, after, LEDGER))).toContain("polish_diff_fail")
  })

  test("a changed ticker or six-digit exchange code is polish_diff_fail", () => {
    expect(codes(diffPolish(doc("<p>AAPL [S1].</p>"), doc("<p>MSFT [S1].</p>"), LEDGER))).toEqual(["polish_diff_fail"])
    expect(codes(diffPolish(doc("<p>Code 005930 [S1].</p>"), doc("<p>Code 000660 [S1].</p>"), LEDGER))).toEqual([
      "polish_diff_fail",
    ])
  })
})

describe("diffPolish: hedges, churn, links and names", () => {
  test("two hedges removed from claim-only text is polish_hedging_decreased", () => {
    const before = doc("<p>Results may improve and are provisional. The study covered the pilot only.</p>")
    const after = doc("<p>Results improve and are final. The study covered the pilot only.</p>")
    expect(codes(diffPolish(before, after, LEDGER))).toEqual(["polish_hedging_decreased"])
  })

  test("deleting a writer-added hedge the source lacks is not a hedge loss", () => {
    const before = doc(`<p>The span was about ${span} [S1].</p>`)
    const after = doc(`<p>The span was ${span} [S1].</p>`)
    expect(diffPolish(before, after, LEDGER)).toEqual([])
  })

  test("a 60 percent rewrite is polish_text_churn and 50 percent is not", () => {
    expect(codes(diffPolish(doc("<p>abcdefghij</p>"), doc("<p>klmnopghij</p>"), LEDGER))).toEqual(["polish_text_churn"])
    expect(diffPolish(doc("<p>abcdefghij</p>"), doc("<p>klmnofghij</p>"), LEDGER)).toEqual([])
  })

  test("a changed link target or an internal link that stops resolving is polish_link_changed", () => {
    const link = (href: string) => doc(`<p id="top"><a href="${href}">Reference</a> [S1].</p>`)
    expect(codes(diffPolish(link("https://example.invalid/a"), link("https://example.invalid/b"), LEDGER))).toEqual([
      "polish_diff_fail",
      "polish_link_changed",
    ])
    const before = doc('<h2 id="m">Method</h2><p><a href="#m">Method</a> [S1].</p>')
    const after = doc('<h2 id="method">Method</h2><p><a href="#m">Method</a> [S1].</p>')
    expect(codes(diffPolish(before, after, LEDGER))).toEqual(["polish_diff_fail", "polish_link_changed"])
  })

  test("a ledger-quote name present before and absent after is polish_name_changed", () => {
    const before = doc("<p>Samsung Electronics shipped more units in the quarter [S1].</p>")
    const after = doc("<p>The company shipped more units in the quarter [S1].</p>")
    expect(codes(diffPolish(before, after, LEDGER))).toEqual(["polish_name_changed"])
  })

  test("every defect carries its fixed severity", () => {
    const before = doc(
      "<p>Results may improve and are provisional [S1].</p><table><tr><td>A</td></tr><tr><td>B</td></tr></table>",
    )
    const after = doc("<p>Results improve and are final [S1].</p><table><tr><td>A</td></tr></table>")
    const defects = diffPolish(before, after, LEDGER)
    expect(codes(defects)).toEqual(["polish_diff_fail", "polish_hedging_decreased"])
    for (const defect of defects) expect(defect.severity).toBe(DEFECT_CODES[defect.code].severity)
  })
})

describe("diffPolish: severities come from DEFECT_CODES (review #11152 round 1)", () => {
  test("no polish module exports a local severity table", () => {
    for (const mod of [polishDiff, polishRules])
      expect(Object.keys(mod).filter((name) => /severity/i.test(name))).toEqual([])
    for (const file of ["polish-diff.mjs", "polish-rules.mjs", "polish-apply.mjs", "polish-project.mjs"]) {
      const source = readFileSync(join(import.meta.dir, file), "utf8")
      expect(source.match(/["'](?:blocker|major|minor)["']/g) ?? [], file).toEqual([])
    }
  })

  test("every polish code resolves through DEFECT_CODES and each defect carries that severity", () => {
    for (const code of polishRules.POLISH_CODES) expect(Object.hasOwn(DEFECT_CODES, code), code).toBe(true)
    const before = doc(
      '<p>Samsung Electronics may improve [S1].</p><p><a href="/a">x</a> abcdefghij</p><table><tr><td>A</td></tr><tr><td>B</td></tr></table>',
    )
    const after = doc(
      '<p>The firm improves [S1].</p><p><a href="/b">x</a> klmnopqrstuvwxyz</p><table><tr><td>A</td></tr></table>',
    )
    const defects = diffPolish(before, after, LEDGER)
    expect(codes(defects)).toEqual([...polishRules.POLISH_CODES])
    for (const defect of defects) expect(defect.severity, defect.code).toBe(DEFECT_CODES[defect.code].severity)
  })
})

describe("diffPolish: rendered visibility and hedge comparison (review #11152 round 1)", () => {
  test.each([
    ["a hidden attribute", `<span hidden>${span}</span>`],
    ["display:none", `<span style="display:none">${span}</span>`],
    ["a template", `<template>${span}</template>`],
  ])("a fact span hidden by %s is polish_diff_fail", (_label, hidden) => {
    expect(
      codes(diffPolish(doc(`<p>The span is ${span} [S1].</p>`), doc(`<p>The span is ${hidden} [S1].</p>`), LEDGER)),
    ).toContain("polish_diff_fail")
  })

  test("wrapping a hedge changes markup and is blocked before full fidelity verification", () => {
    const after = doc("<p>Results <span hidden>may</span> improve [S1].</p>")
    expect(codes(diffPolish(doc("<p>Results may improve [S1].</p>"), after, LEDGER))).toEqual(["polish_diff_fail"])
  })

  test("a ledger hedge the sentence never held is not a decrease", () => {
    const sales = renderValueHtml(SALES, SALES.raw)
    const before = doc(`<p>The share of revenue was ${sales} [S1].</p>`)
    const after = doc(`<p>The share in revenue was ${sales} [S1].</p>`)
    expect(diffPolish(before, after, LEDGER)).toEqual([])
  })

  test("single-quoted and unquoted href changes are polish_link_changed", () => {
    expect(codes(diffPolish(doc("<p><a href='/a'>x</a></p>"), doc("<p><a href='/b'>x</a></p>"), LEDGER))).toEqual([
      "polish_diff_fail",
      "polish_link_changed",
    ])
    expect(codes(diffPolish(doc("<p><a href=/a>x</a></p>"), doc("<p><a href=/b>x</a></p>"), LEDGER))).toEqual([
      "polish_diff_fail",
      "polish_link_changed",
    ])
  })

  test("the same input gives byte-identical output", () => {
    const before = doc("<p>Results may improve and are provisional [S1].</p>")
    const after = doc("<p>Results improve and are final [S1].</p>")
    expect(JSON.stringify(diffPolish(before, after, LEDGER))).toBe(JSON.stringify(diffPolish(before, after, LEDGER)))
  })
})

describe("claim ids and fact-span scanning (review #11152 round 2, L1 and L2)", () => {
  test("L1: a changed data-claim id is a blocking polish_diff_fail, as apply treats it, not a minor link change", () => {
    const defects = diffPolish(
      doc('<p data-claim="C1">Results improve [S1].</p>'),
      doc('<p data-claim="C2">Results improve [S1].</p>'),
      LEDGER,
    )
    expect(codes(defects)).toEqual(["polish_diff_fail"])
    expect(defects[0].severity).toBe(DEFECT_CODES.polish_diff_fail.severity)
    expect(defects[0].message).toContain("markup changed")
  })

  test("L2: a nested same-name element and a quoted '>' stay inside one fact span", () => {
    const nested = '<p><q data-fact="F1">a <q>b</q> c</q> d</p>'
    expect(polishProject.factSpans(nested).map((s: { html: string }) => s.html)).toEqual([
      '<q data-fact="F1">a <q>b</q> c</q>',
    ])
    const quoted = '<p><data title="a>b" data-fact="F2">320 m</data> d</p>'
    expect(polishProject.factSpans(quoted).map((s: { id: string; html: string }) => [s.id, s.html])).toEqual([
      ["F2", '<data title="a>b" data-fact="F2">320 m</data>'],
    ])
  })
})

describe("polish policies have one owner (duplication sweep)", () => {
  test("the named policies are exported once, from their owners", () => {
    expect(polishRules.POLISH_CHURN_LIMIT).toBe(0.5)
    expect("Samsung Electronics".match(polishRules.POLISH_NAME)).toEqual(["Samsung", "Electronics"])
    expect(polishDiff.TICKER).toBe(polishRules.TICKER)
    expect(polishProject.POLISH_LINK_ATTRIBUTES).toEqual(["href"])
    expect("v1.25 and 3,000".match(polishProject.POLISH_DIGITS)).toEqual(["1.25", "3,000"])
  })
})
finishing-a-development-branchobra/superpowersUse when implementation is complete, all tests pass, and you need to decide how to integrate the workStars: 322kUpdated Claude CodeCodexVerifiedInstall
systematic-debuggingobra/superpowersUse when encountering any bug, test failure, or unexpected behavior, before proposing fixesStars: 322kUpdated Claude CodeCodexVerifiedInstall
test-driven-developmentobra/superpowersUse when implementing any feature or bugfix, before writing implementation codeStars: 322kUpdated Claude CodeCodexVerifiedInstall
skill-creatoranthropics/skillsCreate new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy.Stars: 198kUpdated Claude CodeCodexVerifiedInstall