snapkitty
agents
python
File size: 3,000 Bytes
662ceed
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
import { describe, it } from 'node:test';
import assert from 'node:assert/strict';
import { scribeQuery, classifyIntent } from '../src/agents/scribe.js';

describe('SCRIBE intent classification', () => {
  it('classifies "What is covenant?" as definition', () => {
    const r = classifyIntent('What is covenant?');
    assert.equal(r.intent, 'definition');
    assert.ok(r.corpora.includes('dictionary'));
  });

  it('classifies "Book of Enoch" as theology_search', () => {
    const r = classifyIntent('Book of Enoch');
    assert.equal(r.intent, 'theology_search');
    assert.ok(r.corpora.includes('enoch'));
  });

  it('classifies "Compare Enoch 1 and Matthew 5" as comparison', () => {
    const r = classifyIntent('Compare Enoch 1 and Matthew 5');
    assert.equal(r.intent, 'comparison');
  });

  it('classifies "define repentance" as definition', () => {
    const r = classifyIntent('define repentance');
    assert.equal(r.intent, 'definition');
  });

  it('classifies "mercy" as scripture_search', () => {
    const r = classifyIntent('mercy');
    assert.equal(r.intent, 'scripture_search');
    assert.ok(r.corpora.includes('scripture'));
  });
});

describe('SCRIBE query — covenant', () => {
  it('returns citations and definitions', async () => {
    const r = await scribeQuery('What is covenant?');
    assert.ok(r.citations.length > 0);
    assert.ok(r.definitions.length > 0);
    assert.ok(r.confidence > 0.3);
  });

  it('includes dictionary definition', async () => {
    const r = await scribeQuery('covenant');
    assert.ok(r.definitions.some(d => d.term === 'covenant'));
  });

  it('includes scripture citations', async () => {
    const r = await scribeQuery('covenant');
    assert.ok(r.citations.some(c => c.source === 'scripture'));
  });
});

describe('SCRIBE query — Enoch', () => {
  it('returns Enoch citations', async () => {
    const r = await scribeQuery('Book of Enoch');
    assert.ok(r.citations.some(c => c.source === 'enoch'));
  });

  it('confidence above 0.3 when citations found', async () => {
    const r = await scribeQuery('Book of Enoch');
    assert.ok(r.confidence > 0.3);
  });
});

describe('SCRIBE query — comparison', () => {
  it('returns citations from multiple corpora', async () => {
    const r = await scribeQuery('Compare Enoch 1 and Matthew 5');
    assert.ok(r.citations.length > 0);
    const sources = new Set(r.citations.map(c => c.source));
    assert.ok(sources.size >= 1);
  });
});

describe('SCRIBE query — no results', () => {
  it('returns low confidence for gibberish', async () => {
    const r = await scribeQuery('xyzzyplugh');
    assert.ok(r.confidence < 0.3);
    assert.equal(r.citations.length, 0);
  });
});

describe('SCRIBE RTRUST-007 enforcement', () => {
  it('confidence < 0.3 when no citations', async () => {
    const r = await scribeQuery('xyzzyplugh');
    assert.ok(r.confidence < 0.3);
  });
});