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
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,18 @@ Codex is officially maintained; other Agent and Python framework integrations ar

**Apps & teams** — [Python / HTTP / MCP](https://powercontext.oceanbase.io/en/docs/develop/interfaces/) · [Memory & Handoff](https://powercontext.oceanbase.io/en/docs/workflows/memory-and-handoff/) · [Deployment & access](https://powercontext.oceanbase.io/en/docs/workflows/scopes-and-access/)

## Maintainer agent

`pc-mate` is an always-on maintainer agent for Feishu conversations and GitHub
issues. A supervisor receives and deduplicates messages, waits for a burst to
go quiet, runs the project's own four-way intent analysis (`question`,
`bug_report`, `feature_request`, `other`), and hands accepted work to an agent
that runs inside its own Git worktree. Evidence and lessons are read and
written through PowerContext, and every GitHub write still needs a
maintainer's approval.

[pc-mate: architecture, settings and test playbook →](pc-mate/README.md)

## News

- **2026-12-01 · [v1.6.1](https://powercontext.oceanbase.io/en/changelog/v1.6.1/)** — Improve Atomic Memory processing, improve Gateway conversation and integration reliability, and make processing status clearer.
Expand Down
10 changes: 10 additions & 0 deletions README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,16 @@ Codex 为官方维护;其余 Agent 和 Python 框架集成为社区维护;Bu

**应用与团队** — [Python / HTTP / MCP](https://powercontext.oceanbase.io/zh/docs/develop/interfaces/) · [记忆与任务交接](https://powercontext.oceanbase.io/zh/docs/workflows/memory-and-handoff/) · [部署与访问控制](https://powercontext.oceanbase.io/zh/docs/workflows/scopes-and-access/)

## 维护者 Agent

`pc-mate` 是面向飞书会话和 GitHub Issue 的常驻维护者 Agent。supervisor
负责接收并去重消息、等待一轮对话安静下来、执行项目自己的四类意图判断
(`question`、`bug_report`、`feature_request`、`other`),再把获准的工作交给
运行在独立 Git worktree 里的 agent。证据与经验都通过 PowerContext 读写,
所有 GitHub 写入仍需维护者确认。

[pc-mate:架构、配置与测试手册 →](pc-mate/README.md)

## 最新动态

- **2026-12-01 · [v1.6.1](https://powercontext.oceanbase.io/zh/changelog/v1.6.1/)** — 改进 Atomic Memory 处理,完善 Gateway 对话与集成可靠性,并提供更清晰的处理状态。
Expand Down
11 changes: 11 additions & 0 deletions README_JP.md
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,17 @@ Codex 連携は公式メンテナンス、その他の Agent と Python フレ

**アプリケーションとチーム** — [Python / HTTP / MCP](https://powercontext.oceanbase.io/en/docs/develop/interfaces/) · [Memory と Handoff](https://powercontext.oceanbase.io/en/docs/workflows/memory-and-handoff/) · [デプロイとアクセス制御](https://powercontext.oceanbase.io/en/docs/workflows/scopes-and-access/)

## メンテナー Agent

`pc-mate` は Feishu の会話と GitHub Issue を扱う常駐メンテナー Agent です。
supervisor がメッセージの受信と重複排除、会話が静まるまでの待機、プロジェクト
独自の四分類(`question`、`bug_report`、`feature_request`、`other`)の意図判定を
行い、承認された作業を独立した Git worktree 内で動く agent に渡します。根拠と
経験は PowerContext を通じて読み書きし、GitHub への書き込みはすべて
メンテナーの確認を必要とします。

[pc-mate:アーキテクチャ、設定、テスト手順 →](pc-mate/README.md)

## 最新情報

- **2026-12-01 · [v1.6.1](https://powercontext.oceanbase.io/en/changelog/v1.6.1/)** — Atomic Memory の処理を改善し、Gateway と連携の信頼性、処理状況の可視化を改善。
Expand Down
432 changes: 396 additions & 36 deletions pc-mate/README.md

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion pc-mate/docs/rfc-conformance.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,10 @@ says so. Platform behavior that was not exercised is labeled unverified rather t
| The outcome file is checked, not trusted | `run_result::read` refuses a file that is not a JSON object or does not match the schema; a run that wrote no file falls back to its own words | `an_outcome_names_what_was_done_and_how_it_was_checked`, `a_file_that_is_not_an_outcome_is_refused`, `a_run_that_wrote_nothing_falls_back_to_its_own_words` |
| An accepted request is acknowledged where it was asked | `Supervisor::outcome_of` returns the acknowledgement with the acceptance, and the pipeline addresses it to the conversation the request came from | `the_acknowledgement_of_an_accepted_request_goes_to_the_conversation_it_came_from` |
| An assessment that could not run answers nobody | a failed assessment becomes `Unavailable` and is logged; it is not turned into a reply | `a_failed_assessment_answers_nobody` |
| A category the installation does not act on has no side effect | the assessment stops at `Ignore` for a category outside `triage.categories`, and nothing is queued | `a_category_outside_the_configured_set_has_no_side_effects` |
| A category the installation does not act on has no side effect | the assessment stops at `Ignore` for a category outside `triage.intents`, and nothing is queued | `a_category_outside_the_configured_set_has_no_side_effects` |
| The intent vocabulary is configuration | `triage.intents` names the categories the prompt offers, and a name this build cannot act on is answered like `other` | `an_intent_the_build_does_not_know_is_answered_like_other`, `a_configured_intent_the_build_does_not_handle_still_names_itself`, `the_prompt_offers_the_configured_intents` |
| A finished implementation opens a pull request and asks the reviewer | `github.pullRequest.enabled` with a named submitter opens the pull request for the branch that was pushed and asks the reviewer, who has to be another account than the submitter | `a_finished_implementation_opens_a_pull_request_and_asks_the_reviewer`, `the_pull_request_settings_have_to_name_accounts_that_can_act` |
| A review that asks for changes runs the implementation again | the findings of a `changes_requested` review go into the next implementation prompt, until the round budget is spent | `a_review_that_asks_for_changes_runs_the_implementation_again`, `the_prompt_carries_the_findings_of_the_review`, `an_approved_review_answers_the_requester` |
| A flattened group event still requires an explicit address | `parse_event` accepts a group message only when a structured mention matches the bot id/app id, or when the transport sent no structured mention at all, `feishu.botName` is set, and the rendered text holds an exact `@<botName>` mention; a name that continues into another word (`@ClawBotHelper`) is not a mention, and a structured mention of another user wins over the display name, so RFC 2919 L92 full group ingestion stays excluded | `flattened_group_event_with_display_name_only_is_accepted`, `a_display_name_that_continues_into_another_word_is_not_a_mention`, `a_structured_mention_of_another_user_is_not_a_mention_of_the_bot`, `a_group_mention_without_a_bot_identity_is_ignored` |
| A typed command is read from the message, not the assembled context | `InboundEvent::message` keeps the latest GitHub comment or the Feishu message; `InboundEvent::command_text` strips a leading bot mention; `App::handle_command` parses only that | `a_command_is_read_from_the_message_not_the_assembled_context`, `a_mention_is_stripped_before_a_strict_command_match` |
| `observe` refuses commands as well as triage | `App::handle_command` logs and returns before `confirm`/`approve`, so a resolution or an approval changes nothing | `observe_mode_declines_a_typed_approval` |
Expand Down
50 changes: 48 additions & 2 deletions pc-mate/settings.example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ github:
enabled: true
repository: owner/name
pollSeconds: 60
# Whose reports are taken in. An empty list takes every issue in; a non-empty
# one drops everything that comes from outside it. Whoever is on the list
# also has an explicit request, and an explicit request is accepted in every
# triage mode. See the note under `feishu.allowed` for the whole rule.
allowed: []
ignoreLabels: [wontfix, duplicate, invalid]
baselineOnFirstRun: true
Expand All @@ -80,6 +84,24 @@ github:
botLogin: ""
writeMode: off # off | approved
maintainers: [] # GitHub logins allowed to resolve a case
# The pull request a finished implementation opens, and the review loop around it. The
# switch and the submitter account are the authorization: the pull request is not a pending
# action that waits for a maintainer.
pullRequest:
enabled: false
# The GitHub login expected to open the pull request. It must differ from the reviewer.
submitter: ""
# Optional name of an environment variable holding the submitter's GitHub API token.
# Leave empty to use the GitHub App installation token and set submitter to botLogin.
# The API credential needs pull_requests: write on the target repository.
submitterTokenEnv: ""
# The account that is asked to review the pull request. Empty opens the pull request without
# asking anyone.
reviewer: ""
# How many times the implementation may run again for the findings of one review.
maxReviewRounds: 3
# How long until the review of a pull request is looked at again, in seconds.
reviewPollSeconds: 300

feishu:
enabled: false
Expand All @@ -92,7 +114,18 @@ feishu:
appId: ""
botName: "" # bot display name; used only when the event source drops `mentions`,
# and only for an exact `@<botName>` mention
# Whose messages are taken in, and whose request is an explicit one. A
# message from someone outside this list is dropped before it is read. An
# empty list takes every message in, but then every request is only inferred,
# and an inferred request is accepted in `triage.mode: auto` alone: in
# `response` mode it is read, answered in the conversation, and no branch is
# created for it. A request that named the bot is carried out in every mode
# but `observe`. A reply mode that serves a group therefore needs the people
# it serves listed here.
allowed: []
# Who may resolve a case or approve a public write. This is a different
# question from `allowed`: a maintainer may approve a write they did not ask
# for, while their own message stays inferred unless they are also allowed.
maintainers: [] # Feishu open_id values allowed to resolve or approve
# M2 uses this private chat for approval requests. It carries the exact write text and the
# approval token, so it must not be a public community group. Commands in this chat are accepted
Expand All @@ -119,7 +152,19 @@ triage:
# queued actions). Typed confirmations and approvals still work, because they are commands.
enabled: true
mode: observe # observe | response | auto
categories: [bug_report, feature_request, question]
# The intents the classifier may answer with. The vocabulary is configuration: an operator adds
# an intent here and the prompt offers it, without a code change. An intent this build cannot
# act on yet is answered like `other`, so a new entry is safe to add before the code that
# handles it exists. `other` is required: it is the answer for noise.
intents:
- name: bug_report
description: broken behavior, crash, regression, wrong output, error log, or an unexpected edge case in this project
- name: feature_request
description: a new capability, enhancement, configuration option, integration, or ergonomics improvement
- name: question
description: a general usage, setup, configuration, or documentation question that should be answered from the repository and official materials
- name: other
description: chatter, praise, off-topic remarks, spam, or noise
# Kept so an existing configuration file still loads. The supervisor no longer queues a
# label, so this switch has no effect.
autoLabel: false
Expand All @@ -142,7 +187,8 @@ proposal:

# The code-execution stage. An accepted bug/feature runs the agent with write access inside its own
# Git worktree under `stateDir/work/<case>`; the shared checkout stays read-only. The controller
# commits the result. Only `triage.mode: auto` reaches this stage.
# commits the result. This stage is reached by a request that named the agent, and by an inferred
# request in `triage.mode: auto`.
operator:
enabled: true
branchPrefix: pc-mate/
Expand Down
17 changes: 12 additions & 5 deletions pc-mate/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -237,10 +237,14 @@ impl App {
/// starts the re-checks that are due, and sends the responses that were queued.
async fn supervisor_tick(&mut self) -> Result<()> {
let summary = self.supervisor.tick().await?;
if summary.assessed > 0 || summary.ran > 0 || summary.followed_up > 0 {
if summary.assessed > 0
|| summary.ran > 0
|| summary.followed_up > 0
|| summary.reviewed > 0
{
self.state.append_main_log(&format!(
"supervisor: assessed={} ran={} followed_up={}",
summary.assessed, summary.ran, summary.followed_up
"supervisor: assessed={} ran={} followed_up={} reviewed={}",
summary.assessed, summary.ran, summary.followed_up, summary.reviewed
))?;
}
self.deliver_pending().await?;
Expand Down Expand Up @@ -1464,7 +1468,10 @@ mod tests {
settings.github.enabled = true;
settings.github.allowed = vec!["bob".to_string()];
settings.triage.mode = IntentMode::Response;
settings.triage.categories = vec![crate::domain::IntentCategory::Question];
settings
.triage
.intents
.retain(|intent| matches!(intent.name.as_str(), "question" | "other"));
// Approved writes make an unfiltered reply queue a real action, so this test fails if the
// category policy is not applied before the reply path.
settings.github.write_mode = crate::config::GithubWriteMode::Approved;
Expand Down Expand Up @@ -1496,7 +1503,7 @@ mod tests {
assert!(processed, "the message is taken in");
app.supervisor_tick().await.unwrap();

assert_eq!(calls.load(Ordering::SeqCst), 1, "the four-way analysis ran");
assert_eq!(calls.load(Ordering::SeqCst), 1, "the intent analysis ran");
assert!(
app.supervisor.pending_replies().is_empty(),
"a category this installation does not act on is not answered"
Expand Down
34 changes: 23 additions & 11 deletions pc-mate/src/case.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,26 @@ use crate::util::strip_leading_mention;

/// The identity of the conversation a case follows.
///
/// Keyed by the thread, not by the message: consecutive messages about the same problem must land on
/// the same case, or a reporter's confirmation would open a second one instead of resolving the first.
/// Keyed by the conversation, not by the message: consecutive messages about the same problem must
/// land on the same case, or a reporter's confirmation would open a second one instead of
/// resolving the first.
pub fn case_key(channel: &Channel) -> String {
match channel.source {
Source::Github => format!(
"github:{}#{}",
channel.repository.as_deref().unwrap_or("unknown"),
channel.number.unwrap_or_default()
),
// A group chat holds unrelated problems, so the thread root — not the chat — identifies the
// case. A direct message has no thread, and there the chat is the conversation.
// A group chat holds unrelated problems, so the person talking in it — not the chat —
// identifies the case. A direct message has no other party, and there the chat is the
// conversation.
Source::Feishu => {
let conversation = channel.chat_id.as_deref().unwrap_or("unknown");
// The source says who the conversation is; a thread root only says where a reply was
// written.
if let Some(id) = channel.conversation_id.as_deref() {
return format!("feishu:{id}");
}
let thread = channel
.thread_id
.as_deref()
Expand Down Expand Up @@ -666,17 +673,22 @@ mod tests {
}

#[test]
fn a_case_is_keyed_by_the_thread_nothing_else() {
// Two messages in one group thread must resolve to one case, or a reporter's confirmation
// would open a second case instead of resolving the first.
let group = Channel::feishu("oc_1", "om_7", false);
assert_eq!(case_key(&group), "feishu:oc_1#om_7");
// A reply has its own message id, but the thread root still identifies the case.
fn a_case_is_keyed_by_the_conversation_nothing_else() {
// Two messages of one person must resolve to one case, or a reporter's confirmation would
// open a second case instead of resolving the first.
let group = Channel {
conversation_id: Some("oc_1#alice".to_string()),
..Channel::feishu("oc_1", "om_7", false)
};
assert_eq!(case_key(&group), "feishu:oc_1#alice");
// A reply has its own message id, but the conversation of the person still identifies the
// case.
let reply = Channel {
conversation_id: Some("oc_1#alice".to_string()),
thread_id: Some("om_7".to_string()),
..Channel::feishu("oc_1", "om_9", false)
};
assert_eq!(case_key(&reply), "feishu:oc_1#om_7");
assert_eq!(case_key(&reply), "feishu:oc_1#alice");
// A direct message has no thread, so the chat is the conversation.
let direct = Channel::feishu("oc_2", "om_8", true);
assert_eq!(case_key(&direct), "feishu:oc_2");
Expand Down
Loading