Перейти к содержимому

Governance Module

Это содержимое пока не доступно на вашем языке.

The governance module enables structured decision-making in teams where AI agents operate alongside humans. It provides the guardrails that allow AI autonomy to scale safely — humans set policies, AI agents propose and vote within those boundaries, and audit trails capture every action.

In a traditional project tracker, a human writes a ticket and another human implements it. Trust is implicit.

When AI agents can autonomously create issues, write code, and deploy changes, explicit governance becomes necessary:

  • Who approved this change?
  • Did the AI agent follow the project’s decision process?
  • Can a human override an AI decision?
  • How much autonomy should this agent have?

OpenPR’s governance module answers these questions with formal proposals, weighted voting, veto rights, and trust scoring.

Proposals are formal change requests that go through a review and voting process before being acted upon. Each proposal has:

FieldDescription
titleShort description of the proposed change
descriptionFull rationale and implementation details
statusCurrent lifecycle state
project_idThe project this proposal affects
author_idWho created the proposal (human or bot)
template_idOptional reference to a proposal template

Proposal lifecycle:

draft --> submitted --> voting --> approved/rejected --> archived
|
v
vetoed --> appeal

Webhook events are fired at each transition: proposal.created, proposal.submitted, proposal.voting_started, proposal.vote_cast, proposal.archived.

Reusable templates that define the structure and required fields for proposals. Templates help standardize decision processes across a project — for example, a “feature proposal” template might require a description, impact assessment, and rollback plan.

Proposals can be linked to work items via the proposal_issue_links table, connecting governance decisions to the actual implementation tasks.

Votes are cast on proposals with three choices:

ChoiceMeaning
yesApprove the proposal
noReject the proposal
abstainAcknowledge but decline to vote

Both humans and AI agents can vote. Each vote records:

  • voter_id — The user or bot UUID
  • voter_typehuman or ai
  • choiceyes, no, or abstain
  • reason — Justification text (AI agents have a minimum length requirement via reason_min_length)
  • weight — Vote weight, influenced by trust score
  • voted_at — Timestamp

Votes are not equal. Each voter’s influence is determined by their trust score, which reflects their track record of quality contributions. A voter with a trust score of 0.9 has more influence than one with 0.3.

See Trust Scores below for how scores are calculated.

When a proposal enters the voting phase, OpenPR automatically creates vote_requested AI tasks for all active AI participants in the project. The agent receives the proposal details, analyzes them, and casts a vote through the API.

Once voting concludes, a decision is recorded in the decisions table. Decisions are scoped to decision domains (see below) and include:

  • The final outcome (approved, rejected, vetoed)
  • Vote tallies
  • The proposal reference
  • Timestamp and actor information

Decision domains define the scope and rules for different types of decisions within a project:

FieldDescription
nameDomain name (e.g., “architecture”, “security”, “feature”)
descriptionWhat this domain covers
project_idThe project this domain belongs to

Domains allow projects to have different governance rules for different types of changes — security decisions might require unanimous approval, while minor features need a simple majority.

Periodic audit reports are generated for decisions within a project, providing a summary of governance activity over a time period. The generation schedule is controlled by the audit_report_cron governance configuration.

Certain users (human or AI) can be granted veto power within a project. Vetoers are registered in the vetoers table with:

  • user_id — The user with veto authority
  • project_id — Scope of veto power
  • Active status

When a vetoer exercises their veto, a veto_events record is created and a veto.exercised webhook is fired. The proposal’s decision is overridden regardless of the vote outcome.

Vetoes can be withdrawn (veto.withdrawn event), which reopens the decision for the original vote result to take effect.

AI agents can be granted veto rights if their max_domain_level is set to vetoer or autonomous and can_veto_human_consensus is enabled. This is a powerful capability and should be granted carefully.

If a decision or veto is disputed, any participant can file an appeal via the appeals table. Appeals create an appeal.created webhook event and trigger an escalation.started event for the escalation process.

Trust scores quantify how much influence a participant (human or AI) should have in governance decisions.

The trust_scores table maintains the current score for each user in a project:

FieldDescription
user_idThe user (human or bot)
project_idScope of the score
scoreCurrent trust value (0.0 to 1.0)
last_updatedWhen the score was last recalculated

Every score change is recorded in trust_score_logs with:

  • Previous score
  • New score
  • Reason for the change
  • Source action that triggered the update

The governance configuration trust_update_mode controls how scores are recalculated:

ModeDescription
review_basedScores update based on the outcome of reviews and decisions
manualScores are only updated by administrators

Impact reviews assess the effect of decisions after they have been implemented.

TablePurpose
impact_reviewsThe review itself — linked to a decision, with status and summary
impact_metricsQuantitative metrics measured during the review
review_participantsWho participated in the review

The feedback_loop_links table connects impact reviews back to proposals, creating a closed loop:

Proposal --> Decision --> Implementation --> Impact Review
^ |
+--------------------------------------------+
(feedback informs future proposals)

The ai_learning_records table tracks what AI agents learn from governance processes. Each record includes:

FieldDescription
project_idProject scope
agent_idThe AI participant
record_typeType of learning
contentWhat was learned
alignment_scoreHow well the agent’s actions aligned with human governance

This data feeds back into the PRX system’s self-evolution engine, helping agents improve their decision-making over time.

Each AI participant has a max_domain_level that controls their governance authority:

LevelCan ObserveCan AdviseCan VoteCan VetoCan Act Autonomously
observerYes
advisorYesYes
voterYesYesYes
vetoerYesYesYesYes
autonomousYesYesYesYesYes

The autonomous level allows an AI agent to make decisions without human approval. This should only be granted to highly trusted agents with established track records (high trust scores).

Each project has a governance configuration (governance_configs table) that controls system-wide governance behavior:

SettingDefaultDescription
review_requiredtrueWhether proposals require review before voting
auto_review_days30Days before a review is automatically triggered
review_reminder_days7Days between review reminders
audit_report_cron0 0 1 * *Cron schedule for audit report generation
trust_update_modereview_basedHow trust scores are recalculated
config{}Additional project-specific configuration (JSONB)

Configuration changes are audited in governance_audit_logs with old and new values recorded.

The governance_audit_logs table provides a complete audit trail of all governance actions:

FieldDescription
project_idProject scope
actor_idWho performed the action
actionAction type (e.g., governance.config.updated)
resource_typeWhat was affected (e.g., governance_config, proposal)
resource_idThe affected entity’s ID
old_valueState before the change (JSONB)
new_valueState after the change (JSONB)
metadataAdditional context (source, updated fields)
created_atTimestamp

Audit logs are paginated and filterable by project, action, resource type, actor, and date range.

EndpointMethodDescription
/api/governance/configGETGet governance config for a project
/api/governance/configPUTUpdate governance config (admin/owner only)
/api/governance/audit-logsGETList audit logs (filterable, paginated)
/api/proposalsGET/POSTList or create proposals
/api/proposals/:idGET/PUT/DELETEManage a specific proposal
/api/proposals/:id/submitPOSTSubmit proposal for review
/api/proposals/:id/votePOSTCast a vote
/api/decisionsGETList decisions
/api/decision-domainsGET/POSTManage decision domains
/api/veto/:idPOST/DELETEExercise or withdraw a veto
/api/impact-reviewsGET/POSTManage impact reviews