Merge branch 'master' of https://gitee.com/zzzisfunnyboy/obsidian-notes
# Conflicts: # .obsidian/workspace.json # 1Project/AI工程/agent工作流编排/Hermes编排Agent_Web可观测性方案.md # 3Resources/AI/Harness Engineering最佳实践_深度解析AgentHamness的底层原理_核心组件和实战应用 学不会我_BV1Hn9UBrEsH_P1_笔记.md # 3Resources/AI/让AI真正读懂证据间的因果_深度验证框架解决逻辑断层_实现92.0_平衡准确率_BV1p9QnBtEMq_笔记.md
This commit is contained in:
@@ -0,0 +1,50 @@
|
|||||||
|
# Context Snapshot: scheduled-task-git-sync-gant
|
||||||
|
|
||||||
|
## Task Statement
|
||||||
|
为该路径添加一个定时任务,每天晚上十点半的时候 git pull & push,然后把 inbox 中的内容使用 skill:gant
|
||||||
|
|
||||||
|
## Desired Outcome
|
||||||
|
A nightly scheduled task at 22:30 that:
|
||||||
|
1. Syncs the repo via `git pull && git push`
|
||||||
|
2. Processes InBox markdown notes through the `gant-cli` skill
|
||||||
|
|
||||||
|
## Stated Solution
|
||||||
|
Add a cron/scheduled task running at 22:30 daily
|
||||||
|
|
||||||
|
## Probable Intent Hypothesis
|
||||||
|
User wants automated end-of-day sync of Obsidian notes to Gitee remote, plus automatic conversion of inbox notes into Gantt task manager entries. This suggests a daily capture → organize → sync workflow.
|
||||||
|
|
||||||
|
## Known Facts
|
||||||
|
- Repo: `C:\app\unity_project\obsidian-notes`
|
||||||
|
- Remote: `https://gitee.com/zzzisfunnyboy/obsidian-notes.git` (Gitee)
|
||||||
|
- InBox currently contains 4 `.md` files
|
||||||
|
- Git has uncommitted changes: `.obsidian/workspace.json` (modified) + one untracked InBox file
|
||||||
|
- `gant-cli` skill: manages Gantt desktop tasks via `gant.exe`/`gantt-app.exe` CLI (list, add, update, delete, lock)
|
||||||
|
- Platform: Windows, shell: bash
|
||||||
|
- No existing `.omx/context/` snapshots
|
||||||
|
- Claude Code `CronCreate` tool exists for scheduling recurring tasks
|
||||||
|
|
||||||
|
## Constraints
|
||||||
|
- Must use Claude Code's `CronCreate` (not Windows Task Scheduler or system cron)
|
||||||
|
- Git operations need to handle potential merge conflicts gracefully
|
||||||
|
- InBox processing: what exactly should happen to inbox files after processing? (Move? Delete? Leave?)
|
||||||
|
|
||||||
|
## Unknowns / Open Questions
|
||||||
|
1. **What does "process InBox content with skill:gant" mean concretely?** Extract tasks from each markdown note into Gantt? Convert the whole note into a Gantt task? Something else?
|
||||||
|
2. **What should happen to InBox files after processing?** Delete them? Move them to an archive? Mark as processed?
|
||||||
|
3. **Should the scheduled task also commit local changes before push?** Currently there are uncommitted modifications.
|
||||||
|
4. **What's the relationship between Obsidian notes and Gantt tasks?** Is there a specific format or template?
|
||||||
|
5. **Error handling expectations?** What if git pull has conflicts? What if gantt-app isn't running?
|
||||||
|
6. **Is the gantt-app.exe path known and stable?**
|
||||||
|
|
||||||
|
## Decision-Boundary Unknowns
|
||||||
|
- Whether to auto-commit changes or only pull/push
|
||||||
|
- How to handle InBox files post-processing (archive vs delete)
|
||||||
|
- Error notification strategy (silent fail? log? notify?)
|
||||||
|
- Whether this should be durable (persist across Claude sessions)
|
||||||
|
|
||||||
|
## Likely Codebase Touchpoints
|
||||||
|
- Cron job: `CronCreate` tool or `.claude/scheduled_tasks.json`
|
||||||
|
- Git operations: bash commands
|
||||||
|
- Gantt integration: `gant-cli` skill invocation
|
||||||
|
- InBox: `C:\app\unity_project\obsidian-notes\InBox\` directory
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
# Interview Transcript: scheduled-task-git-sync-gant
|
||||||
|
|
||||||
|
**Profile:** Standard
|
||||||
|
**Timestamp:** 20260429T161523Z
|
||||||
|
**Final Ambiguity:** 0.16
|
||||||
|
**Threshold:** 0.20
|
||||||
|
**Type:** Brownfield
|
||||||
|
|
||||||
|
## Round Summary
|
||||||
|
|
||||||
|
| R | Target | Focus | Key Finding |
|
||||||
|
|---|--------|-------|-------------|
|
||||||
|
| 1 | Intent | Why automate? | Goal: InBox notes auto-appear in Gantt chart, eliminating manual transfer |
|
||||||
|
| 2 | Outcome | Concrete format | Gantt task format: `待看:{文件名}` |
|
||||||
|
| 3 | Outcome | Post-processing | InBox files stay; deleted files → tasks removed from Gantt; de-duplicated |
|
||||||
|
| 4 | Scope | Git range | Only `PARA/` and `InBox/` folders |
|
||||||
|
| 5 | Scope | Auto-commit | Auto `add PARA/ InBox/ && commit -m "auto nightly sync"` before push |
|
||||||
|
| 6 | Constraints | Gantt offline | Silent skip, try next day |
|
||||||
|
| 7 | Decision Boundaries | Technical choices | abort on merge conflict; push failure → Windows toast notification |
|
||||||
|
| 8 | Non-goals | Persistence model | User wants system-level script, not Claude session-dependent |
|
||||||
|
| 9 | Constraints | Trigger mechanism | Windows Task Scheduler, self-chosen |
|
||||||
|
| 10 | Success Criteria | Verification | 10:30 PM: open Gantt chart, see expected "待看:xxx" tasks |
|
||||||
|
| 11 | Non-goals | Boundaries | Only PARA/InBox git, only "待看" task type, only .md files |
|
||||||
|
| 12 | Decision Boundaries | Remaining choices | Script alongside gantt-app.exe; toast notifications; no log; update existing |
|
||||||
|
|
||||||
|
## Exposed Assumptions
|
||||||
|
- gantt-app.exe CLI supports add/delete/list/toggle-lock operations
|
||||||
|
- Windows Task Scheduler can trigger bash scripts
|
||||||
|
- Git merge conflicts are rare enough that abort is acceptable
|
||||||
|
- User's computer is on at 22:30
|
||||||
69
.omx/plans/autopilot-impl.md
Normal file
69
.omx/plans/autopilot-impl.md
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
# Implementation Plan: InBox → Gantt Nightly Sync
|
||||||
|
|
||||||
|
## Source of Truth
|
||||||
|
- Spec: `.omx/specs/deep-interview-scheduled-task-git-sync-gant.md`
|
||||||
|
- Context: `.omx/context/scheduled-task-git-sync-gant-20260429T161523Z.md`
|
||||||
|
|
||||||
|
## Architecture
|
||||||
|
|
||||||
|
```
|
||||||
|
Windows Task Scheduler (22:30 daily)
|
||||||
|
└─ powershell.exe -ExecutionPolicy Bypass -File "sync-inbox-to-gantt.ps1"
|
||||||
|
├─ 1. Git sync (pull, add, commit, push)
|
||||||
|
├─ 2. Gantt bidirectional mirror (InBox ↔ Gantt "待看:*" tasks)
|
||||||
|
└─ 3. Notifications (push failure toast)
|
||||||
|
```
|
||||||
|
|
||||||
|
## Files to Create
|
||||||
|
|
||||||
|
| File | Path | Purpose |
|
||||||
|
|------|------|---------|
|
||||||
|
| Sync script | `C:\Users\Zane\Desktop\Gantt App\sync-inbox-to-gantt.ps1` | Main nightly script |
|
||||||
|
| Setup script | `C:\app\unity_project\obsidian-notes\.omx\setup-task.ps1` | One-shot Task Scheduler registration |
|
||||||
|
|
||||||
|
## Algorithm
|
||||||
|
|
||||||
|
### Phase A — Git Sync
|
||||||
|
1. `cd C:\app\unity_project\obsidian-notes`
|
||||||
|
2. `git pull` — if conflict → `git merge --abort` → exit git phase
|
||||||
|
3. `git add PARA/ InBox/`
|
||||||
|
4. `git diff --cached --quiet` → if no changes, skip commit
|
||||||
|
5. `git commit -m "auto nightly sync"`
|
||||||
|
6. `git push` — if failure → Show-Toast "Git push failed" → continue
|
||||||
|
|
||||||
|
### Phase B — Gantt Mirror
|
||||||
|
1. Call `gantt-app.exe --cli list-tasks` → parse JSON
|
||||||
|
- If Gantt not running (process error / non-zero exit) → skip phase B
|
||||||
|
2. Extract `"待看:*"` tasks → set `{baseName}` from task name
|
||||||
|
3. Scan `InBox\*.md` → set `{baseName}` from filename (strip .md)
|
||||||
|
4. **Add**: For each InBox file NOT in Gantt → `add-task --name "待看:{baseName}" --start {today} --end "" --progress 0`
|
||||||
|
5. **Delete**: For each Gantt "待看:*" NOT in InBox → `delete-task --id {id}`
|
||||||
|
6. **Existing matches**: No-op (already correct)
|
||||||
|
|
||||||
|
### Error Handling Matrix
|
||||||
|
|
||||||
|
| Failure | Behavior |
|
||||||
|
|---------|----------|
|
||||||
|
| Git pull conflict | `git merge --abort`, skip rest of git phase |
|
||||||
|
| Git push fails | PowerShell toast notification, continue to Gantt phase |
|
||||||
|
| Gantt CLI not found | Write-Error, exit 1 |
|
||||||
|
| Gantt not running | Skip Gantt phase silently |
|
||||||
|
| Gantt add/delete fails | Write-Error for that item, continue |
|
||||||
|
| Script not in gantt dir | Resolve gantt dir from script location dynamically |
|
||||||
|
|
||||||
|
## Task Scheduler Registration
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
$action = New-ScheduledTaskAction -Execute "powershell.exe" `
|
||||||
|
-Argument "-ExecutionPolicy Bypass -File `"C:\Users\Zane\Desktop\Gantt App\sync-inbox-to-gantt.ps1`""
|
||||||
|
$trigger = New-ScheduledTaskTrigger -Daily -At 22:30
|
||||||
|
Register-ScheduledTask -TaskName "InBox-Gantt-Nightly-Sync" `
|
||||||
|
-Action $action -Trigger $trigger -RunLevel Highest `
|
||||||
|
-Description "Nightly sync Obsidian InBox to Gantt tasks with git auto-commit"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Implementation Tasks
|
||||||
|
|
||||||
|
1. **Create sync-inbox-to-gantt.ps1** — the main sync script with all logic
|
||||||
|
2. **Create setup-task.ps1** — registers the scheduled task
|
||||||
|
3. **Manual dry-run test** — run script manually, verify Gantt tasks created
|
||||||
25
.omx/setup-task.ps1
Normal file
25
.omx/setup-task.ps1
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
# setup-task.ps1
|
||||||
|
# Register the nightly InBox→Gantt sync task in Windows Task Scheduler.
|
||||||
|
# Run once, as Administrator.
|
||||||
|
|
||||||
|
$taskName = "InBox-Gantt-Nightly-Sync"
|
||||||
|
$scriptPath = "C:\Users\Zane\Desktop\Gantt-App\sync-inbox-to-gantt.ps1"
|
||||||
|
|
||||||
|
# Remove existing task if present
|
||||||
|
$existing = Get-ScheduledTask -TaskName $taskName -ErrorAction SilentlyContinue
|
||||||
|
if ($existing) {
|
||||||
|
Unregister-ScheduledTask -TaskName $taskName -Confirm:$false
|
||||||
|
Write-Host "Removed existing task: $taskName"
|
||||||
|
}
|
||||||
|
|
||||||
|
$action = New-ScheduledTaskAction -Execute "powershell.exe" `
|
||||||
|
-Argument "-NoProfile -ExecutionPolicy Bypass -WindowStyle Hidden -File `"$scriptPath`""
|
||||||
|
$trigger = New-ScheduledTaskTrigger -Daily -At 22:30
|
||||||
|
$settings = New-ScheduledTaskSettingsSet -AllowStartIfOnBatteries -DontStopIfGoingOnBatteries -StartWhenAvailable
|
||||||
|
|
||||||
|
Register-ScheduledTask -TaskName $taskName `
|
||||||
|
-Action $action -Trigger $trigger -Settings $settings `
|
||||||
|
-Description "Nightly: git sync PARA/InBox + mirror InBox .md files to Gantt '待看:*' tasks"
|
||||||
|
|
||||||
|
Write-Host "Task '$taskName' registered. Next run: $(Get-Date -Format 'yyyy-MM-dd') 22:30"
|
||||||
|
Write-Host "Script: $scriptPath"
|
||||||
85
.omx/specs/deep-interview-scheduled-task-git-sync-gant.md
Normal file
85
.omx/specs/deep-interview-scheduled-task-git-sync-gant.md
Normal file
@@ -0,0 +1,85 @@
|
|||||||
|
# Spec: Deep Interview — scheduled-task-git-sync-gant
|
||||||
|
|
||||||
|
## Metadata
|
||||||
|
- **Profile:** Standard
|
||||||
|
- **Rounds:** 12
|
||||||
|
- **Final Ambiguity:** 0.16
|
||||||
|
- **Threshold:** 0.20 (met)
|
||||||
|
- **Type:** Brownfield
|
||||||
|
- **Context Snapshot:** `.omx/context/scheduled-task-git-sync-gant-20260429T161523Z.md`
|
||||||
|
|
||||||
|
## Clarity Breakdown
|
||||||
|
|
||||||
|
| Dimension | Weight | Score | Notes |
|
||||||
|
|-----------|--------|-------|-------|
|
||||||
|
| Intent | 0.25 | 0.85 | InBox notes visible in Gantt chart without manual steps |
|
||||||
|
| Outcome | 0.20 | 0.85 | New → added, deleted → removed, existing → de-duplicated |
|
||||||
|
| Scope | 0.20 | 0.85 | PARA/InBox git only; "待看" type only; .md files only |
|
||||||
|
| Constraints | 0.15 | 0.80 | Win Task Scheduler; gantt-app.exe; toast; abort on conflict; no logs |
|
||||||
|
| Success | 0.10 | 0.80 | At 22:30, Gantt shows "待看:xxx" for all InBox .md files |
|
||||||
|
| Context | 0.10 | 0.90 | Well-understood repo and tooling |
|
||||||
|
| **Weighted** | | **0.84** | Ambiguity = 0.16 |
|
||||||
|
|
||||||
|
## Intent
|
||||||
|
用户希望每晚 22:30 自动将 InBox 中的待读笔记同步到甘特图软件中,消除手动搬运步骤。
|
||||||
|
|
||||||
|
## Desired Outcome
|
||||||
|
- 甘特图出现所有 InBox 中 `.md` 文件对应的 "待看:{文件名}" 任务
|
||||||
|
- 已存在的不重复添加(更新)
|
||||||
|
- InBox 中已删除的文件对应任务也从甘特图中移除
|
||||||
|
- Git 自动拉取/提交/推送 PARA/ 和 InBox/ 目录
|
||||||
|
|
||||||
|
## In-Scope
|
||||||
|
1. 每晚 22:30 通过 Windows Task Scheduler 触发
|
||||||
|
2. `git pull && git add PARA/ InBox/ && git commit -m "auto nightly sync" && git push`
|
||||||
|
3. 扫描 InBox/*.md,为每个文件在甘特图创建/更新 "待看:{文件名}" 任务
|
||||||
|
4. 检测甘特图中已存在的 "待看:xxx" 任务,若 InBox 中对应文件已删除则移除
|
||||||
|
5. 去重:已在甘特图中的任务不重复创建,仅更新
|
||||||
|
6. 脚本文件与 gantt-app.exe 放在同一目录
|
||||||
|
|
||||||
|
## Out-of-Scope / Non-goals
|
||||||
|
1. 不操作 PARA/ 和 InBox/ 之外的任何文件
|
||||||
|
2. 不创建 "待看" 之外的甘特图任务类型
|
||||||
|
3. 不处理非 `.md` 文件
|
||||||
|
|
||||||
|
## Decision Boundaries (OMX 可自行决定)
|
||||||
|
- 具体用哪个 Windows 通知 API(PowerShell toast / `msg` / 其他)
|
||||||
|
- Git commit 消息的具体格式
|
||||||
|
- 脚本语言选择(bash / PowerShell / 混合)
|
||||||
|
- 甘特图 CLI 的 command/subcommand 细节(从 gant-cli skill 获取)
|
||||||
|
|
||||||
|
## Constraints
|
||||||
|
- **触发机制:** Windows Task Scheduler(非 Claude session 依赖)
|
||||||
|
- **甘特图 CLI:** `gantt-app.exe`
|
||||||
|
- **脚本位置:** 与 gantt-app.exe 同目录
|
||||||
|
- **Git 冲突:** abort(保留本地)
|
||||||
|
- **Push 失败:** Windows 右下角 toast 通知
|
||||||
|
- **甘特图未运行:** 静默跳过,次日重试
|
||||||
|
- **日志:** 不需要
|
||||||
|
- **重名任务:** 更新而非跳过
|
||||||
|
- **持久化:** 无 Claude session 依赖(系统级调度)
|
||||||
|
|
||||||
|
## Testable Acceptance Criteria
|
||||||
|
- [ ] 晚上 22:30,打开甘特图能看到所有 InBox/*.md 对应的 "待看:{文件名}" 任务
|
||||||
|
- [ ] 在 InBox 中新增一个 .md 文件 → 下次执行后甘特图出现对应任务
|
||||||
|
- [ ] 在 InBox 中删除一个 .md 文件 → 下次执行后甘特图移除对应任务
|
||||||
|
- [ ] 非 .md 文件被忽略
|
||||||
|
- [ ] PARA/ 和 InBox/ 外文件不受 git 影响
|
||||||
|
- [ ] Git 冲突时 abort 不丢数据
|
||||||
|
- [ ] 甘特图未运行时脚本不崩溃
|
||||||
|
|
||||||
|
## Assumptions Exposed + Resolved
|
||||||
|
1. **gantt-app.exe CLI 能力:** 假设支持 add/delete/list 操作 → 实现时通过 gant-cli skill 确认
|
||||||
|
2. **Session-only vs durable:** 初始误解为 Claude session 调度 → 澄清为系统级 Windows Task Scheduler
|
||||||
|
3. **文件处理后:** 最初未明确 → 澄清为保留文件、双向同步
|
||||||
|
|
||||||
|
## Pressure-Pass Findings
|
||||||
|
- Round 2 追问了具体格式("到底长什么样")→ 从模糊的"处理"收缩到 `待看:{标题}`
|
||||||
|
- Round 8 追问了 session-only 假设 → 推翻了 CronCreate 方案,转向系统级 Task Scheduler
|
||||||
|
- Round 11 追问了明确的 non-goals → 三条边界锁定
|
||||||
|
|
||||||
|
## Handoff Contract
|
||||||
|
This spec is the requirements source of truth. Downstream execution must preserve:
|
||||||
|
- Intent, non-goals, decision boundaries, and acceptance criteria
|
||||||
|
- The bidirectional mirror model (InBox ↔ Gantt)
|
||||||
|
- System-level scheduling (not Claude session-dependent)
|
||||||
51
InBox/TMP字体Atlas内存优化实战.md
Normal file
51
InBox/TMP字体Atlas内存优化实战.md
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
---
|
||||||
|
title: TMP字体Atlas内存优化实战
|
||||||
|
source: https://mp.weixin.qq.com/s/iPSxQvg-riGh66efHlSyLA
|
||||||
|
author: 侑虎科技
|
||||||
|
date: 2026-05-06
|
||||||
|
tags: [Unity, TMP, 内存优化, Atlas, UWA]
|
||||||
|
---
|
||||||
|
|
||||||
|
# 【厚积薄发】从64MB降至5MB,TMP字体Atlas内存优化实战
|
||||||
|
|
||||||
|
> 来源:UWA公众号 - 第474篇UWA技术知识分享
|
||||||
|
|
||||||
|
## 实战案例一:字体Atlas双实例冗余 + RW动态图集内存过高
|
||||||
|
|
||||||
|
**问题:** GOT Online报告显示,项目游戏字体Atlas出现双实例冗余且开启RW动态图集内存占用过高。
|
||||||
|
|
||||||
|
**原因:**
|
||||||
|
- 字体Atlas实例数量为2,通常是因为该字体既在初始包中的初始场景中被引用,又在后续AssetBundle资源中重复引用
|
||||||
|
- RW(Read/Write Enabled)开启导致CPU和GPU各存一份,内存翻倍
|
||||||
|
|
||||||
|
**解决方案:**
|
||||||
|
1. 将初始场景中使用的字符单独创建对应的小字体,避免初始场景中有大图集和大字体的引用
|
||||||
|
2. 预先收集游戏的大部分字符集,将Atlas设置为**静态图集配置**,可减少16MB占用
|
||||||
|
3. 不在静态图集中的字符,通过TMP的**Fallback机制**,设定一个小分辨率(如512×512)的动态Atlas进行字符补充
|
||||||
|
|
||||||
|
## 实战案例二:TMPAsset内嵌Atlas纹理无法压缩
|
||||||
|
|
||||||
|
**问题:** TMPAsset内嵌Atlas纹理属于子资源,无法单独进行纹理压缩参数配置。
|
||||||
|
|
||||||
|
**解决方案(Editor脚本改造):**
|
||||||
|
1. 通过Editor编辑器脚本对该纹理进行独立复制
|
||||||
|
2. 将TMPAsset材质球关联替换为复制后的新纹理
|
||||||
|
3. 移除原TMPAsset内的内嵌纹理
|
||||||
|
4. 剥离后的独立纹理可自由配置压缩格式(ASTC6×6、ASTC8×8等),进一步降低内存开销
|
||||||
|
5. 真机测试:压缩后文字美术表现无明显差异
|
||||||
|
|
||||||
|
## 优化前后对比
|
||||||
|
|
||||||
|
| 项目 | 内存 |
|
||||||
|
|------|------|
|
||||||
|
| 优化前 | **64MB** |
|
||||||
|
| 优化后合计 | **4.75MB** |
|
||||||
|
| 初始场景 512×512 静态图集 | 0.25MB |
|
||||||
|
| 4096×4096 静态图集(ASTC8×8) | 4MB |
|
||||||
|
| Fallback兜底纹理 512×512(Alpha8) | 0.5MB |
|
||||||
|
|
||||||
|
## 相关资源
|
||||||
|
- UWA社区:community.uwa4d.com
|
||||||
|
- UWA官网:www.uwa4d.com
|
||||||
|
- UWA学堂:edu.uwa4d.com
|
||||||
|
- QQ群:793972859
|
||||||
80
InBox/基于Harness-SDD-多仓管理的AI全栈开发实践.md
Normal file
80
InBox/基于Harness-SDD-多仓管理的AI全栈开发实践.md
Normal file
@@ -0,0 +1,80 @@
|
|||||||
|
---
|
||||||
|
title: 基于 Harness + SDD + 多仓管理模式的 AI 全栈开发实践
|
||||||
|
source: https://mp.weixin.qq.com/s/ygQGSH5c7GHYDvkqWoQTXQ
|
||||||
|
author: 盖伦 / 得物技术
|
||||||
|
date: 2026-05-06
|
||||||
|
tags: [AI开发, 全栈, SDD, Harness, Cursor, Claude Code]
|
||||||
|
---
|
||||||
|
|
||||||
|
# 基于 Harness + SDD + 多仓管理模式的 AI 全栈开发实践|得物技术
|
||||||
|
|
||||||
|
## 一、核心理念:Harness 思维 — 让 AI 模仿,而不是凭空创造
|
||||||
|
|
||||||
|
### 全栈AI开发最容易踩的坑
|
||||||
|
让AI从零开始写代码产生"外星代码":风格不一致、复用率低、采纳率低。AI生成了代码,但Review成本和返工成本反而更高了。
|
||||||
|
|
||||||
|
### Harness 思维的核心:给 AI 一个"模仿对象"
|
||||||
|
给AI一个已有的实现作为参照,让它照着复刻一份,而不是凭空创造。
|
||||||
|
|
||||||
|
**四条原则:**
|
||||||
|
|
||||||
|
| 原则 | 说明 | 举例 |
|
||||||
|
|------|------|------|
|
||||||
|
| 找相似实现 | 在代码库中找到功能最相似的已有实现作为参照 | "结束语"参照"场景化欢迎语" |
|
||||||
|
| 复用优先 | 能复用的组件、接口封装、数据结构直接复用 | 复用greetingExtendInfo数据结构 |
|
||||||
|
| 模仿着复制 | "抄一份改一改"比用新方式好 | Controller/Service/Repository按已有模仿 |
|
||||||
|
| 约束生成范围 | 提示词中明确指定参考文件/参考接口 | 前端修改入口@FeatureTable/index.tsx:53-58 |
|
||||||
|
|
||||||
|
### 提示词体现 Harness
|
||||||
|
- ❌ 不推荐:`请实现一个结束语管理的 CRUD 接口`
|
||||||
|
- ✅ 推荐:明确指定参考文件、数据结构和接口路径,如"参照场景欢迎语功能(后端/api/v1/feature/list,前端FeatureTable/index.tsx:53-58)实现"
|
||||||
|
|
||||||
|
## 二、全栈工作区搭建与 Codebase Indexing
|
||||||
|
|
||||||
|
将前后端代码放在同一个工作区下的三个核心价值:
|
||||||
|
1. **Codebase Indexing**:Cursor对工作区内所有代码进行向量化嵌入建立语义索引,AI能跨仓库理解代码关系
|
||||||
|
2. **上下文完整**:AI同时能看到前后端代码,接口字段、命名风格自然对齐
|
||||||
|
3. **SDD文档集中管理**:前后端SDD文档在同一工作区,便于接口契约对齐
|
||||||
|
|
||||||
|
### Cursor vs Claude Code 实测对比
|
||||||
|
|
||||||
|
| 功能维度 | Cursor | Claude Code |
|
||||||
|
|---------|--------|-------------|
|
||||||
|
| 代码库语义索引 | 支持grep+语义检索,速度快 | 仅支持grep,依赖模型能力 |
|
||||||
|
| 代码生成速度 | 极速,平均1-3分钟 | 中速,平均3-30分钟 |
|
||||||
|
| 代码采纳率 | 两者相当 | 两者相当 |
|
||||||
|
| 文件/代码段引用 | 快捷键、拖拽即可引用 | 需手动@文件路径,无法引用代码段 |
|
||||||
|
| 多Agent | 默认开启(多Tab并行) | 需手动注册子Agent |
|
||||||
|
| 费率模型 | 失败任务不收费 | 失败任务耗时长,容易浪费Token |
|
||||||
|
| 历史会话恢复 | 仅能查看当前项目会话记录 | 可查看全局会话记录 |
|
||||||
|
| 综合评价 | 快速迭代首选,推荐Composer2模式 | 长链路复杂任务可用 |
|
||||||
|
|
||||||
|
## 三、SDD 驱动的全栈代码生成流程
|
||||||
|
|
||||||
|
- 全栈SDD需同时覆盖前后端
|
||||||
|
- 提示词编写范式:明确需求、参考实现、数据结构、接口契约
|
||||||
|
- 前后端需求点清单分工示例
|
||||||
|
- SDD文档产出与指令使用说明
|
||||||
|
|
||||||
|
## 四、多 Agent 协作:前后端并行开发
|
||||||
|
|
||||||
|
- Cursor中使用多Tab并行(默认开启)
|
||||||
|
- Claude Code中使用Subagent能力(需手动注册)
|
||||||
|
- 建议:前端Agent专注UI/交互,后端Agent专注API/数据
|
||||||
|
|
||||||
|
## 五、前后端联调:Mock 数据与分阶段验证
|
||||||
|
|
||||||
|
- 三阶段验证策略
|
||||||
|
- Mock数据编写要点
|
||||||
|
- 后端独立构建验证
|
||||||
|
- 前后端联调步骤
|
||||||
|
|
||||||
|
## 六、警惕 SDD 陷阱:测试如何介入全栈研发
|
||||||
|
|
||||||
|
- SDD不等于需求文档
|
||||||
|
- 关注隐性功能(异常处理、边界情况、性能要求)
|
||||||
|
- 测试应尽早介入
|
||||||
|
|
||||||
|
## 七、综合效益与总结
|
||||||
|
|
||||||
|
核心公式:**Harness(约束) + SDD(规格) + 多仓(上下文) = 高质量AI全栈代码**
|
||||||
Reference in New Issue
Block a user