Skip to content

feat(hrm): Add optional HRM AI agent management commands#693

Open
mikejmorgan-ai wants to merge 1 commit intomainfrom
feature/hrm-ai-integration
Open

feat(hrm): Add optional HRM AI agent management commands#693
mikejmorgan-ai wants to merge 1 commit intomainfrom
feature/hrm-ai-integration

Conversation

@mikejmorgan-ai
Copy link
Member

@mikejmorgan-ai mikejmorgan-ai commented Feb 1, 2026

Summary

  • Add cx hire command for deploying AI agents to servers
  • Add cx fire command for terminating AI agents gracefully
  • HRM AI is an optional feature gated behind --features hrm flag
  • When compiled without the feature, commands display helpful premium feature information

Changes

File Description
Cargo.toml Added optional hrm-ai, sqlx, tokio, uuid dependencies
cli/hire.rs Agent deployment command with feature gate
cli/fire.rs Agent termination command with feature gate
cli/mod.rs Wired up hire/fire subcommands

Usage

# Build with HRM AI enabled
cargo build --features hrm

# Deploy an agent
cx hire devops --server prod-1 --name "Deploy Bot"

# Terminate an agent
cx fire abc123-def456 --reason "Migrating to new server"

Test plan

  • Build without --features hrm - verify premium message displays
  • Build with --features hrm - verify commands connect to PostgreSQL
  • Test cx hire creates agent records
  • Test cx fire terminates agents with audit logging

License

BSL 1.1 (Business Source License)


🤖 Generated with Claude Code

Summary by CodeRabbit

Release Notes

  • New Features
    • Added hire command to deploy AI agents with configurable types (DevOps, Security, Database, Network, Support) and custom capabilities.
    • Added fire command to terminate AI agents with optional confirmation and audit logging.
    • New optional hrm feature enables AI agent management capabilities (enable via feature flag).

✏️ Tip: You can customize this high-level summary in your review settings.

- Add `cx hire` command for deploying AI agents
- Add `cx fire` command for terminating AI agents
- HRM AI is gated behind `--features hrm` flag (not default)
- Commands show helpful premium feature message when disabled
- Includes PostgreSQL integration for agent fleet management

Usage:
  cargo build --features hrm  # Enable HRM AI
  cx hire devops --server prod-1
  cx fire <agent-id>

License: BSL 1.1

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@mikejmorgan-ai mikejmorgan-ai requested a review from a team as a code owner February 1, 2026 23:44
Copilot AI review requested due to automatic review settings February 1, 2026 23:44
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @mikejmorgan-ai, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a new, optional Human Resource Management (HRM) AI module to the wezterm CLI, enabling users to deploy and terminate AI agents directly from the command line. These new cx hire and cx fire commands provide robust agent lifecycle management, including features like audit logging, graceful shutdowns, and PostgreSQL database integration for fleet management. The functionality is gated behind a hrm feature flag, ensuring that it's only included when explicitly desired, and provides clear guidance to users if they try to access it without enabling the feature.

Highlights

  • New AI Agent Management Commands: Introduced cx hire for deploying AI agents and cx fire for terminating them, expanding the CLI's capabilities for agent orchestration.
  • Optional Feature Gating: The HRM AI agent management functionality is an optional premium feature, activated by compiling with --features hrm. Without this feature, commands display helpful information about enabling it.
  • Dependency Management: Added conditional dependencies in Cargo.toml for hrm-ai (from a git repository), sqlx, tokio, and uuid, which are only included when the hrm feature is enabled.
  • Agent Lifecycle Management: The hire command supports deploying various agent types (Devops, Security, Database, Network, Support) with configurable names and capabilities, while the fire command provides graceful termination with confirmation, audit logging, and a specified reason.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 1, 2026

📝 Walkthrough

Walkthrough

This pull request introduces a new "hrm" feature to Wezterm that enables AI agent management through new CLI commands. It adds four optional dependencies (hrm-ai, sqlx, tokio, uuid), implements hire and fire CLI subcommands for deploying and terminating agents, and integrates these commands into the CLI system.

Changes

Cohort / File(s) Summary
Dependency Management
wezterm/Cargo.toml
Added four optional dependencies (hrm-ai, sqlx, tokio, uuid) and a new "hrm" feature flag that conditionally enables them. Default feature list now explicitly empty.
CLI Command Modules
wezterm/src/cli/fire.rs, wezterm/src/cli/hire.rs
New modules implementing FireCommand (with agent_id, force, reason, timeout, format fields) and HireCommand (with agent_type, server, name, capabilities, interactive fields). Both include async runtime initialization, database interactions via AgentRepository/AgentHiringService/AgentTerminationService, confirmation prompts, and structured output formatting. HireCommand adds AgentType enum with variants for Devops, Security, Database, Network, Support.
CLI Integration
wezterm/src/cli/mod.rs
Exposed hire and fire modules as public exports; added Hire and Fire variants to CliSubCommand enum; integrated both commands into run_cli_async control flow with proper mux client cleanup.

Sequence Diagram(s)

sequenceDiagram
    participant User as User/CLI
    participant Runtime as Tokio Runtime
    participant Env as Environment
    participant Repo as AgentRepository
    participant Service as AgentHiringService
    participant DB as Database

    User->>Runtime: Initialize async runtime
    User->>Env: Read DATABASE_URL
    Env-->>Repo: DATABASE_URL
    User->>Repo: Create with DATABASE_URL
    Repo->>DB: Connect
    User->>Service: Create AgentHiringService
    User->>User: Derive agent name (if not supplied)
    User->>User: Prompt confirmation (if not --yes)
    User->>Service: Deploy agent with config
    Service->>DB: Create agent record
    DB-->>Service: Agent created
    Service-->>User: Success response (ID, name, status)
    User->>User: Print deployment details
Loading
sequenceDiagram
    participant User as User/CLI
    participant Runtime as Tokio Runtime
    participant Env as Environment
    participant Repo as AgentRepository
    participant Service as AgentTerminationService
    participant DB as Database

    User->>Runtime: Initialize async runtime
    User->>Env: Read DATABASE_URL
    Env-->>Repo: DATABASE_URL
    User->>Repo: Create with DATABASE_URL
    Repo->>DB: Connect
    User->>Repo: Fetch agent by ID
    DB-->>Repo: Agent record
    Repo-->>User: Agent found/not found
    User->>User: Prompt confirmation (if not --force)
    User->>Service: Create AgentTerminationService
    User->>Service: Terminate agent with reason
    Service->>DB: Update agent status, record audit
    DB-->>Service: Termination confirmed
    Service-->>User: Success response (audit ID, shutdown duration)
    User->>User: Print termination details
Loading

Estimated Code Review Effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Poem

🐰 Hireling and firing, oh what delight!
New agents deployed with a quantum of might,
Database dancing, async flows soar,
Features gated—premium HRM at the core! 🚀
A workforce of rabbits, by CLI command,
Managing tasks across the digital land! 🌙

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 42.86% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely summarizes the main change: adding optional HRM AI agent management commands, matching the changeset which introduces hire/fire CLI commands gated behind a feature flag.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/hrm-ai-integration

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

Copilot AI left a comment

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 adds optional HRM AI agent management commands (cx hire and cx fire) for deploying and terminating AI agents on servers. The feature is gated behind a --features hrm flag to keep it as an optional premium capability.

Changes:

  • Added agent deployment and termination CLI commands with feature-gated implementation
  • Integrated optional dependencies (hrm-ai, sqlx, tokio, uuid) for HRM functionality
  • Implemented graceful fallback messaging when the feature is not enabled

Reviewed changes

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

File Description
wezterm/Cargo.toml Added optional HRM AI dependencies with feature flag
wezterm/src/cli/mod.rs Registered hire and fire subcommands in CLI router
wezterm/src/cli/hire.rs Implements agent deployment with feature-gated execution
wezterm/src/cli/fire.rs Implements agent termination with confirmation flow


// Get database URL from environment
let db_url = std::env::var("DATABASE_URL")
.unwrap_or_else(|_| "postgres://localhost/cx_agents".to_string());
Copy link

Copilot AI Feb 1, 2026

Choose a reason for hiding this comment

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

The default database URL uses an unencrypted postgres:// connection. For enterprise-grade deployments mentioned in the documentation, this should default to a secure connection (e.g., require SSL) or at minimum include a warning about the security implications of the default.

Suggested change
.unwrap_or_else(|_| "postgres://localhost/cx_agents".to_string());
.unwrap_or_else(|_| {
// Default enforces TLS for safety; production should always set DATABASE_URL explicitly
eprintln!(
"warning: DATABASE_URL not set, using default postgres://localhost/cx_agents?sslmode=require; \
this is intended for development only and must be overridden in production."
);
"postgres://localhost/cx_agents?sslmode=require".to_string()
});

Copilot uses AI. Check for mistakes.
Comment on lines +101 to +102
let db_url = std::env::var("DATABASE_URL")
.unwrap_or_else(|_| "postgres://localhost/cx_agents".to_string());
Copy link

Copilot AI Feb 1, 2026

Choose a reason for hiding this comment

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

The default database URL uses an unencrypted postgres:// connection. For enterprise-grade deployments mentioned in the documentation, this should default to a secure connection (e.g., require SSL) or at minimum include a warning about the security implications of the default.

Suggested change
let db_url = std::env::var("DATABASE_URL")
.unwrap_or_else(|_| "postgres://localhost/cx_agents".to_string());
let db_url = match std::env::var("DATABASE_URL") {
Ok(url) => url,
Err(_) => {
eprintln!(
"WARNING: DATABASE_URL is not set. Falling back to a local default \
postgres:// connection with sslmode=require.\n\
For production and enterprise deployments, explicitly configure a secure DATABASE_URL."
);
"postgres://localhost/cx_agents?sslmode=require".to_string()
}
};

Copilot uses AI. Check for mistakes.
Comment on lines +168 to +170
let agent_name = cmd.name.unwrap_or_else(|| {
format!("{}-{}", cmd.agent_type, &uuid::Uuid::new_v4().to_string()[..8])
});
Copy link

Copilot AI Feb 1, 2026

Choose a reason for hiding this comment

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

The magic number 8 for UUID truncation should be defined as a named constant (e.g., const UUID_SHORT_LENGTH: usize = 8) to make the intent clear and enable consistent usage if this pattern is repeated elsewhere.

Copilot uses AI. Check for mistakes.
wezterm-term.workspace = true

# HRM AI - Optional premium agent management (enable with --features hrm)
hrm-ai = { git = "https://github.com/mikejmorgan-ai/hrm-ai-standalone.git", optional = true }
Copy link

Copilot AI Feb 1, 2026

Choose a reason for hiding this comment

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

The git dependency lacks version pinning (no tag, branch, or rev). This can lead to non-reproducible builds and unexpected breaking changes. Consider pinning to a specific tag or commit hash, e.g., tag = \"v1.0.0\" or rev = \"abc123\".

Copilot uses AI. Check for mistakes.
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces cx hire and cx fire commands for managing optional HRM AI agents, gated behind a --features hrm flag. The implementation is well-structured, using conditional compilation effectively. My main feedback focuses on improving the robustness of database connections by requiring the DATABASE_URL environment variable to be set explicitly, rather than falling back to a hardcoded default. This change will prevent potential issues like connecting to the wrong database or silent failures.

Comment on lines +101 to +102
let db_url = std::env::var("DATABASE_URL")
.unwrap_or_else(|_| "postgres://localhost/cx_agents".to_string());
Copy link
Contributor

Choose a reason for hiding this comment

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

high

Using a hardcoded fallback for DATABASE_URL can lead to unexpected behavior. If the environment variable is not set, the command will silently try to connect to postgres://localhost/cx_agents, which might not exist or might be the wrong database. This could cause confusion or data corruption.

It's more robust to fail explicitly if DATABASE_URL is not set, forcing the user to configure the environment correctly. This can be achieved by using .context() from anyhow to provide a clear error message.

Suggested change
let db_url = std::env::var("DATABASE_URL")
.unwrap_or_else(|_| "postgres://localhost/cx_agents".to_string());
let db_url = std::env::var("DATABASE_URL")
.context("DATABASE_URL environment variable must be set to connect to the agent database")?;

Comment on lines +156 to +157
let db_url = std::env::var("DATABASE_URL")
.unwrap_or_else(|_| "postgres://localhost/cx_agents".to_string());
Copy link
Contributor

Choose a reason for hiding this comment

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

high

Similar to the fire command, using a hardcoded fallback for DATABASE_URL is risky. It's better to require the environment variable to be explicitly set to avoid connecting to an incorrect database or failing silently.

Explicitly erroring out when DATABASE_URL is missing will make the command more robust and easier to debug for users.

Suggested change
let db_url = std::env::var("DATABASE_URL")
.unwrap_or_else(|_| "postgres://localhost/cx_agents".to_string());
let db_url = std::env::var("DATABASE_URL")
.context("DATABASE_URL environment variable must be set to connect to the agent database")?;

@sonarqubecloud
Copy link

sonarqubecloud bot commented Feb 1, 2026

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 9

🤖 Fix all issues with AI agents
In `@wezterm/Cargo.toml`:
- Around line 44-46: The hrm-ai git dependency in Cargo.toml is unpinned and
should be fixed to a specific tag or commit to ensure reproducible builds;
update the hrm-ai entry (the hrm-ai dependency line) to include either a tag
(e.g., tag = "vX.Y.Z") or a commit SHA (rev = "<commit-sha>") alongside the git
URL so Cargo will fetch a fixed revision rather than the moving default branch.

In `@wezterm/src/cli/fire.rs`:
- Around line 97-105: Replace the existing WHAT/HOW comments above
theme.print_header, the DATABASE_URL getenv, and AgentRepository::new with
CX-prefixed intent comments that explain WHY these steps are necessary;
specifically add comments like "// CX Terminal: explain why we print the
termination header (provide user context)" before theme.print_header, "// CX
Terminal: explain why we fall back to default DATABASE_URL (ensure local dev
connectivity)" near the db_url initialization, and "// CX Terminal: explain why
we construct AgentRepository (to fetch agent termination metadata)" before
AgentRepository::new to satisfy the guideline that comments state intent and use
the CX prefix.
- Around line 1-5: Replace the current license header in this new file (fire.rs)
so it attributes the Business Source License 1.1 to AI Venture Holdings LLC:
update the copyright line and ensure the BSL 1.1 notice remains intact and
identical in wording to the project's standard header used across other new
files.
- Around line 7-22: Replace the module-level inner doc comments (the leading //!
lines at the top of wezterm/src/cli/fire.rs) with regular line comments that
explain WHY this module exists (not WHAT or HOW), using the required prefix "//
CX Terminal:"; remove example usage blocks and triple-backticks, keep the note
about the hrm feature but convert it to a CX Terminal comment, and ensure the
comment text follows the project's comment policy (intent-focused WHY and marked
with the CX prefix) so rustfmt/build and policy checks pass.
- Around line 108-113: The code prints an error when
repo.get_agent(&cmd.agent_id).await? returns None but still returns Ok(());
change this to propagate a non-zero failure by returning
Err(anyhow::anyhow!(...)) instead of Ok(()). Replace the None branch that
currently calls theme.print_error(&format!("Agent not found: {}",
cmd.agent_id)); return Ok(()) with a call to theme.print_error(...) followed by
returning Err(anyhow::anyhow!("Agent not found: {}", cmd.agent_id)) so the
function exits with an error when the agent is missing.

In `@wezterm/src/cli/hire.rs`:
- Around line 125-139: The comment "Print header" above the call to
theme.print_header and any other inline comments that only state "what" should
be rewritten to explain the intent (WHY) using the prescribed CX prefix: replace
or remove superficial comments and add a CX Terminal comment like "// CX
Terminal: explain why we're printing the header and deployment summary here
(e.g., to provide the user a clear context before collecting input/output)" near
theme.print_header; similarly, if any surrounding println! blocks need
commentary, either remove them or add a "// CX Terminal: ..." comment explaining
the purpose of printing agent_type/server/name/capabilities (for user
confirmation before deployment) and reference the cmd.agent_type, cmd.server,
cmd.name, and cmd.capabilities variables so the reviewers can locate the logic.
- Around line 1-5: Replace the copyright holder in the file-level license header
comment block at the top of the file (the multi-line /** ... */ header) so it
attributes the Business Source License 1.1 to "AI Venture Holdings LLC" instead
of "CX Linux", preserving the BSL 1.1 wording and formatting.
- Around line 7-19: Replace the module-level inner doc comments (the leading //!
block at the top of hire.rs) with non-doc comments that explain WHY using the
required prefix; remove the //! markers and convert each line to a normal
comment starting with "// CX Terminal:" that describes the rationale for the HRM
hiring command (compliance/audit/guarded flow) rather than usage HOW/WHAT or
examples; ensure no inner doc comments remain so rustfmt/build errors are
resolved and the new comments follow the "explain WHY" guideline.
- Around line 81-83: The --format flag (pub format: String) is accepted in the
Hire CLI struct but not used in run_hire_with_hrm; either remove the format
field or implement conditional output: in run_hire_with_hrm match on self.format
(e.g., "table" | "json") and branch the output path accordingly—keep the
existing table rendering for "table" and, for "json", serialize the same data
structure using Serde (derive Serialize or build a serializable DTO) and print
the JSON; ensure you validate unknown values (return an error) and update any
help/usage text if you remove the flag.
🧹 Nitpick comments (3)
wezterm/src/cli/fire.rs (1)

155-168: Add structured logs/tracing around termination operations.
Consider emitting structured fields (agent_id, audit_id, success) for observability, separate from user-facing output.

As per coding guidelines, Use structured logging with distributed tracing support for monitoring and debugging across all components.

wezterm/src/cli/mod.rs (1)

34-36: Use CX Terminal prefix and intent-focused wording for new HRM comment.
Prefer // CX Terminal: WHY — … over “what”-style comments for new CX additions.

As per coding guidelines, Code comments must explain WHY, never WHAT or HOW, and Rust: Mark CX additions with '// CX Terminal:' comment prefix.

wezterm/src/cli/hire.rs (1)

86-115: Add tests for the new hire/fire flows to keep coverage ≥95%.
Cover feature-off messaging, confirmation logic, and success/error paths.

As per coding guidelines, Maintain 95%+ test coverage across all code.

Comment on lines +44 to +46
# HRM AI - Optional premium agent management (enable with --features hrm)
hrm-ai = { git = "https://github.com/mikejmorgan-ai/hrm-ai-standalone.git", optional = true }
sqlx = { version = "0.7", features = ["runtime-tokio", "postgres"], optional = true }
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

# First, let's examine the Cargo.toml file to see the current state
cat -n wezterm/Cargo.toml | head -60

Repository: cxlinux-ai/cx-core

Length of output: 2220


🏁 Script executed:

# Also check if there are any branding violations in the file
rg -n "(cortex|cortexlinux)" wezterm/Cargo.toml

Repository: cxlinux-ai/cx-core

Length of output: 44


🏁 Script executed:

# Search for any related configuration or documentation mentioning hrm-ai
rg -n "hrm-ai|hrm_ai" wezterm/ --type toml --type yaml --type md

Repository: cxlinux-ai/cx-core

Length of output: 257


Pin the hrm-ai git dependency to a tag or commit.
Unpinned git deps can change without notice and break reproducibility/supply-chain controls.

🔒 Suggested pinning
-hrm-ai = { git = "https://github.com/mikejmorgan-ai/hrm-ai-standalone.git", optional = true }
+hrm-ai = { git = "https://github.com/mikejmorgan-ai/hrm-ai-standalone.git", rev = "<commit-sha>", optional = true }
🤖 Prompt for AI Agents
In `@wezterm/Cargo.toml` around lines 44 - 46, The hrm-ai git dependency in
Cargo.toml is unpinned and should be fixed to a specific tag or commit to ensure
reproducible builds; update the hrm-ai entry (the hrm-ai dependency line) to
include either a tag (e.g., tag = "vX.Y.Z") or a commit SHA (rev =
"<commit-sha>") alongside the git URL so Cargo will fetch a fixed revision
rather than the moving default branch.

Comment on lines +1 to +5
/**
* Copyright (c) 2026 CX Linux
* Licensed under the Business Source License 1.1
* You may not use this file except in compliance with the License.
*/
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Fix the license header copyright holder.
New files must attribute BSL 1.1 to AI Venture Holdings LLC.

📄 Suggested update
- * Copyright (c) 2026 CX Linux
+ * Copyright (c) 2026 AI Venture Holdings LLC

As per coding guidelines, Include BSL 1.1 license header on all new files with copyright to AI Venture Holdings LLC.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
/**
* Copyright (c) 2026 CX Linux
* Licensed under the Business Source License 1.1
* You may not use this file except in compliance with the License.
*/
/**
* Copyright (c) 2026 AI Venture Holdings LLC
* Licensed under the Business Source License 1.1
* You may not use this file except in compliance with the License.
*/
🤖 Prompt for AI Agents
In `@wezterm/src/cli/fire.rs` around lines 1 - 5, Replace the current license
header in this new file (fire.rs) so it attributes the Business Source License
1.1 to AI Venture Holdings LLC: update the copyright line and ensure the BSL 1.1
notice remains intact and identical in wording to the project's standard header
used across other new files.

Comment on lines +7 to +22
//! HRM AI Agent Termination Command
//!
//! Safely terminates AI agents with confirmation and audit logging.
//! This module is only available when the `hrm` feature is enabled.
//!
//! # Example
//! ```bash
//! # Terminate an agent by ID
//! cx fire abc123-def456
//!
//! # Force termination (skip confirmation)
//! cx fire abc123-def456 --force
//!
//! # Terminate with reason
//! cx fire abc123-def456 --reason "Migrating to new server"
//! ```
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Replace inner doc comments to restore fmt/build and align comment policy.
//! here triggers rustfmt errors (see pipeline). Convert to regular intent-focused comments and use the CX prefix.

✅ Suggested rewrite
-//! HRM AI Agent Termination Command
-//!
-//! Safely terminates AI agents with confirmation and audit logging.
-//! This module is only available when the `hrm` feature is enabled.
-//!
-//! # Example
-//! ```bash
-//! # Terminate an agent by ID
-//! cx fire abc123-def456
-//! 
-//! # Force termination (skip confirmation)
-//! cx fire abc123-def456 --force
-//! 
-//! # Terminate with reason
-//! cx fire abc123-def456 --reason "Migrating to new server"
-//! ```
+// CX Terminal: WHY — provide a guarded termination flow with audit logging
+// when the premium HRM feature is enabled.

As per coding guidelines, Code comments must explain WHY, never WHAT or HOW, and Rust: Mark CX additions with '// CX Terminal:' comment prefix.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
//! HRM AI Agent Termination Command
//!
//! Safely terminates AI agents with confirmation and audit logging.
//! This module is only available when the `hrm` feature is enabled.
//!
//! # Example
//! ```bash
//! # Terminate an agent by ID
//! cx fire abc123-def456
//!
//! # Force termination (skip confirmation)
//! cx fire abc123-def456 --force
//!
//! # Terminate with reason
//! cx fire abc123-def456 --reason "Migrating to new server"
//! ```
// CX Terminal: WHY — provide a guarded termination flow with audit logging
// when the premium HRM feature is enabled.
🤖 Prompt for AI Agents
In `@wezterm/src/cli/fire.rs` around lines 7 - 22, Replace the module-level inner
doc comments (the leading //! lines at the top of wezterm/src/cli/fire.rs) with
regular line comments that explain WHY this module exists (not WHAT or HOW),
using the required prefix "// CX Terminal:"; remove example usage blocks and
triple-backticks, keep the note about the hrm feature but convert it to a CX
Terminal comment, and ensure the comment text follows the project's comment
policy (intent-focused WHY and marked with the CX prefix) so rustfmt/build and
policy checks pass.

Comment on lines +97 to +105
// Print header
theme.print_header("CX Linux Agent Termination");

// Get database URL from environment
let db_url = std::env::var("DATABASE_URL")
.unwrap_or_else(|_| "postgres://localhost/cx_agents".to_string());

// Create repository to fetch agent info
let repo = AgentRepository::new(&db_url).await?;
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Inline comments should state intent (WHY) and use the CX prefix.
Comments like “Print header” and “Get database URL” are “what/how”; rephrase to intent or remove.

As per coding guidelines, Code comments must explain WHY, never WHAT or HOW, and Rust: Mark CX additions with '// CX Terminal:' comment prefix.

🤖 Prompt for AI Agents
In `@wezterm/src/cli/fire.rs` around lines 97 - 105, Replace the existing WHAT/HOW
comments above theme.print_header, the DATABASE_URL getenv, and
AgentRepository::new with CX-prefixed intent comments that explain WHY these
steps are necessary; specifically add comments like "// CX Terminal: explain why
we print the termination header (provide user context)" before
theme.print_header, "// CX Terminal: explain why we fall back to default
DATABASE_URL (ensure local dev connectivity)" near the db_url initialization,
and "// CX Terminal: explain why we construct AgentRepository (to fetch agent
termination metadata)" before AgentRepository::new to satisfy the guideline that
comments state intent and use the CX prefix.

Comment on lines +108 to +113
let agent = match repo.get_agent(&cmd.agent_id).await? {
Some(a) => a,
None => {
theme.print_error(&format!("Agent not found: {}", cmd.agent_id));
return Ok(());
}
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

# First, let me check the file and the specific lines mentioned
cat -n wezterm/src/cli/fire.rs | head -150 | tail -50

Repository: cxlinux-ai/cx-core

Length of output: 2259


🏁 Script executed:

# Get the context around lines 108-113
sed -n '90,130p' wezterm/src/cli/fire.rs

Repository: cxlinux-ai/cx-core

Length of output: 1467


🏁 Script executed:

# Check the function signature and return type
sed -n '80,120p' wezterm/src/cli/fire.rs

Repository: cxlinux-ai/cx-core

Length of output: 1416


🏁 Script executed:

# Check if anyhow is imported in this file
head -50 wezterm/src/cli/fire.rs | grep -E "^use|^extern"

Repository: cxlinux-ai/cx-core

Length of output: 113


🏁 Script executed:

# Check how errors are handled elsewhere in the file
rg "Err\(|anyhow::" wezterm/src/cli/fire.rs -A 2

Repository: cxlinux-ai/cx-core

Length of output: 100


Return a non-zero exit when the agent is missing.

Printing an error but returning Ok(()) makes automation treat failures as success. Use anyhow::anyhow!() to propagate the error instead, which is already imported in this file and aligns with the error handling pattern used elsewhere in the function.

🚫 Suggested error propagation
-            None => {
-                theme.print_error(&format!("Agent not found: {}", cmd.agent_id));
-                return Ok(());
-            }
+            None => {
+                theme.print_error(&format!("Agent not found: {}", cmd.agent_id));
+                return Err(anyhow::anyhow!("Agent not found: {}", cmd.agent_id));
+            }
🤖 Prompt for AI Agents
In `@wezterm/src/cli/fire.rs` around lines 108 - 113, The code prints an error
when repo.get_agent(&cmd.agent_id).await? returns None but still returns Ok(());
change this to propagate a non-zero failure by returning
Err(anyhow::anyhow!(...)) instead of Ok(()). Replace the None branch that
currently calls theme.print_error(&format!("Agent not found: {}",
cmd.agent_id)); return Ok(()) with a call to theme.print_error(...) followed by
returning Err(anyhow::anyhow!("Agent not found: {}", cmd.agent_id)) so the
function exits with an error when the agent is missing.

Comment on lines +1 to +5
/**
* Copyright (c) 2026 CX Linux
* Licensed under the Business Source License 1.1
* You may not use this file except in compliance with the License.
*/
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Fix the license header copyright holder.
New files must attribute BSL 1.1 to AI Venture Holdings LLC.

📄 Suggested update
- * Copyright (c) 2026 CX Linux
+ * Copyright (c) 2026 AI Venture Holdings LLC

As per coding guidelines, Include BSL 1.1 license header on all new files with copyright to AI Venture Holdings LLC.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
/**
* Copyright (c) 2026 CX Linux
* Licensed under the Business Source License 1.1
* You may not use this file except in compliance with the License.
*/
/**
* Copyright (c) 2026 AI Venture Holdings LLC
* Licensed under the Business Source License 1.1
* You may not use this file except in compliance with the License.
*/
🤖 Prompt for AI Agents
In `@wezterm/src/cli/hire.rs` around lines 1 - 5, Replace the copyright holder in
the file-level license header comment block at the top of the file (the
multi-line /** ... */ header) so it attributes the Business Source License 1.1
to "AI Venture Holdings LLC" instead of "CX Linux", preserving the BSL 1.1
wording and formatting.

Comment on lines +7 to +19
//! HRM AI Agent Hiring Command
//!
//! Deploys AI agents to managed servers with enterprise-grade compliance.
//! This module is only available when the `hrm` feature is enabled.
//!
//! # Example
//! ```bash
//! # Deploy a DevOps agent
//! cx hire devops --server prod-1 --name "Deploy Bot"
//!
//! # Deploy with custom configuration
//! cx hire security --server sec-cluster --capabilities audit,scan,patch
//! ```
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Replace inner doc comments to fix fmt/build and align comment policy.
//! here triggers rustfmt errors. Convert to regular intent-focused comments and use the CX prefix.

✅ Suggested rewrite
-//! HRM AI Agent Hiring Command
-//!
-//! Deploys AI agents to managed servers with enterprise-grade compliance.
-//! This module is only available when the `hrm` feature is enabled.
-//!
-//! # Example
-//! ```bash
-//! # Deploy a DevOps agent
-//! cx hire devops --server prod-1 --name "Deploy Bot"
-//!
-//! # Deploy with custom configuration
-//! cx hire security --server sec-cluster --capabilities audit,scan,patch
-//! ```
+// CX Terminal: WHY — provide a guarded hiring flow with compliance and audit
+// when the premium HRM feature is enabled.

As per coding guidelines, Code comments must explain WHY, never WHAT or HOW, and Rust: Mark CX additions with '// CX Terminal:' comment prefix.

🧰 Tools
🪛 GitHub Actions: CX Terminal Build

[error] 7-19: Rust syntax error: inner doc comments like //! can only appear before items. Replace with regular comments. Example: change '//! HRM AI Agent Hiring Command' to '// HRM AI Agent Hiring Command' and adjust subsequent lines accordingly. This caused cargo fmt --all -- --check to fail.

🪛 GitHub Actions: fmt

[error] 7-7: expected outer doc comment


[error] 8-8: expected outer doc comment


[error] 9-9: expected outer doc comment


[error] 10-10: expected outer doc comment


[error] 11-11: expected outer doc comment


[error] 12-12: expected outer doc comment


[error] 13-13: expected outer doc comment


[error] 14-14: expected outer doc comment


[error] 15-15: expected outer doc comment


[error] 16-16: expected outer doc comment


[error] 17-17: expected outer doc comment


[error] 18-18: expected outer doc comment


[error] 19-19: expected outer doc comment


[error] 19-19: Error writing files: failed to resolve mod hire: cannot parse /home/runner/work/cx-core/cx-core/wezterm/src/cli/hire.rs

🤖 Prompt for AI Agents
In `@wezterm/src/cli/hire.rs` around lines 7 - 19, Replace the module-level inner
doc comments (the leading //! block at the top of hire.rs) with non-doc comments
that explain WHY using the required prefix; remove the //! markers and convert
each line to a normal comment starting with "// CX Terminal:" that describes the
rationale for the HRM hiring command (compliance/audit/guarded flow) rather than
usage HOW/WHAT or examples; ensure no inner doc comments remain so rustfmt/build
errors are resolved and the new comments follow the "explain WHY" guideline.

Comment on lines +81 to +83
/// Output format: table, json
#[arg(long, default_value = "table")]
pub format: String,
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

cd wezterm && head -100 src/cli/hire.rs | tail -30

Repository: cxlinux-ai/cx-core

Length of output: 1008


🏁 Script executed:

cat -n wezterm/src/cli/hire.rs | sed -n '70,100p'

Repository: cxlinux-ai/cx-core

Length of output: 1255


🏁 Script executed:

# Search for usage of 'format' variable in hire.rs
rg "format" wezterm/src/cli/hire.rs -A 2 -B 2

Repository: cxlinux-ai/cx-core

Length of output: 551


🏁 Script executed:

# Check if there's any output/serialization code in hire.rs
rg "to_string|serialize|json|table" wezterm/src/cli/hire.rs

Repository: cxlinux-ai/cx-core

Length of output: 343


🏁 Script executed:

# Search for usage of cmd.format or self.format
rg "cmd\.format|self\.format" wezterm/src/cli/

Repository: cxlinux-ai/cx-core

Length of output: 373


🏁 Script executed:

# Look for the run_hire_with_hrm function
rg "fn run_hire_with_hrm" wezterm/src/cli/ -A 30

Repository: cxlinux-ai/cx-core

Length of output: 1814


🏁 Script executed:

# Check if there's any conditional logic based on format
rg "match.*format|if.*format" wezterm/src/cli/hire.rs

Repository: cxlinux-ai/cx-core

Length of output: 44


🏁 Script executed:

# Get the full run_hire_with_hrm function to see if format is used anywhere
cat -n wezterm/src/cli/hire.rs | sed -n '104,200p'

Repository: cxlinux-ai/cx-core

Length of output: 4008


🏁 Script executed:

# Check the complete file length
wc -l wezterm/src/cli/hire.rs

Repository: cxlinux-ai/cx-core

Length of output: 89


🏁 Script executed:

# See the rest of run_hire_with_hrm and check for format usage
tail -100 wezterm/src/cli/hire.rs

Repository: cxlinux-ai/cx-core

Length of output: 3118


🏁 Script executed:

# Compare with a command that properly implements format (ask.rs)
rg "match self.format" wezterm/src/cli/ask.rs -A 10 -B 2

Repository: cxlinux-ai/cx-core

Length of output: 429


Remove unused --format flag or implement table/json output.

The format field is accepted but never used in run_hire_with_hrm. Either remove the flag or implement conditional output logic (match on self.format as other commands do). If JSON output is added, use Serde for serialization per the coding guidelines.

🤖 Prompt for AI Agents
In `@wezterm/src/cli/hire.rs` around lines 81 - 83, The --format flag (pub format:
String) is accepted in the Hire CLI struct but not used in run_hire_with_hrm;
either remove the format field or implement conditional output: in
run_hire_with_hrm match on self.format (e.g., "table" | "json") and branch the
output path accordingly—keep the existing table rendering for "table" and, for
"json", serialize the same data structure using Serde (derive Serialize or build
a serializable DTO) and print the JSON; ensure you validate unknown values
(return an error) and update any help/usage text if you remove the flag.

Comment on lines +125 to +139
// Print header
theme.print_header("CX Linux Agent Deployment");

println!();
println!(" 📋 Deployment Request");
println!(" ─────────────────────────────────────");
println!(" Agent Type: {}", cmd.agent_type);
println!(" Server: {}", cmd.server);
if let Some(ref name) = cmd.name {
println!(" Name: {}", name);
}
if let Some(ref caps) = cmd.capabilities {
println!(" Capabilities: {}", caps.join(", "));
}
println!();
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Inline comments should state intent (WHY) and use the CX prefix.
Comments like “Print header” and “Deployment Request” are “what”; rephrase to intent or remove.

As per coding guidelines, Code comments must explain WHY, never WHAT or HOW, and Rust: Mark CX additions with '// CX Terminal:' comment prefix.

🤖 Prompt for AI Agents
In `@wezterm/src/cli/hire.rs` around lines 125 - 139, The comment "Print header"
above the call to theme.print_header and any other inline comments that only
state "what" should be rewritten to explain the intent (WHY) using the
prescribed CX prefix: replace or remove superficial comments and add a CX
Terminal comment like "// CX Terminal: explain why we're printing the header and
deployment summary here (e.g., to provide the user a clear context before
collecting input/output)" near theme.print_header; similarly, if any surrounding
println! blocks need commentary, either remove them or add a "// CX Terminal:
..." comment explaining the purpose of printing
agent_type/server/name/capabilities (for user confirmation before deployment)
and reference the cmd.agent_type, cmd.server, cmd.name, and cmd.capabilities
variables so the reviewers can locate the logic.

@Anshgrover23 Anshgrover23 removed their assignment Feb 7, 2026
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