@hassangameryt/freeflow 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +1 -1
- package/README.md +8 -4
- package/package.json +15 -2
- package/plugins/freeflow/.claude-plugin/plugin.json +1 -1
- package/plugins/freeflow/.codex-plugin/plugin.json +1 -1
- package/plugins/freeflow/command-surface.json +2 -10
- package/plugins/freeflow/docs/README.md +3 -2
- package/plugins/freeflow/docs/adr/0002-evals-before-hooks.md +1 -1
- package/plugins/freeflow/docs/adr/0003-release-boundary.md +1 -1
- package/plugins/freeflow/docs/adr/0004-research-replaces-shallow-discovery-skills.md +26 -0
- package/plugins/freeflow/docs/adr/README.md +2 -1
- package/plugins/freeflow/docs/architecture.md +3 -3
- package/plugins/freeflow/docs/output-router.md +212 -0
- package/plugins/freeflow/docs/release-evidence.md +25 -5
- package/plugins/freeflow/docs/skills.md +6 -7
- package/plugins/freeflow/docs/workflow.md +1 -1
- package/plugins/freeflow/hooks/freeflow-runtime-context.mjs +23 -6
- package/plugins/freeflow/pi-extension/index.js +941 -15
- package/plugins/freeflow/router/dist/benchmark-harness.d.ts +32 -0
- package/plugins/freeflow/router/dist/benchmark-harness.js +92 -0
- package/plugins/freeflow/router/dist/benchmarks.d.ts +102 -0
- package/plugins/freeflow/router/dist/benchmarks.js +880 -0
- package/plugins/freeflow/router/dist/bounded-evidence.d.ts +40 -0
- package/plugins/freeflow/router/dist/bounded-evidence.js +310 -0
- package/plugins/freeflow/router/dist/codex-qa-benchmarks.d.ts +91 -0
- package/plugins/freeflow/router/dist/codex-qa-benchmarks.js +461 -0
- package/plugins/freeflow/router/dist/command-benchmarks.d.ts +128 -0
- package/plugins/freeflow/router/dist/command-benchmarks.js +652 -0
- package/plugins/freeflow/router/dist/config.d.ts +22 -0
- package/plugins/freeflow/router/dist/config.js +114 -0
- package/plugins/freeflow/router/dist/evidence-range-selector.d.ts +22 -0
- package/plugins/freeflow/router/dist/evidence-range-selector.js +180 -0
- package/plugins/freeflow/router/dist/evidence-search.d.ts +25 -0
- package/plugins/freeflow/router/dist/evidence-search.js +450 -0
- package/plugins/freeflow/router/dist/evidence.d.ts +38 -0
- package/plugins/freeflow/router/dist/evidence.js +196 -0
- package/plugins/freeflow/router/dist/experimental-local-index.d.ts +1 -0
- package/plugins/freeflow/router/dist/experimental-local-index.js +1 -0
- package/plugins/freeflow/router/dist/experiments/local-index.d.ts +58 -0
- package/plugins/freeflow/router/dist/experiments/local-index.js +562 -0
- package/plugins/freeflow/router/dist/index-benchmarks.d.ts +84 -0
- package/plugins/freeflow/router/dist/index-benchmarks.js +458 -0
- package/plugins/freeflow/router/dist/index.d.ts +12 -0
- package/plugins/freeflow/router/dist/index.js +12 -0
- package/plugins/freeflow/router/dist/line-ranges.d.ts +22 -0
- package/plugins/freeflow/router/dist/line-ranges.js +22 -0
- package/plugins/freeflow/router/dist/parsers.d.ts +16 -0
- package/plugins/freeflow/router/dist/parsers.js +473 -0
- package/plugins/freeflow/router/dist/repo-traversal.d.ts +18 -0
- package/plugins/freeflow/router/dist/repo-traversal.js +242 -0
- package/plugins/freeflow/router/dist/retrieve.d.ts +33 -0
- package/plugins/freeflow/router/dist/retrieve.js +855 -0
- package/plugins/freeflow/router/dist/router-contract.d.ts +10 -0
- package/plugins/freeflow/router/dist/router-contract.js +54 -0
- package/plugins/freeflow/router/dist/run.d.ts +26 -0
- package/plugins/freeflow/router/dist/run.js +356 -0
- package/plugins/freeflow/router/dist/schema.d.ts +18 -0
- package/plugins/freeflow/router/dist/schema.js +354 -0
- package/plugins/freeflow/router/dist/types.d.ts +234 -0
- package/plugins/freeflow/router/dist/types.js +9 -0
- package/plugins/freeflow/router/dist/vault.d.ts +80 -0
- package/plugins/freeflow/router/dist/vault.js +484 -0
- package/plugins/freeflow/skills/commit-work/SKILL.md +17 -16
- package/plugins/freeflow/skills/commit-work/references/staging-decisions.md +3 -3
- package/plugins/freeflow/skills/execute-plan/SKILL.md +70 -5
- package/plugins/freeflow/skills/execute-plan/references/execution-map.md +122 -0
- package/plugins/freeflow/skills/mode-contract/SKILL.md +1 -1
- package/plugins/freeflow/skills/output-router/SKILL.md +69 -0
- package/plugins/freeflow/skills/output-router/references/safety-policy.md +33 -0
- package/plugins/freeflow/skills/research/ARTIFACT-DESTINATIONS.md +58 -0
- package/plugins/freeflow/skills/research/CHECKPOINTS.md +74 -0
- package/plugins/freeflow/skills/research/LANGUAGE.md +61 -0
- package/plugins/freeflow/skills/research/SKILL.md +128 -0
- package/plugins/freeflow/skills/review-artifact/SKILL.md +34 -1
- package/plugins/freeflow/skills/review-artifact/references/reviewer-prompt.md +12 -1
- package/plugins/freeflow/skills/review-work/SKILL.md +25 -2
- package/plugins/freeflow/skills/review-work/references/reviewer-prompt.md +8 -0
- package/plugins/freeflow/skills/setup-freeflow/SKILL.md +14 -4
- package/plugins/freeflow/skills/setup-freeflow/references/activation-contract.md +8 -3
- package/plugins/freeflow/skills/setup-freeflow/references/host-setup.md +3 -1
- package/plugins/freeflow/skills/setup-freeflow/references/output-router-setup.md +52 -0
- package/plugins/freeflow/skills/workflow/SKILL.md +11 -3
- package/plugins/freeflow/skills/workflow/references/workflow-map.md +10 -11
- package/plugins/freeflow/skills/write-skill/SKILL.md +1 -1
- package/plugins/freeflow/skills/capture-decisions/SKILL.md +0 -95
- package/plugins/freeflow/skills/capture-decisions/references/destination-guide.md +0 -65
- package/plugins/freeflow/skills/grill-context/SKILL.md +0 -79
- package/plugins/freeflow/skills/grill-context/references/approach-framing.md +0 -52
- package/plugins/freeflow/skills/research-brief/SKILL.md +0 -69
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export interface LatencySummary {
|
|
2
|
+
p50: number;
|
|
3
|
+
p95: number;
|
|
4
|
+
}
|
|
5
|
+
export interface BenchmarkCliDefaults {
|
|
6
|
+
reportPath: string;
|
|
7
|
+
}
|
|
8
|
+
export interface ParsedBenchmarkCliArgs {
|
|
9
|
+
iterations?: number;
|
|
10
|
+
reportPath: string;
|
|
11
|
+
jsonReportPath?: string | false;
|
|
12
|
+
}
|
|
13
|
+
export declare function normalizeIterations(value: unknown, defaultIterations?: number): number;
|
|
14
|
+
export declare function approximateTokens(bytes: number): number;
|
|
15
|
+
export declare function percentile(values: readonly number[], quantile: number): number;
|
|
16
|
+
export declare function latencySummary(values: readonly number[]): LatencySummary;
|
|
17
|
+
export declare function averagePercent(values: readonly number[]): number;
|
|
18
|
+
export declare function medianPercent(values: readonly number[]): number;
|
|
19
|
+
export declare function reductionPercent(raw: number, routed: number): number;
|
|
20
|
+
export declare function formatPercent(value: number): string;
|
|
21
|
+
export declare function escapeMarkdownTableCell(value: string): string;
|
|
22
|
+
export declare function defaultJsonRunReportPath(markdownReportPath: string): string;
|
|
23
|
+
export declare function parseBenchmarkCliArgs(argv: readonly string[], defaults: BenchmarkCliDefaults): ParsedBenchmarkCliArgs;
|
|
24
|
+
export declare function writeBenchmarkReportPair<TReport>(options: {
|
|
25
|
+
report: TReport;
|
|
26
|
+
markdownReportPath: string;
|
|
27
|
+
jsonReportPath?: string | false | undefined;
|
|
28
|
+
renderMarkdown(report: TReport): string;
|
|
29
|
+
}): Promise<{
|
|
30
|
+
markdown: string;
|
|
31
|
+
json?: string;
|
|
32
|
+
}>;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { mkdir, writeFile } from "node:fs/promises";
|
|
2
|
+
import { basename, dirname, resolve } from "node:path";
|
|
3
|
+
export function normalizeIterations(value, defaultIterations = 3) {
|
|
4
|
+
if (typeof value === "number" && Number.isFinite(value) && value > 0) {
|
|
5
|
+
return Math.max(1, Math.floor(value));
|
|
6
|
+
}
|
|
7
|
+
if (Number.isFinite(defaultIterations) && defaultIterations > 0) {
|
|
8
|
+
return Math.max(1, Math.floor(defaultIterations));
|
|
9
|
+
}
|
|
10
|
+
return 1;
|
|
11
|
+
}
|
|
12
|
+
export function approximateTokens(bytes) {
|
|
13
|
+
return Math.ceil(bytes / 4);
|
|
14
|
+
}
|
|
15
|
+
export function percentile(values, quantile) {
|
|
16
|
+
if (values.length === 0) {
|
|
17
|
+
return 0;
|
|
18
|
+
}
|
|
19
|
+
const sorted = [...values].sort((a, b) => a - b);
|
|
20
|
+
const index = Math.min(sorted.length - 1, Math.max(0, Math.ceil(sorted.length * quantile) - 1));
|
|
21
|
+
return sorted[index] ?? 0;
|
|
22
|
+
}
|
|
23
|
+
export function latencySummary(values) {
|
|
24
|
+
return {
|
|
25
|
+
p50: percentile(values, 0.5),
|
|
26
|
+
p95: percentile(values, 0.95),
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
export function averagePercent(values) {
|
|
30
|
+
if (values.length === 0) {
|
|
31
|
+
return 0;
|
|
32
|
+
}
|
|
33
|
+
return roundPercent(values.reduce((sum, value) => sum + value, 0) / values.length);
|
|
34
|
+
}
|
|
35
|
+
export function medianPercent(values) {
|
|
36
|
+
return roundPercent(percentile(values, 0.5));
|
|
37
|
+
}
|
|
38
|
+
export function reductionPercent(raw, routed) {
|
|
39
|
+
if (raw <= 0) {
|
|
40
|
+
return 0;
|
|
41
|
+
}
|
|
42
|
+
return roundPercent(((raw - routed) / raw) * 100);
|
|
43
|
+
}
|
|
44
|
+
export function formatPercent(value) {
|
|
45
|
+
return `${value.toFixed(2)}%`;
|
|
46
|
+
}
|
|
47
|
+
export function escapeMarkdownTableCell(value) {
|
|
48
|
+
return value.replace(/\|/g, "\\|").replace(/\n/g, " ");
|
|
49
|
+
}
|
|
50
|
+
export function defaultJsonRunReportPath(markdownReportPath) {
|
|
51
|
+
const markdownName = basename(markdownReportPath);
|
|
52
|
+
const jsonName = markdownName.endsWith(".md") ? `${markdownName.slice(0, -".md".length)}.json` : `${markdownName}.json`;
|
|
53
|
+
return resolve(process.cwd(), "plugins/freeflow/evals/runs/output-router", jsonName);
|
|
54
|
+
}
|
|
55
|
+
export function parseBenchmarkCliArgs(argv, defaults) {
|
|
56
|
+
let iterations;
|
|
57
|
+
let reportPath = defaults.reportPath;
|
|
58
|
+
let jsonReportPath;
|
|
59
|
+
for (const arg of argv) {
|
|
60
|
+
if (arg.startsWith("--iterations=")) {
|
|
61
|
+
const value = Number(arg.slice("--iterations=".length));
|
|
62
|
+
if (Number.isFinite(value) && value > 0) {
|
|
63
|
+
iterations = value;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
else if (arg.startsWith("--report=")) {
|
|
67
|
+
reportPath = resolve(process.cwd(), arg.slice("--report=".length));
|
|
68
|
+
}
|
|
69
|
+
else if (arg.startsWith("--json-report=")) {
|
|
70
|
+
const value = arg.slice("--json-report=".length);
|
|
71
|
+
jsonReportPath = value === "off" ? false : resolve(process.cwd(), value);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
const parsed = iterations === undefined ? { reportPath } : { iterations, reportPath };
|
|
75
|
+
return jsonReportPath === undefined ? parsed : { ...parsed, jsonReportPath };
|
|
76
|
+
}
|
|
77
|
+
export async function writeBenchmarkReportPair(options) {
|
|
78
|
+
await mkdir(dirname(options.markdownReportPath), { recursive: true });
|
|
79
|
+
await writeFile(options.markdownReportPath, options.renderMarkdown(options.report), "utf8");
|
|
80
|
+
if (options.jsonReportPath === false) {
|
|
81
|
+
return { markdown: options.markdownReportPath };
|
|
82
|
+
}
|
|
83
|
+
if (options.jsonReportPath) {
|
|
84
|
+
await mkdir(dirname(options.jsonReportPath), { recursive: true });
|
|
85
|
+
await writeFile(options.jsonReportPath, `${JSON.stringify(options.report, null, 2)}\n`, "utf8");
|
|
86
|
+
return { markdown: options.markdownReportPath, json: options.jsonReportPath };
|
|
87
|
+
}
|
|
88
|
+
return { markdown: options.markdownReportPath };
|
|
89
|
+
}
|
|
90
|
+
function roundPercent(value) {
|
|
91
|
+
return Math.round(value * 100) / 100;
|
|
92
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
export interface RunRouterBenchmarksOptions {
|
|
2
|
+
iterations?: number;
|
|
3
|
+
generatedAt?: string;
|
|
4
|
+
}
|
|
5
|
+
export interface RouterBenchmarkReport {
|
|
6
|
+
generatedAt: string;
|
|
7
|
+
iterations: number;
|
|
8
|
+
summary: RouterBenchmarkSummary;
|
|
9
|
+
fixtures: RouterBenchmarkFixtureResult[];
|
|
10
|
+
skippedExternalTools: SkippedExternalTool[];
|
|
11
|
+
}
|
|
12
|
+
export interface RouterBenchmarkSummary {
|
|
13
|
+
fixtures: number;
|
|
14
|
+
modeResults: number;
|
|
15
|
+
improved: ModeSummary;
|
|
16
|
+
nativeBaseline: ModeSummary;
|
|
17
|
+
freeflowBaseline: ModeSummary;
|
|
18
|
+
generatedFalsePositiveCount: number;
|
|
19
|
+
sandboxFailureFixed: boolean;
|
|
20
|
+
}
|
|
21
|
+
export interface ModeSummary {
|
|
22
|
+
passed: number;
|
|
23
|
+
failed: number;
|
|
24
|
+
skipped: number;
|
|
25
|
+
pathCorrect: number;
|
|
26
|
+
spanCorrect: number;
|
|
27
|
+
excerptComplete: number;
|
|
28
|
+
generatedFalsePositiveCount: number;
|
|
29
|
+
totalRawBytes: number;
|
|
30
|
+
totalRoutedBytes: number;
|
|
31
|
+
totalRawTokensApprox: number;
|
|
32
|
+
totalRoutedTokensApprox: number;
|
|
33
|
+
weightedByteReductionPercent: number;
|
|
34
|
+
weightedTokenReductionPercent: number;
|
|
35
|
+
averageByteReductionPercent: number;
|
|
36
|
+
medianByteReductionPercent: number;
|
|
37
|
+
averageTokenReductionPercent: number;
|
|
38
|
+
medianTokenReductionPercent: number;
|
|
39
|
+
}
|
|
40
|
+
export interface RouterBenchmarkFixtureResult {
|
|
41
|
+
id: string;
|
|
42
|
+
title: string;
|
|
43
|
+
kind: BenchmarkKind;
|
|
44
|
+
expected: BenchmarkExpected;
|
|
45
|
+
results: RouterBenchmarkModeResult[];
|
|
46
|
+
}
|
|
47
|
+
export interface RouterBenchmarkModeResult {
|
|
48
|
+
mode: BenchmarkMode;
|
|
49
|
+
toolPathUsed: string;
|
|
50
|
+
skipped: boolean;
|
|
51
|
+
skipReason?: string;
|
|
52
|
+
rawBytes: number;
|
|
53
|
+
rawTokensApprox: number;
|
|
54
|
+
routedBytes: number;
|
|
55
|
+
routedTokensApprox: number;
|
|
56
|
+
byteReductionPercent: number;
|
|
57
|
+
tokenReductionPercent: number;
|
|
58
|
+
latencyMs: {
|
|
59
|
+
p50: number;
|
|
60
|
+
p95: number;
|
|
61
|
+
};
|
|
62
|
+
actualPath?: string;
|
|
63
|
+
actualLines?: string;
|
|
64
|
+
correctness: CorrectnessResult;
|
|
65
|
+
recovery: RecoveryResult;
|
|
66
|
+
notes: string[];
|
|
67
|
+
}
|
|
68
|
+
export interface BenchmarkExpected {
|
|
69
|
+
path?: string;
|
|
70
|
+
pathIncludes?: string;
|
|
71
|
+
lines?: string;
|
|
72
|
+
requiredExcerpt?: string[];
|
|
73
|
+
}
|
|
74
|
+
export interface CorrectnessResult {
|
|
75
|
+
passed: boolean;
|
|
76
|
+
pathCorrect: boolean;
|
|
77
|
+
spanCorrect: boolean;
|
|
78
|
+
excerptComplete: boolean;
|
|
79
|
+
generatedFalsePositive: boolean;
|
|
80
|
+
}
|
|
81
|
+
export interface RecoveryResult {
|
|
82
|
+
status: "passed" | "failed" | "not-applicable" | "skipped";
|
|
83
|
+
detail: string;
|
|
84
|
+
}
|
|
85
|
+
export interface SkippedExternalTool {
|
|
86
|
+
name: string;
|
|
87
|
+
reason: string;
|
|
88
|
+
}
|
|
89
|
+
type BenchmarkKind = "repo-query" | "repo-expand" | "vault-query";
|
|
90
|
+
type BenchmarkMode = "native-baseline-proxy" | "pre-hardening-freeflow-proxy" | "improved-freeflow-router";
|
|
91
|
+
export declare function runRouterBenchmarks(options?: RunRouterBenchmarksOptions): Promise<RouterBenchmarkReport>;
|
|
92
|
+
export declare function renderRouterBenchmarkReport(report: RouterBenchmarkReport): string;
|
|
93
|
+
export declare function writeRouterBenchmarkReport(report: RouterBenchmarkReport, reportPath: string): Promise<void>;
|
|
94
|
+
export declare function writeRouterBenchmarkJsonReport(report: RouterBenchmarkReport, reportPath: string): Promise<void>;
|
|
95
|
+
export interface WriteRouterBenchmarkReportsOptions {
|
|
96
|
+
jsonReportPath?: string | false;
|
|
97
|
+
}
|
|
98
|
+
export declare function writeRouterBenchmarkReports(report: RouterBenchmarkReport, markdownReportPath: string, options?: WriteRouterBenchmarkReportsOptions): Promise<{
|
|
99
|
+
markdown: string;
|
|
100
|
+
json?: string;
|
|
101
|
+
}>;
|
|
102
|
+
export {};
|