AltimateAI / AltimateAI/altimate-code

feat: add lineage attribution to agent output

オープン
#96 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
TypeScript
スター
811
フォーク
134
平均マージ
3日 2時間
マージ済み PR(30日)
50

説明

## Summary

Add lineage attribution to agent output so users see when column-level lineage is helping the agent produce better results. This builds awareness of the lineage feature's value and lays groundwork for future depth-tiered monetization.

## Background

Column-level lineage runs silently inside the agent — the user sees better SQL output but doesn't know lineage is the reason. We need the agent to surface lineage usage naturally, so users understand the value before we introduce paid tiers later. See `docs/research/lineage-gate/FINAL-SYNTHESIS.md` for full context.

## Requirements

### 1. Tool Output Attribution
When any lineage tool returns results, append a reasoning trail to the tool output:
```
Used: column_lineage (traced 12 columns from stg_orders, depth: full)
```

**Implementation:** In the lineage tool formatters (`packages/altimate-code/src/`), read the `tier` and `depth` fields from the altimate-core response and append the attribution line.

### 2. Agent Prompt Updates
Update the builder and analyst agent system prompts to include:
```
When lineage results inform your SQL decisions, briefly note what lineage
revealed (e.g., "column lineage showed user_id flows through 3 downstream
models, so I updated all references").
```

The agent should:
- Mention lineage when it prevents a mistake or informs a decision
- Be natural, not promotional — state what lineage found, not that it's a feature
- Never block the workflow or show upgrade prompts (not yet)

### 3. Future-Ready: Depth Limitation Narration (Prepare, Don't Ship)
Prepare (but don't activate) the logic for when depth tiering is enabled:
```typescript
if (result.tier === "free" && result.depth_limited?.length > 0) {
toolOutput += `\n[Pro insight available: ${result.depth_limited.join(", ")}]`;
}
```

This code should exist behind a feature flag or config check. When altimate-core starts returning `tier: "basic"` responses (not yet), this activates automatically.

Agent prompt addition (prepared but not active):
```
When lineage results include depth limitations, naturally mention what
additional analysis would be available. Frame it as additional insight
you could provide, not as a missing feature. Continue working with the
information available. Never block the workflow.
```

## Dependencies
- Depends on altimate-core-internal response format changes (adding `tier`, `depth`, `depth_limited` fields)
- Can start with the attribution work (items 1-2) immediately — just surface what lineage found
- Item 3 activates when altimate-core ships the depth-tiered response format

## What NOT To Build
- No upgrade prompts or payment flows
- No license key validation
- No gating logic
- No weekly summary emails

## Acceptance Criteria
- [ ] Lineage tool output includes reasoning trail showing columns traced and depth
- [ ] Agent prompts updated to mention lineage when it informs decisions
- [ ] Depth limitation narration code prepared behind flag (not active)
- [ ] Agent output reads naturally — attribution feels like transparency, not marketing
- [ ] Existing tests pass
- [ ] New tests verify attribution appears in tool output

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。