Add freshness scoring, auto-decay, and USAGE.md
Add lastAccessedAt timestamp to nodes with schema migration and backfill. Touch timestamp on read, apply exponential freshness decay (~69-day half-life) to search scoring alongside BM25 and vector weights. Add auto-decay that marks untouched nodes as stale after a configurable threshold, with CLI command and server-side daily interval. Include comprehensive USAGE.md documenting all CLI commands and REST API.
This commit is contained in:
12
src/cli/commands/decay.ts
Normal file
12
src/cli/commands/decay.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import { Command } from 'commander';
|
||||
import chalk from 'chalk';
|
||||
import { decayStaleNodes } from '../../core/decay';
|
||||
|
||||
export const decayCommand = new Command('decay')
|
||||
.description('Mark old untouched nodes as stale')
|
||||
.option('--days <number>', 'Max age in days before decay', '180')
|
||||
.action((opts) => {
|
||||
const days = parseInt(opts.days, 10);
|
||||
const count = decayStaleNodes(days);
|
||||
console.log(chalk.green(`✓ Decayed ${count} node(s) older than ${days} days.`));
|
||||
});
|
||||
@@ -9,6 +9,7 @@ import { updateCommand } from './commands/update';
|
||||
import { removeCommand } from './commands/remove';
|
||||
import { graphCommand } from './commands/graph';
|
||||
import { serveCommand } from './commands/serve';
|
||||
import { decayCommand } from './commands/decay';
|
||||
import { closeDb } from '../core/db';
|
||||
|
||||
const program = new Command();
|
||||
@@ -27,6 +28,7 @@ program.addCommand(updateCommand);
|
||||
program.addCommand(removeCommand);
|
||||
program.addCommand(graphCommand);
|
||||
program.addCommand(serveCommand);
|
||||
program.addCommand(decayCommand);
|
||||
|
||||
program.hook('postAction', () => {
|
||||
closeDb();
|
||||
|
||||
Reference in New Issue
Block a user