Skip to content

feat: integrate plannotator as human-in-the-loop review layer#1164

Open
Dfg805 wants to merge 1 commit into
XiaomiMiMo:mainfrom
Dfg805:feat/plannotator-integration
Open

feat: integrate plannotator as human-in-the-loop review layer#1164
Dfg805 wants to merge 1 commit into
XiaomiMiMo:mainfrom
Dfg805:feat/plannotator-integration

Conversation

@Dfg805

@Dfg805 Dfg805 commented Jun 21, 2026

Copy link
Copy Markdown

Issue for this PR

Closes #

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Please provide a description of the issue, the changes you made to fix it, and why they work. It is expected that you understand why your changes work and if you do not understand why at least say as much so a maintainer knows how much to value the PR.

If you paste a large clearly AI generated description here your PR may be IGNORED or CLOSED!

How did you verify your code works?

Screenshots / recordings

If this is a UI change, please include a screenshot or recording.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

If you do not follow this template your PR will be automatically rejected.

Copilot AI review requested due to automatic review settings June 21, 2026 02:33

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces a new Plannotator integration module under packages/opencode/src/integrations/plannotator/ to support a human-in-the-loop review step for both plans and implementation diffs, with accompanying documentation/architecture notes.

Changes:

  • Added a Plannotator “review client” that spawns the plannotator CLI and exchanges JSON over stdio.
  • Added hooks/workflow wrappers to insert plan/code review steps and persist review artifacts to a local dataset directory.
  • Added docs describing the integration and its architecture.

Reviewed changes

Copilot reviewed 9 out of 10 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
packages/opencode/src/integrations/plannotator/skill.ts High-level workflow wrapper around Plannotator hooks.
packages/opencode/src/integrations/plannotator/review_client.ts CLI bridge that spawns Plannotator and parses its JSON output.
packages/opencode/src/integrations/plannotator/hooks.ts “Before execution / after implementation” hooks and dataset persistence.
packages/opencode/src/integrations/plannotator/importer.ts Parses Plannotator output into a normalized feedback shape.
packages/opencode/src/integrations/plannotator/exporter.ts Formats MiMo plan content into Plannotator-friendly Markdown.
packages/opencode/src/integrations/plannotator/README.md Integration README describing components/workflow.
docs/plannotator_integration_guide.md User guide for enabling/using the integration.
docs/integration_architecture.d2 Architecture diagram for the integration flow.
docs/architecture_report.md Longer-form architecture writeup for the integration.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +7 to +12
import { AppFileSystem } from "../../file"

export interface ReviewClient {
submitPlan(plan: string): Effect.Effect<any, Error>
submitDiff(diff: string, description: string): Effect.Effect<any, Error>
}
const spawner = yield* ChildProcessSpawner.ChildProcessSpawner
const fsys = yield* AppFileSystem.Service

const runPlannotator = (mode: string, input: any) =>
Comment on lines +66 to +70
try {
return JSON.parse(stdout)
} catch (e) {
return yield* Effect.fail(new Error(`Failed to parse Plannotator output: ${stdout}`))
}
Comment on lines +4 to +6
import { importFeedback, PlannotatorFeedback } from "./importer"
import { AppFileSystem } from "../../file"
import path from "path"
const saveToDataset = (data: any) => Effect.gen(function* () {
const datasetDir = "datasets/plannotator_feedback"
yield* fsys.mkdir(datasetDir, { recursive: true })
const filename = `${Date.now()}.json`
Comment on lines +1 to +16
import { Instance } from "../../project/instance"
import path from "path"

/**
* Chuyển đổi kế hoạch của MiMo-Code sang định dạng Markdown tương thích với Plannotator.
*/
export function exportPlan(planContent: string, taskTitle: string): string {
const header = `# Task\n\n${taskTitle}\n\n# Plan\n\n`

// Kiểm tra nếu kế hoạch đã có tiêu đề hoặc định dạng Markdown phù hợp
if (planContent.trim().startsWith("#")) {
return `${header}${planContent}`
}

return `${header}${planContent}`
}
Comment on lines +1 to +11
import { Effect } from "effect"
import { PlannotatorHooks } from "./hooks"
import { Question } from "../../question"

/**
* Tích hợp Plannotator vào quy trình compose của MiMo-Code.
*/
export const PlannotatorWorkflow = Effect.gen(function* () {
const hooks = yield* PlannotatorHooks
const question = yield* Question.Service

import { PlannotatorWorkflow } from "../../integrations/plannotator/skill"

// Trong logic lập kế hoạch
const result = yield* PlannotatorWorkflow.reviewPlan(planContent, taskTitle)
approval_status: "approved" | "rejected" | "dismissed"
}

export function importFeedback(plannotatorOutput: any): PlannotatorFeedback {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants