Skip to content
Merged
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
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ cargo run -p decodex --bin decodex -- probe stdio://
cargo run -p decodex --bin decodex -- project list
cargo run -p decodex --bin decodex -- status
cargo run -p decodex --bin decodex -- diagnose --json
cargo run -p decodex --bin decodex -- maintenance prune --dry-run
cargo run -p decodex --bin decodex -- run --dry-run
cargo run -p decodex --bin decodex -- serve --interval 60s --listen-address 127.0.0.1:8912
```
Expand Down Expand Up @@ -143,6 +144,13 @@ matching `accounts.jsonl` entry.
`~/.codex/decodex/agent-evidence/<service-id>/` and prints the same handoff index for
repair agents.

`decodex maintenance prune --dry-run` reports local Decodex storage retention
candidates without applying retention changes. Add `--apply` to rotate
oversized local logs and agent-evidence event streams, prune old backup files, compact
old terminal-run protocol events after preserving their summary, and checkpoint the
SQLite WAL. `decodex serve` also runs the auto-safe subset at startup and periodically
while it is polling.

## Static Site

The public site is an Astro static site under `site/`. It renders checked-in content and
Expand Down
47 changes: 47 additions & 0 deletions apps/decodex/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ use crate::{
accounts::{self, AccountImportRequest, AccountLoginRequest, AccountUseRequest},
agent,
archive_hygiene::{self, ArchiveHygieneRequest},
maintenance::{self, MaintenanceMode, MaintenancePruneRequest, MaintenanceScope},
manual::{self, ManualCommitRequest, ManualLandRequest},
orchestrator::{self, DiagnoseRequest, IssueDispatchMode, RunOnceRequest, ServeRequest},
prelude::eyre,
Expand Down Expand Up @@ -62,6 +63,7 @@ impl Cli {
Command::Diagnose(args) => args.run(config_path),
Command::Recover(args) => args.run(config_path),
Command::ArchiveLinear(args) => args.run(config_path),
Command::Maintenance(args) => args.run(),
Command::Account(args) => args.run(),
Command::Probe(args) => args.run(),
Command::Attempt(args) => args.run(config_path),
Expand Down Expand Up @@ -137,6 +139,8 @@ enum Command {
Recover(RecoverCommand),
/// Dry-run or archive old terminal Linear issues by repo label.
ArchiveLinear(ArchiveLinearCommand),
/// Maintain local Decodex logs, evidence, backups, and runtime storage.
Maintenance(MaintenanceCommand),
/// Manage the global Decodex Codex account pool.
Account(AccountCommand),
/// Validate the local app-server integration boundary.
Expand Down Expand Up @@ -620,6 +624,49 @@ impl ArchiveLinearCommand {
}
}

#[derive(Debug, Args)]
struct MaintenanceCommand {
#[command(subcommand)]
command: MaintenanceSubcommand,
}
impl MaintenanceCommand {
fn run(&self) -> crate::prelude::Result<()> {
match &self.command {
MaintenanceSubcommand::Prune(args) => args.run(),
}
}
}

#[derive(Debug, Subcommand)]
enum MaintenanceSubcommand {
/// Inspect or apply local Decodex storage retention.
Prune(MaintenancePruneCommand),
}

#[derive(Debug, Args)]
struct MaintenancePruneCommand {
/// Report candidates without applying retention changes.
#[arg(long, conflicts_with = "apply")]
dry_run: bool,
/// Apply safe file retention, state-aware runtime compaction, and WAL checkpointing.
#[arg(long, conflicts_with = "dry_run")]
apply: bool,
/// Emit the maintenance report as JSON.
#[arg(long)]
json: bool,
}
impl MaintenancePruneCommand {
fn run(&self) -> crate::prelude::Result<()> {
let mode = if self.apply { MaintenanceMode::Apply } else { MaintenanceMode::DryRun };

maintenance::run_prune_command(MaintenancePruneRequest {
mode,
scope: MaintenanceScope::Full,
json: self.json,
})
}
}

#[derive(Debug, Args)]
struct ProbeCommand {
/// Override the expected app-server transport during probing.
Expand Down
5 changes: 3 additions & 2 deletions apps/decodex/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ mod commit_message;
mod default_branch_sync;
mod git_credentials;
mod github;
mod maintenance;
mod manual;
mod orchestrator;
mod pull_request;
Expand Down Expand Up @@ -57,8 +58,8 @@ fn init_tracing() -> Result<WorkerGuard> {

let (non_blocking, guard) = tracing_appender::non_blocking(
RollingFileAppender::builder()
.rotation(Rotation::WEEKLY)
.max_log_files(3)
.rotation(Rotation::DAILY)
.max_log_files(30)
.filename_suffix("log")
.build(log_dir)?,
);
Expand Down
Loading