fix(claudewatcher): tag session-dump notes source_type: internal
brain-gardener#5: the audit's unsourced check was flagging 59 raw claudewatcher session dumps as high-severity hallucination risk, because it can't distinguish a first-party observation (a session transcript) from an external claim needing citation. Adds WriteNoteOptions.SourceType, emitted as source_type: <value> in the wing/hall frontmatter route. claudeSink (the claudewatcher sink) now always sets source_type: internal on the notes it writes.
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
// ingestion/cmd/server/main_test.go
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"log/slog"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/mathiasbq/hyperguild/ingestion/internal/claudewatcher"
|
||||
)
|
||||
|
||||
func TestClaudeSink_IngestTagsSourceTypeInternal(t *testing.T) {
|
||||
dir := t.TempDir()
|
||||
sink := &claudeSink{brainDir: dir, logger: slog.New(slog.NewTextHandler(os.Stderr, nil))}
|
||||
|
||||
err := sink.Ingest(context.Background(), claudewatcher.Batch{
|
||||
Host: "koala",
|
||||
FilePath: "/host-home-claude/projects/-home-mathias-dev/abc.jsonl",
|
||||
SessionID: "abc",
|
||||
ProjectID: "-home-mathias-dev",
|
||||
Turns: []claudewatcher.Turn{
|
||||
{Type: "assistant", Content: "did a thing"},
|
||||
},
|
||||
})
|
||||
require.NoError(t, err)
|
||||
|
||||
got, err := os.ReadFile(filepath.Join(dir, "wiki", "claude-sessions", "facts", "session-koala-abc.md"))
|
||||
require.NoError(t, err)
|
||||
assert.Contains(t, string(got), "source_type: internal")
|
||||
assert.Contains(t, string(got), "wing: claude-sessions")
|
||||
}
|
||||
Reference in New Issue
Block a user