Skip to content

Add Knowledge Loop agent#18

Merged
Svaag merged 5 commits into
mainfrom
feature/knowledge-loop-agent
Jun 27, 2026
Merged

Add Knowledge Loop agent#18
Svaag merged 5 commits into
mainfrom
feature/knowledge-loop-agent

Conversation

@Svaag

@Svaag Svaag commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Summary

  • save the Knowledge Loop phase plan under docs/plans/
  • add hyrule-knowledge loop --once as a governed producer agent skeleton
  • phase 1: lock, per-day ledger, deterministic ingest/validation, optional dry-run enrichment plumbing, PR publication, JSON reports, optional Icinga heartbeat
  • phase 2: opt-in OpenRouter enrichment targets and learning-event import with daily budgets
  • document usage in README and add regression coverage

Validation

  • uv run ruff check src tests
  • uv run mypy --strict src
  • uv run pytest
  • uv run hyrule-knowledge validate okf
  • uv run hyrule-knowledge quality --check
  • uv run hyrule-knowledge export --check
  • uv run hyrule-knowledge eval --check
  • uv run hyrule-knowledge ledger --check
  • uv run hyrule-knowledge ledger lifecycle --check
  • uv run hyrule-knowledge scan-secrets okf exports reports evals ledger schema

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: edf29e8dea

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/hyrule_knowledge/knowledge_loop.py Outdated
Comment thread src/hyrule_knowledge/knowledge_loop.py Outdated
Comment thread src/hyrule_knowledge/knowledge_loop.py Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e4e5572099

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/hyrule_knowledge/knowledge_loop.py Outdated
Comment thread src/hyrule_knowledge/knowledge_loop.py Outdated
@Svaag Svaag force-pushed the feature/knowledge-loop-agent branch from e4e5572 to e02684d Compare June 24, 2026 04:46
@Svaag

Svaag commented Jun 24, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e02684d717

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/hyrule_knowledge/knowledge_loop.py Outdated
Comment thread src/hyrule_knowledge/knowledge_loop.py
@Svaag Svaag force-pushed the feature/knowledge-loop-agent branch from e02684d to edf1078 Compare June 24, 2026 04:53
@Svaag

Svaag commented Jun 24, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: edf1078731

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/hyrule_knowledge/knowledge_loop.py
Comment thread src/hyrule_knowledge/knowledge_loop.py Outdated
@Svaag Svaag force-pushed the feature/knowledge-loop-agent branch from edf1078 to 3c70367 Compare June 24, 2026 05:00
@Svaag

Svaag commented Jun 24, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3c70367201

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/hyrule_knowledge/knowledge_loop.py Outdated
@Svaag Svaag force-pushed the feature/knowledge-loop-agent branch from 3c70367 to eb89f7c Compare June 24, 2026 05:09
@Svaag

Svaag commented Jun 24, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: eb89f7cb43

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/hyrule_knowledge/knowledge_loop.py Outdated
Comment thread src/hyrule_knowledge/cli.py Outdated
@Svaag Svaag force-pushed the feature/knowledge-loop-agent branch from eb89f7c to 82a014f Compare June 24, 2026 05:18
@Svaag

Svaag commented Jun 24, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 82a014fe08

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/hyrule_knowledge/knowledge_loop.py
Comment thread src/hyrule_knowledge/knowledge_loop.py Outdated
Address the two open Codex findings on the Knowledge Loop agent:

- Idle cycles no longer publish timestamp-only refreshes. ingest/export/eval
  restamp last_verified_at/run_id and rebuild knowledge.sqlite (datetime('now'))
  every run, so an unchanged source snapshot left a dirty worktree and could open
  a timestamp-only PR. The loop now reverts volatile-only managed diffs (ISO
  timestamps, run ids, and the always-volatile SQLite artifact) before deciding
  to publish, so a no-op cycle reports idle. Genuine knowledge changes are kept
  and still publish with their fresh timestamps.
- Learning-event paths resolve against the repo checkout. A relative
  --learning-event is now resolved against config.repo_path before both the budget
  preflight count and the `ledger import` subprocess (cwd=repo), so the loop counts
  and imports the same files when invoked from outside the checkout.

Add regression coverage for the idle-revert path, the semantic-change publish
path, and repo-relative learning-event resolution.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@Svaag

Svaag commented Jun 26, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: dcda960999

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/hyrule_knowledge/knowledge_loop.py Outdated
When the loop runs with --skip-validation (run_validation=False), the published
PR body still claimed the validation suite ran, giving reviewers false assurance
for exactly the PRs that bypassed the gates. The body now states that validation
was skipped and must be run before merge when run_validation is False.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@Svaag

Svaag commented Jun 26, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 98d3247e98

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/hyrule_knowledge/knowledge_loop.py Outdated
Comment thread src/hyrule_knowledge/knowledge_loop.py Outdated
Address two follow-up Codex findings on the Knowledge Loop agent:

- Publish the schema directory. `schema` is a managed dirty prefix, so a
  schema-only change is seen as publishable, but `_publish_pr` only staged
  okf/exports/reports/evals/ledger. A schema-only change then produced an empty
  staged tree (returning changes_detected with no PR) and mixed changes silently
  dropped the schema update. The publish step now stages the same managed set it
  detects as dirty.
- Scope volatile-diff detection to generated metadata fields. The blanket ISO
  timestamp normalization classified a corrected learning-event `event_time`
  (whose stable id does not include event_time) as churn, so under
  --replace-learning-events the loop reverted the file and reported idle, silently
  discarding the correction. Normalization is now keyed to generated metadata
  (last_verified_at, generated_at, extracted_at, claim_extracted_at, requested_at,
  created_at) plus run ids, leaving source fields like event_time intact.

Add regression coverage for schema staging and for keeping a corrected event_time.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@Svaag

Svaag commented Jun 26, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 725a31c94a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/hyrule_knowledge/knowledge_loop.py Outdated
Comment thread src/hyrule_knowledge/cli.py Outdated
Address two more Codex findings on the Knowledge Loop agent:

- Count failed cycles against the daily budget. The exception path charged only
  phase-2 attempts and then reloaded the ledger, so `cycles` never incremented and
  a systemd timer could rerun the same failing ingest/validation cycle all day
  under the default max_cycles_per_day=1. Failed cycles now increment `cycles`.
- Treat a blank HYRULE_KNOWLEDGE_LOOP_STATE_DIR as unset. A present-but-blank (or
  whitespace) value previously resolved the state dir to the repo root via
  Path(""), writing the lock/ledger/PR-body into the checkout where the dirty
  check could not ignore them. A new _env_str helper strips and falls back to the
  default cache path.

Add regression coverage for the failed-cycle budget and the blank state-dir env.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@Svaag

Svaag commented Jun 26, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 👍

Reviewed commit: f1c95fda50

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@Svaag Svaag merged commit 0b414ae into main Jun 27, 2026
1 check passed
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.

1 participant