Skip to content

skills/wiki-generator/src/guards

Module summary

Module skills/wiki-generator/src/guards

Exports

NameKindDefault
DOC_RATIO_THRESHOLDvariableno
HallucinationGuardErrorclassno
SNAPSHOT_UPDATE_SIGNALvariableno
SOURCE_RATIO_THRESHOLDvariableno
checkHallucinationfunctionno
mainfunctionno

Detail

DOC_RATIO_THRESHOLD

DOC_RATIO_THRESHOLD

Params

None.

Returns

None.

Examples

None.

HallucinationGuardError

HallucinationGuardError

Params

None.

Returns

None.

Examples

None.

SNAPSHOT_UPDATE_SIGNAL

SNAPSHOT_UPDATE_SIGNAL

Params

None.

Returns

None.

Examples

None.

SOURCE_RATIO_THRESHOLD

SOURCE_RATIO_THRESHOLD

Params

None.

Returns

None.

Examples

None.

checkHallucination

checkHallucination(opts)

Run the hallucination guard for one doc/source pair.

Decision table:

  • doc-ratio > 0.20 AND source-ratio < 0.05 -> BLOCK, unless the [snapshot-update] signal is present, in which case the doc change is accepted and the golden snapshot is refreshed.
  • any other combination -> PASS. When the doc differs from its golden snapshot and the signal is present, the snapshot is refreshed.

Params

  • opts = {}

Returns

None.

Examples

None.

main

main(argv, io)

CLI entrypoint. Returns the process exit code instead of calling process.exit so it stays unit-testable.

node hallucination_guard.js
—doc —source —golden
[—repo-dir ] [—commit-message ]

Exit codes: 0 = pass, 1 = blocked (hallucination), 2 = usage / runtime error.

Params

  • argv = process.argv.slice(2)
  • io = {}

Returns

None.

Examples

None.