Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 16 additions & 27 deletions repo_assumptions.md
Original file line number Diff line number Diff line change
@@ -1,32 +1,21 @@
# repo_assumptions.md

## Verified
- Node.js 18+, pnpm, and Docker Compose are documented in repository guidance and root tooling.
- GraphQL + REST API surfaces are present.
- Multi-agent architecture code exists under `src/agents/`.
- Governance artifacts exist under `docs/ga/`.
- Canonical path map assumptions from planning were validated against current tree where possible.

## Assumed (now validated)
- `src/agents` exists. **Validated**
- `apps/web` exists. **Validated**
- `.github/workflows/ci-core.yml` exists. **Validated**
- `.github/scripts` exists. **Validated**
- `tests/e2e` exists. **Validated**
- Feature-flag framework exists in some form. **Deferred pending targeted implementation wiring**
- `.github/workflows` structure exists.
- `src/api`, `src/agents`, `src/connectors`, and `src/graphrag` are present.

## Assumed

- No existing "founder intelligence" pipeline under `src/agents`.
- No structured business validation schema for founder idea intake.
- No lightweight financial modeling module specific to founder pipeline validation.
Comment on lines +8 to +10
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Stale assumptions now conflict with merged founder scaffold.

Line 8–Line 10 state these modules do not exist, but this PR introduces them under src/agents/founder. Please update these bullets to avoid misleading follow-up work.

🧰 Tools
🪛 LanguageTool

[style] ~10-~10: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...ation schema for founder idea intake. - No lightweight financial modeling module s...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@repo_assumptions.md` around lines 8 - 10, The three bullets claiming absence
of a "founder intelligence" pipeline, a structured business validation schema,
and a lightweight financial modeling module are now stale because this PR added
the founder scaffold under src/agents/founder; update the repo_assumptions.md
entries to reflect that a founder pipeline and associated modules exist (mention
src/agents/founder, the founder intelligence pipeline, the business validation
schema, and the financial modeling module) or change the bullets to note their
current status (implemented/partial/planned) to avoid misleading follow-ups.


## Must NOT touch

## Must-not-touch files
- Package manager lockfile unless a dependency addition is explicitly required.
- Existing `docs/ga` pilot artifacts unrelated to this feature.
- Governance policy baselines unless extending with additive controls and tests.
- Release workflows unless change is explicitly scoped to release operations.
- `src/graphrag/core` retrieval logic.
- Existing CI gate naming conventions.

## Validation checklist before PR1
- Confirm exact frontend feature location (`apps/web` feature directory and conventions).
- Confirm API server routing conventions for SSE endpoints.
- Confirm required status checks in branch protection for this branch.
- Confirm evidence schema and artifact output locations for run reports.
- Confirm whether `.github/scripts` or root `scripts/` is canonical for drift/ops additions.
## Validation checklist

## Readiness assertion
This recon step establishes present-state facts and constrains future implementation scope to additive, feature-flagged delivery with governance-compatible evidence and policy gates.
- Confirm schema conventions in `src/graphrag`.
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Checklist points to the wrong schema area for this feature.

Line 19 references src/graphrag, but founder validation schema conventions are implemented in src/agents/founder/schemas.ts. Consider updating the checklist target.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@repo_assumptions.md` at line 19, The checklist currently points to
src/graphrag but the founder validation schemas live in the founder schemas
file; update the checklist entry to reference the correct schema location by
replacing the target with schemas.ts in agents/founder (the founder validation
schema module) so the checklist points to the actual implementation used for
founder validation.

- Check evidence ID format consistency with existing governance scripts.
- Verify agent orchestration interfaces before wiring broader flow.
33 changes: 33 additions & 0 deletions src/agents/founder/__tests__/schemas.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { describe, expect, it } from "vitest";

import { FOUNDER_VALIDATION_THRESHOLD, buildFounderEvidenceId } from "../schemas";
import { runFounderPipeline } from "../pipeline";

describe("founder pipeline", () => {
it("builds deterministic evidence IDs", () => {
const first = buildFounderEvidenceId("problem", "acme-billing-delays");
const second = buildFounderEvidenceId("problem", "acme-billing-delays");

expect(first).toBe(second);
expect(first.startsWith("EVID-FOUND-problem-")).toBe(true);
});

it("produces stable report artifacts and enforces threshold", () => {
const output = runFounderPipeline({
title: "Automated customer collections assistant",
summary: "Reduce collections cycle time for SMB finance teams.",
problem: {
customer: "SMB controllers",
pain_point: "Manual collections workflows lose 10+ hours/week",
existing_alternatives: ["Spreadsheets", "Generic CRMs"],
},
evidence: ["interview-01", "survey-02"],
});

expect(output.stamp.deterministic).toBe(true);
expect(output.validation.threshold).toBe(FOUNDER_VALIDATION_THRESHOLD);
expect(output.validation.score).toBeGreaterThanOrEqual(0);
expect(output.validation.score).toBeLessThanOrEqual(1);
expect(output.metrics.latency_budget_ms).toBe(2000);
});
});
45 changes: 45 additions & 0 deletions src/agents/founder/pipeline.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import { FounderIdeaInput } from "./schemas";
import { buildFounderMetrics } from "./scoring";
import { scoreFounderIdea } from "./validators";

export interface FounderPipelineConfig {
founder_pipeline_v1: boolean;
}

export interface FounderPipelineOutput {
report: {
title: string;
summary: string;
recommended_action: "advance" | "revise";
};
validation: ReturnType<typeof scoreFounderIdea>;
metrics: ReturnType<typeof buildFounderMetrics>;
stamp: {
deterministic: true;
feature_flag: "founder_pipeline_v1";
enabled: boolean;
};
}

export function runFounderPipeline(
input: FounderIdeaInput,
config: FounderPipelineConfig = { founder_pipeline_v1: false }
): FounderPipelineOutput {
const validation = scoreFounderIdea(input);
const metrics = buildFounderMetrics(input);

return {
report: {
title: input.title,
summary: input.summary,
recommended_action: validation.passed ? "advance" : "revise",
},
validation,
metrics,
stamp: {
deterministic: true,
feature_flag: "founder_pipeline_v1",
enabled: config.founder_pipeline_v1,
},
Comment on lines +35 to +43
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Feature flag does not currently gate decision output.

Line 35 can return "advance" even when Line 42 reports the feature as disabled. If this flag is meant to gate rollout, decision output should also be gated.

Proposed fix
 export function runFounderPipeline(
   input: FounderIdeaInput,
   config: FounderPipelineConfig = { founder_pipeline_v1: false }
 ): FounderPipelineOutput {
+  const enabled = config.founder_pipeline_v1;
   const validation = scoreFounderIdea(input);
   const metrics = buildFounderMetrics(input);

   return {
@@
-      recommended_action: validation.passed ? "advance" : "revise",
+      recommended_action: enabled && validation.passed ? "advance" : "revise",
@@
-      enabled: config.founder_pipeline_v1,
+      enabled,
     },
   };
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/agents/founder/pipeline.ts` around lines 35 - 43, The recommended_action
can be "advance" even when the feature flag (stamp.feature_flag / stamp.enabled)
is false; update the logic that builds recommended_action so it only yields
"advance" when validation.passed AND the feature flag is enabled (use
stamp.enabled or config.founder_pipeline_v1), otherwise return the non-flagged
fallback (e.g., "revise" or the prior behavior). Locate the object that sets
recommended_action and change the ternary/assignment to include the feature-flag
check alongside validation.passed (reference recommended_action,
validation.passed, stamp.enabled, and config.founder_pipeline_v1).

};
}
41 changes: 41 additions & 0 deletions src/agents/founder/schemas.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import { createHash } from "node:crypto";

export interface ProblemDefinition {
customer: string;
pain_point: string;
existing_alternatives: string[];
}

export interface FounderIdeaInput {
title: string;
summary: string;
problem: ProblemDefinition;
evidence: string[];
}

export interface ValidationResult {
score: number;
passed: boolean;
threshold: number;
evidenceIds: string[];
checks: {
problemDefined: boolean;
evidenceBacked: boolean;
alternativesListed: boolean;
};
}

export const FOUNDER_VALIDATION_THRESHOLD = 0.7;

export function buildFounderEvidenceId(stage: string, payload: string): string {
const hash = createHash("sha256").update(payload).digest("hex").slice(0, 10);
return `EVID-FOUND-${stage}-${hash}`;
}

export function validateProblemDefinition(problem: ProblemDefinition): ValidationResult["checks"] {
return {
problemDefined: Boolean(problem.customer.trim() && problem.pain_point.trim()),
evidenceBacked: true,
alternativesListed: problem.existing_alternatives.length > 0,
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Require non-empty alternatives before marking listed

validateProblemDefinition marks alternativesListed true when existing_alternatives.length > 0, which accepts arrays containing only empty/whitespace strings (for example [" "]). This inflates the validation score and can flip outcomes to pass despite missing real alternative analysis; trim and validate at least one non-empty alternative value.

Useful? React with 👍 / 👎.

};
}
22 changes: 22 additions & 0 deletions src/agents/founder/scoring.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { FounderIdeaInput } from "./schemas";
import { scoreFounderIdea } from "./validators";

export interface FounderMetrics {
latency_budget_ms: number;
memory_budget_mb: number;
cost_budget: "negligible";
score: number;
passed: boolean;
}

export function buildFounderMetrics(input: FounderIdeaInput): FounderMetrics {
const validation = scoreFounderIdea(input);

return {
latency_budget_ms: 2000,
memory_budget_mb: 200,
cost_budget: "negligible",
score: validation.score,
passed: validation.passed,
};
}
25 changes: 25 additions & 0 deletions src/agents/founder/validators.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import {
FOUNDER_VALIDATION_THRESHOLD,
FounderIdeaInput,
ValidationResult,
buildFounderEvidenceId,
validateProblemDefinition,
} from "./schemas";

export function scoreFounderIdea(input: FounderIdeaInput): ValidationResult {
const checks = validateProblemDefinition(input.problem);
const evidenceIds = input.evidence.map((item) => buildFounderEvidenceId("validation", item));

checks.evidenceBacked = evidenceIds.length > 0;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Exclude blank evidence items from evidenceBacked check

In scoreFounderIdea, checks.evidenceBacked is set using only evidenceIds.length > 0, so inputs like evidence: [" "] are treated as evidence-backed and can satisfy the gate even when no substantive evidence exists. Because this check contributes directly to passed, the pipeline can incorrectly advance low-quality ideas; filter/trim evidence entries before generating IDs and scoring.

Useful? React with 👍 / 👎.

Comment on lines +11 to +13
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Whitespace-only evidence can incorrectly pass validation.

Line 13 treats any array entry as evidence, including blank strings. Normalize and filter evidence before generating IDs/checking evidenceBacked.

Proposed fix
-  const evidenceIds = input.evidence.map((item) => buildFounderEvidenceId("validation", item));
-
-  checks.evidenceBacked = evidenceIds.length > 0;
+  const normalizedEvidence = input.evidence
+    .map((item) => item.trim())
+    .filter((item) => item.length > 0);
+  const evidenceIds = normalizedEvidence.map((item) =>
+    buildFounderEvidenceId("validation", item)
+  );
+
+  checks.evidenceBacked = normalizedEvidence.length > 0;
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const evidenceIds = input.evidence.map((item) => buildFounderEvidenceId("validation", item));
checks.evidenceBacked = evidenceIds.length > 0;
const normalizedEvidence = input.evidence
.map((item) => item.trim())
.filter((item) => item.length > 0);
const evidenceIds = normalizedEvidence.map((item) =>
buildFounderEvidenceId("validation", item)
);
checks.evidenceBacked = normalizedEvidence.length > 0;
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/agents/founder/validators.ts` around lines 11 - 13, The code currently
treats any entry in input.evidence as valid (so whitespace-only strings pass);
before mapping to IDs with buildFounderEvidenceId and before setting
checks.evidenceBacked, normalize and filter out falsy/whitespace-only entries by
trimming each item (e.g., const cleaned = input.evidence.map(s =>
s?.trim()).filter(Boolean)), then map cleaned to evidenceIds via
buildFounderEvidenceId and set checks.evidenceBacked = evidenceIds.length > 0 so
only non-empty evidence counts.


const satisfiedChecks = Object.values(checks).filter(Boolean).length;
const score = Number((satisfiedChecks / 3).toFixed(4));

return {
score,
passed: score >= FOUNDER_VALIDATION_THRESHOLD,
threshold: FOUNDER_VALIDATION_THRESHOLD,
evidenceIds,
checks,
};
}
Loading