Compare commits

..
Author SHA1 Message Date
Blog Creator 6b9113369e Bureaucratic systems combine to punish families 2026-07-29 18:25:34 +00:00
armistace 4554a41581 Update src/content/how_bureaucratic_systems_interact_to_create_bad_outcomes.md 2026-07-28 12:37:53 +10:00
Hermes Agent 917338c4f9 fix intro to match actual post structure 2026-07-28 12:27:43 +10:00
Hermes Agent 8c357aae47 grammar and spelling fixes 2026-07-28 12:24:22 +10:00
armistace 643d3ee051 Update src/content/how_bureaucratic_systems_interact_to_create_bad_outcomes.md 2026-07-28 12:22:57 +10:00
armistace b72feb1b71 Update src/content/how_bureaucratic_systems_interact_to_create_bad_outcomes.md 2026-07-28 12:19:19 +10:00
armistace 3891dc25c4 Update src/content/how_bureaucratic_systems_interact_to_create_bad_outcomes.md 2026-07-28 12:16:43 +10:00
Hermes Agent 619adc209a tighten section 3, remove all duplicated context 2026-07-28 11:57:03 +10:00
Hermes Agent 7fffa41a22 remove duplicate paragraphs from conclusion 2026-07-28 11:55:53 +10:00
armistace 7bb101a48c Update src/content/how_bureaucratic_systems_interact_to_create_bad_outcomes.md 2026-07-28 11:54:26 +10:00
Hermes Agent 6c6cf8a2cc move correspondence to appendix, restructure for flow 2026-07-28 11:50:03 +10:00
Hermes Agent 980aa01b0e tighten cosmetic dental to incidental mention 2026-07-28 11:46:54 +10:00
Hermes Agent 07c43ddc62 edits from review: fix authors, tighten phrasing, restructure analysis after letters, soften minister reference 2026-07-28 11:44:49 +10:00
armistace da3c9c9cc2 Update src/content/how_bureaucratic_systems_interact_to_create_bad_outcomes.md 2026-07-28 11:37:43 +10:00
Blog Creator 469c0c4038 Bureaucratic systems punish families doing right 2026-07-28 01:23:20 +00:00
armistace 6d1294af3e Merge pull request 'pr_reviewer__a_deployable_ai_reviewer_for_your_repos' (#25) from pr_reviewer__a_deployable_ai_reviewer_for_your_repos into master
Build and Push Image / Build and push image (push) Successful in 18m58s
Reviewed-on: #25
2026-05-22 20:47:31 +10:00
armistace 727949de93 Add Myself as Author 2026-05-22 20:41:55 +10:00
Blog Creator c95161dc7c Add PR Reviewer overview documentation 2026-05-21 18:31:39 +00:00
Blog Creator e2ec1a3eae Add comprehensive PR Reviewer guide 2026-05-21 12:13:53 +00:00
Blog Creator 2f4e98a8e3 Introduce PR Reviewer overview article 2026-05-21 11:39:13 +00:00
Blog Creator 85375a051e Add PR Reviewer guide documentation 2026-05-15 18:38:04 +00:00
Blog Creator 6db260d4bd Add deployable AI PR reviewer 2026-05-14 18:33:04 +00:00
Blog Creator e044202042 Add PR Reviewer deployment docs 2026-05-09 18:38:39 +00:00
armistace 0cf39e41e9 Upload files to "src/themes/cleanblog/static/images"
Build and Push Image / Build and push image (push) Successful in 29m30s
2026-05-06 16:05:47 +10:00
armistace 32fb9709a0 update template to use png
Build and Push Image / Build and push image (push) Has been cancelled
2026-05-06 16:05:08 +10:00
armistace b19d7c9128 update header to refer ot local
Build and Push Image / Build and push image (push) Successful in 24m18s
2026-05-06 14:29:43 +10:00
armistace 8f36777a6c Upload files to "src/content/images"
Build and Push Image / Build and push image (push) Has been cancelled
2026-05-06 14:28:40 +10:00
armistace fa14853363 Update header image
Build and Push Image / Build and push image (push) Has been cancelled
2026-05-06 14:25:03 +10:00
6 changed files with 517 additions and 2 deletions
@@ -0,0 +1,206 @@
Title: How Bureaucratic Systems Interact To Create Bad Outcomes
Date: 2026-07-29 18:24
Modified: 2026-07-29 18:24
Category: Policy
Tags: health-policy, superannuation, bureaucracy, child-care-subsidy, tax-system
Slug: how-bureaucratic-systems-interact-to-create-bad-outcomes
Authors: glm-5.2.ai, nemotron-3-nano.ai, gpt-oss.ai, deepseek-v4-flash.ai
Summary: A father's account of how three government systems, health, tax, and family services, combined to punish his family for accessing super to pay for his daughter's surgery.
I should start by saying this is going to be a long post. I do not normally publish public-facing complaints of this specific nature, but in the current environment it seems to be the only way to get people to stand back from their own processes and rules long enough to see how the system actually works in practice. The short version is that the compassionate release of super scheme is neither compassionate nor particularly understanding, and is actively generating worse outcomes for the very people it was meant to help. I will outline my case below, and I am particularly concerned about what this means for people accessing the system for things like cosmetic dental work.
A bit of context. I recently had to deal with something no parent enjoys. My daughter had injured her knee to the point it required surgery. She was just getting into rugby and doing some excellent work to get on top of her health, and we were faced with the inevitable choice that comes with this kind of scenario in Australia: public or private health. What follows is the journey that happens when you try to use private health in Australia to get better outcomes for your child, and how that choice ripples into the tax system, the compassionate release of super process, the Child Care Subsidy, and Human Services. It is a case study in how three systems that each have their own logic can combine to produce an outcome that makes no sense to anyone standing outside the bubble.
The three systems in question are:
1. Private and public health
2. The Australian Taxation Office and superannuation
3. The Child Care Subsidy and Human Services
We recently attempted to take this through the Administrative Review Tribunal but decided that the invasive and costly structure put in place for doing reviews means only one thing. We have to let the system win, because of its pervasive nature and the internal culture of wearing the public down until they do not have the energy to fight anymore. I will mention the tribunal only in passing, as instructed.
This blog post, along with emails to the respective ministers, my local representative, and approaches to news outlets, is effectively the last attempt to get someone to actually listen, rather than send replies that treat me like a child who has not done any prior research. The canned response from the Health Minister's office is a particular case in point.
I should note that my local MP, Ali France, has reached out to ask for my story to assist with her work on the House of Representatives Standing Committee on Health, Aged Care and Disability, which is currently looking at improving access to specialist doctors. If that is something that matters to you, submissions are open here: https://www.health.gov.au/our-work/consultation-on-specialist-affordability-and-access?language=en
To work through this properly, I have put together a timeline. I will also be uploading copies of the correspondence so that you can see just how condescending our bureaucracy can be when it thinks it has heard it all before.
The post is structured in three sections:
1. Timeline of the initial event and the health care received
2. Timeline of the tax event and its fallout
3. Analysis of how the three systems interact to create a terrible outcome
Before I get into the details, I want to be clear about one thing. While I have complaints about the system, the surgeon was always upfront and provided exemplary care. This is not a complaint about the surgeon. We could not have asked for a better outcome for my daughter. This is a critique of the interactions of government systems, and how the unintended consequences of those interactions create poorer outcomes than anyone intended.
## Section 1: Timeline of the initial event and health care received
**June 2024**
My daughter had an incident at school resulting in a knee injury. We attended a local emergency department, who splinted it and referred us back to our GP. At this point we were told that an injury like hers would take between 12 and 24 months to be triaged in the public health system. That is simply unacceptable. She had put in some fantastic work to get on top of her health and adding 12 to 24 months on top of the recovery time would have created bad outcomes. On that basis, we opted to go private.
This is the first key failure of the health system. It is not being proactive at all, and by reacting this way to this kind of injury, the public system would have created co-morbidities in my daughter that would likely have made her a much larger drain on the health system over the long term. At this point, the public health system may as well be called the "let's make it worse" system.
Our GP asked who we would like to be referred to. We did some research and found a well-respected surgeon near where we live who specialises in exactly these injuries. The specialist sent us the schedule of fees and made sure we signed the informed financial consent. The fees were significant, but we had opted to go private and we knew this would be the case. We got my daughter in to see the specialist.
**July 2024**
It was confirmed that surgery was required. Our specialist sent us the financials. The surgeon's fee was significant, with Medicare covering a little over one thousand dollars, leaving an out-of-pocket cost of around six thousand. On top of that, the anaesthetist was another one and a half thousand, and that was before the other costs in the room. We understood this was expensive, but it would create the best outcomes for my daughter, and we signed the informed financial consent for surgery.
Thankfully, private health covered the hospital fees, which would have added tens of thousands to the final cost. We asked the specialist if she would access the gap, as we had done before with other surgeons. She does not participate in that system, as it would mean she makes at best half of her fees, which barely cover her insurance, hospital, and usage costs. At this point, I realised the public and private health systems are both failing us, and to get something approaching adequate care we need to stump up our own money, even when we are paying tens of thousands each year via the Medicare levy and private health fees.
I remembered hearing about the release of super for medical reasons. I looked up the policy. We accepted that this would adversely affect my income tax, but doing the numbers, we believed it was still cheaper than a personal loan of around eight thousand to cover the costs. I put the several hours of work required into applying to get access to my own money. We got approved.
**August 2024**
My daughter had the surgery. We paid the specialist and other consultant fees with the money released to us from the early release of super.
**October 2024**
My daughter began rehabilitation.
**November 2024**
I did my 2023/24 tax return with my accountant. The super amount was not included as it had not been finalised, and we had a normal tax season.
**April 2025**
My daughter started the 2024 rugby season. She was unable to play but participated in training. This was only possible because she had surgery in the private health system. Had we gone through the public system, we would still be waiting for surgery at this point.
## Section 2: Timeline of the tax event and fallout
**June 2025**
Our notice of assessment landed. The super payout was automatically brought into my taxable income, as expected.
**October 2025**
We sat down to do our tax. The PAYG was sorted via the super amount, and we shrugged, complained about the two thousand dollars they had just charged us in tax to get surgery for my daughter, and moved on. We had expected some tax liability. We had not expected what came next.
**January 2026**
Our Child Care Subsidy was recalculated based on our finalised tax. We now not only lose the tax money, we lose the monthly benefit of the CCS to a very, very low level. The lump sum that we had been encouraged to take out on compassionate grounds to fix a problem the health system had created was now treated as regular income for the purposes of family assistance. The assistance that we were receiving to help us work and pay for the very things the health system was failing to cover was stripped back because we had used the only mechanism available to us to pay for private surgery.
The rest of 2026 has been spent attempting to find ways to get the Human Services system to see a one-off lump sum from super as not part of our regular income. The answer, in short, is that they will not. The Administrative Review Tribunal was approached, but the process demanded detailed breakdowns of our budgets and income in a way that felt designed to make people give up. We gave up.
## Section 3: Analysis of how the three systems interact to create a terrible outcome
It is clear from the above that compassionate release of super is not compassionate in any practical sense. I have received letters from the Health Minister's office and the Treasurer's office, and both lay the blame on the other. The Human Services Minister's office did not even bother to respond. What follows is an attempt to lay out exactly how the three systems interact, and why the result is that the people who can least afford it are penalised for trying to do the right thing.
I put this question to the respective ministers: why come up with a compassionate release of super option, specifically to address failures of funding in health care, and then make sure that when you use it, it is not only going to cost you the extra in tax, but in any welfare received as well? And what about those people being encouraged to use this for cosmetic dental work? The use of the compassionate release provisions for dental work, including cosmetic procedures, has been a growing concern in public discussion around the scheme. The Australian Taxation Office has reported steady increases in the volume of applications for dental and medical reasons over recent years, and media coverage has highlighted cases where people have been steered towards the scheme for non-essential procedures. If the system is already producing perverse outcomes for essential surgery, one can only imagine the impact on those who access it for cosmetic work, particularly when the downstream impact on welfare payments is taken into account.
The outcomes cannot be sustainable. I do not necessarily think that giving people access to super in times of stress is a bad thing, but if you are going to call it compassionate, make it compassionate. Provide tax concessions and do not affect welfare payments. The current design punishes the very behaviour the policy is supposed to encourage.
The correspondence that follows is presented in full so that you can see the tone and content of the responses. I have redacted nothing of substance. The letters speak for themselves.
---
**Letter from the Treasurer's office (via Treasury)**
Dear Mr Ridgway
Thank you for your correspondence on 19 December 2025 to the Hon Jim Chalmers MP, Treasurer, concerning the interaction between early release of super and social services payments. Your correspondence has been referred to Treasury. My sincere apologies for taking so long to get back to you.
I am sorry to hear about the difficult circumstances your family has faced. Please accept my sympathies.
In your correspondence you propose that the early release of superannuation on compassionate grounds should not be classified as reportable income for social services assessment purposes.
As you are aware, benefits paid before an individual turns 60 are taxed at the lower of their marginal tax rate or 20 per cent (plus Medicare levy of 2 per cent where applicable) and is included in their taxable income. The tax treatment of early withdrawals reflects the nature of superannuation as a concessionally taxed form of savings designed to provide income in retirement.
As you note, benefits paid from superannuation as a result of an early release could impact some government income-tested support payments and financial assistance as it may be treated as income. This includes the Child Care Subsidy (CCS), which like most government payments, is income-tested to ensure support is targeted to families with the greatest need. A family's CCS entitlement is based on their combined annual Adjusted Taxable Income, which includes both taxable income and non-wage related remuneration.
The inclusion of the early release of benefits paid from superannuation into an individual's taxable income is appropriate given that these amounts, like salary or wages, increases the amount of income or purchasing power at a person's disposal.
Thank you for taking the time to raise your concerns in relation to the treatment of the early release of super and the impact on your income-tested family support payments. However, the Government considers that the current settings strike the right balance and has no current plans to change these settings.
Once again, thank you for taking the time to write.
Yours sincerely
Ben Murphy
Director
Retirement Income and Tax Administration Branch
---
**Letter from the Health Minister's office (Department of Health, Disability and Ageing)**
Mr Andrew Ridgway
home.ridgway.2020@gmail.com
Dear Mr Ridgway
Thank you for your correspondence of 6 December 2025 to the Minister for Health and Ageing and the Minister for Disability and the National Disability Insurance Scheme, the Hon Mark Butler MP regarding the out-of-pocket expenses associated with private specialist treatment for your daughter. The Minister has asked me to respond on his behalf.
I note you have also written to the Hon Dr Jim Chalmers MP, Treasurer; the Hon Tanya Plibersek MP, Minister for Social Services; and Ms Ali France MP, Member for Dickson on associated matters relating to the compassionate release of superannuation. Their departments may follow up separately on those issues, which are outside Minister Butler's portfolio responsibilities and are thus beyond the scope of this reply.
I acknowledge the financial impact out-of-pocket medical expenses and the stress associated with the suffering of a family member. I trust your daughter is recovering well.
Private health insurance and out-of-pocket expenses
I note from your correspondence that you and your family have held private health insurance (PHI) for some years. Under the Private Health Insurance Act 2007, private health insurers are required to pay mandatory minimum benefits for hospital services for a patient with appropriate health insurance cover as part of hospital treatment. These benefits include at least 25 per cent of the Medicare Benefits Schedule (MBS) fee, minimum accommodation benefits and minimum benefits for medical devices. Medicare contributes to the cost of hospital treatment for private patients by covering the remaining portion of the MBS fee. It means that if a doctor charges more than the MBS fee, it can give rise to an out-of-pocket cost.
Informed financial consent
Doctors operate as private businesses and the actual fee charged is a matter between the doctor and patient. All doctors are encouraged to consider the personal circumstances of their patients when setting fees. As a private patient you have choice and have the right to negotiate on price.
The Good Medical Practice Code of Conduct, endorsed by the Medical Board of Australia (MBA), states good medical practice involves doctors ensuring their patients are informed about the doctors' fees and charges. This is known as 'informed financial consent' and is important to enable the patient to make a fully informed decision about treatment options. Doctors are expected to obtain informed financial consent from patients prior to treatment. This includes full information regarding their fees, including out-of-pocket costs. If you were not given this opportunity, you may wish to register a complaint with the Australian Health Practitioner Regulation Agency who handle such complaints on behalf of the MBA.
Reducing out-of-pocket costs
To minimise out-of-pocket costs for policy holders, health insurers can choose to pay more than the required minimum benefits, and many do so through negotiating agreements with doctors under gap cover arrangements. These gap arrangements are designed to eliminate or reduce the out-of-pocket costs incurred by the patient for in-hospital treatments. If a service is provided under a 'no gap arrangement', it means the full medical charge is covered by Medicare and the private health insurer. If a service is provided under a 'known gap arrangement', the private health insurer pays a specified benefit, and the doctor undertakes to charge no more than a specified gap.
Should you or your family require medical treatment in the future, I encourage you to speak to your private health insurer about gap cover arrangements they may have in place. It is important to note that doctors are free to decide whether to apply any gap cover arrangement for any particular patient. You would need to ensure your doctor activates a particular gap cover arrangement for you.
You may also wish to visit the Medical Costs Finder, which has been developed by the Government, at www.medicalcostsfinder.health.gov.au. The Medical Costs Finder shows the typical costs of common medical services.
The Government has committed to help Australians find the best value when they need specialist treatment by upgrading the Medical Costs Finder. The upgraded website will provide even greater transparency on individual specialist fees and insurer out-of-pocket costs. The upgrade will happen in the next year or so, and consumers can continue using the existing website in the meantime.
Thank you for writing on this matter.
Yours sincerely
Jacqualine Myint
Director, Consumers Section
Private Health Strategy Branch
Department of Health, Disability and Ageing
2 February 2026
---
**Letter from Ali France MP's office**
Thank you for your email. Ali appreciates you taking the time to again to share your family's experience. As you know, Ali has a longstanding interest in healthcare affordability and access and, as a member of the House of Representatives Standing Committee on Health, Aged Care and Disability, is particularly interested in hearing directly from constituents about the barriers they face in accessing timely and affordable care.
Improving access to affordable specialist care is currently a significant area of work. The Australian Government is consulting on reforms aimed at making private specialist services more affordable and accessible, including options to improve referral pathways, strengthen fee transparency and informed financial consent, and address concerns about very high specialist fees. In addition, the House of Representatives Standing Committee on Health, Aged Care and Disability is undertaking an inquiry into the access and affordability of medical specialists across Australia, with submissions currently open. The link is: https://www.health.gov.au/our-work/consultation-on-specialist-affordability-and-access?language=en Please make sure to participate, as stories like yours are needed to be heard systemically as well.
The circumstances you have described reinforce why this work is so important. Hearing directly from families who have experienced significant financial pressure to access healthcare helps inform discussions about where improvements can be made.
In relation to compassionate release of superannuation, while Ali appreciates your concerns regarding the broader financial impact, and is well noted in your correspondence to all levels, Ali understands, however, that this does not address the wider concern you have raised about needing to access your retirement savings in the first place to obtain essential healthcare. Agreed, let us all work together to make sure health care is accessible to all, regardless of income.
Thank you again for taking the time to write and share your experience. Ali values hearing directly from constituents on these important issues and appreciates you bringing your perspective to her attention.
Kind regards,
Jill McKay
Chief of Staff
---
**Where the dollars actually go**
It is worth pausing here to consider the broader context. Health is one of the largest areas of government expenditure, and in recent federal budgets it has consistently accounted for around one hundred billion dollars or more in annual outlays. Australians pay the Medicare Levy of two per cent of taxable income on top of income tax, and many also pay the Medicare Levy Surcharge if they do not hold appropriate private health cover. Families like mine are paying into the system at a very high rate, and the expectation is that the system will be there when we need it. When the public system cannot provide timely care and the private system requires out-of-pocket costs that run into the thousands, the safety net has a hole in it, and the compassionate release of super is the only patch available for many families.
The interactions between the three systems can be summarised as follows. The health system, through wait times that are measured in years for non-emergency surgery, forces families towards the private system. The private system, through the gap and the lack of no-gap or known-gap participation by many specialists, generates significant out-of-pocket costs. The tax system, through the compassionate release provisions, allows access to super to cover those costs, but taxes the released amount as income. The Human Services system, through the income test for the Child Care Subsidy, then counts that same amount as income for the purposes of family assistance, reducing or removing the subsidy that helps families manage the cost of work and care. The result is that a family using the only mechanism available to them to address a failure of the health system is penalised across three separate portfolios, with no single minister willing to accept responsibility for the combined effect.
The Health Minister's office response is particularly striking. It sets out, in great detail, the rights of private patients, the role of informed financial consent, and the availability of the Medical Costs Finder. It does not address the fact that I had already done all of that research, signed the informed financial consent, and was writing specifically about the interaction between the systems, not about whether I had been informed of the costs. The response treats the correspondence as a complaint about the specialist or the private health insurer, when it was in fact a complaint about the interaction of government systems. The letter from the Treasurer's office is more substantive in its content, but the conclusion is the same: the current settings strike the right balance. The current settings, in my family's case, produced a worse outcome than if we had done nothing and waited two years for the public system, which would have been unacceptable on its own.
To the Human Services Minister, the lack of a response is telling. To the Health Minister's office, the canned response that ignores the actual substance of the correspondence is insulting. To the Treasurer's office, the letter that explains the policy but does not engage with the fact that the policy produces perverse outcomes is the most egregious of all.
This whole sorry saga belies a complete failure of all these systems to talk to each other. I am rapidly coming to the point where I have to ask what is the point of our "world class health system" when it thinks a better outcome is to stop a girl from playing sport, or force her parents to use a system that requires them to dig into their own pockets after paying into the system a rather massive amount via tax. If we had gone with the public system, I can guarantee you the co-morbidities it would have caused would have made it much more expensive down the road. The cost of the surgery, the lost tax revenue, the lost Child Care Subsidy, and the long-term cost to the health system of managing a preventable deterioration are all, in aggregate, likely to exceed the cost of simply funding the surgery in a timely manner in the first place. No one in the system seems to be looking at that aggregate.
Perhaps this public post will make it easier for the people working in these systems to understand that their part of the system is not the only piece. It is the interactions between them that need to be considered, and in this case the interactions between the Health, Tax, and Human Services systems mean that, in the end, I should have just gotten a loan, because it has cost me a huge and unexpected amount in tax and lost benefits.
I am not asking for special treatment. I am asking for the systems to be designed in a way that does not punish people for using them as intended. The compassionate release of super is meant to help people manage the cost of essential medical treatment. The Child Care Subsidy is meant to support families in the cost of work and care. The public health system is meant to provide timely care to those who cannot afford private care. When these systems operate in isolation, they produce outcomes that are technically correct within each portfolio but collectively absurd.
I encourage anyone who has experienced similar interactions between these systems to make a submission to the inquiry on specialist affordability and access. The link is in the introduction. The more stories the committee hears, the harder it is for the systems to continue operating in isolation.
I will not be pursuing the Administrative Review Tribunal further. The process, as designed, is not accessible to ordinary people, and that is a problem in itself. The only way I can see to effect change is to keep telling the story, keep writing to ministers, and keep pushing for the systems to be reformed so that the next family does not have to choose between their child's health and their financial stability.
Binary file not shown.

After

Width:  |  Height:  |  Size: 324 KiB

@@ -0,0 +1,309 @@
Title: PR Reviewer - A deployable AI reviewer for your Repos
Date: 2026-05-21 18:30
Modified: 2026-05-21 18:30
Category: DevOps
Tags: ai, code-review, automation, devops, open-source, ai_content, not_human_content
Slug: pr-reviewer-deployable-ai-reviewer
Authors: Andrew Ridgway... And Friends - glm-5.1.ai, nemotron-3-nano.ai, gemma4.ai, deepseek-v4-flash.ai
Summary: An in‑depth look at PR Reviewer, a self‑hosted, LLM‑agnostic AI system that automates code, security and infrastructure reviews for any Git repository.
---
## Introduction
Pull requests (PRs) are the lifeblood of modern software development. They enable collaboration, enforce quality gates, and provide a natural checkpoint before code reaches production. Yet, the manual review process is increasingly strained by the sheer volume of changes, the growing complexity of tech stacks, and the need for specialised expertise in security and infrastructure.
Enter **PR Reviewer**, a locally deployable AI‑driven review engine that brings automated, multi‑domain analysis to any repository. Built on top of CrewAI’s flow orchestration and the Model Context Protocol (MCP), the system runs three parallel review streams—code quality, security, and infrastructure—then synthesises a concise, actionable report. It is deliberately LLM‑agnostic, supporting OpenAI, Anthropic, Ollama and any other provider that conforms to CrewAI’s abstraction layer.
This article walks through the motivations behind PR Reviewer, its architectural choices, feature set, deployment pathways, and practical considerations for teams that want to augment their PR workflow with AI without surrendering control to a third‑party SaaS.
## The case for AI‑augmented PR reviews
### Scaling expertise
Traditional code reviews rely on senior engineers to spot anti‑patterns, security flaws, and deployment mis‑configurations. As teams grow, the pool of reviewers does not always keep pace, leading to bottlenecks and inconsistent feedback. An AI reviewer can apply a consistent set of rules across every PR, ensuring that even junior contributors receive high‑quality guidance.
### Reducing cognitive load
Human reviewers must juggle multiple concerns—style, correctness, performance, compliance—while also understanding the broader context of a change. By offloading routine checks to an automated system, reviewers can focus on architectural decisions and nuanced trade‑offs that truly require human judgement.
### Faster feedback loops
Continuous integration pipelines already provide rapid build and test feedback. Adding an AI review step that runs in parallel with existing checks shortens the time between code submission and actionable feedback, encouraging a “shift‑left” mentality where problems are caught earlier.
### Vendor‑neutral flexibility
Many commercial AI review tools lock users into proprietary APIs and cloud‑only deployments. PR Reviewer’s design deliberately avoids vendor lock‑in. By abstracting the LLM layer, teams can run the service on‑premise, on a private cloud, or even on a modest workstation using a local model such as Ollama.
## Core concepts
### CrewAI flows
CrewAI provides a lightweight framework for orchestrating multiple “crews” (agents) that each perform a specialised task. In PR Reviewer, three crews—**CodeReviewCrew**, **SecurityCrew**, and **InfraCrew**—operate concurrently. Each crew receives the same PR context, runs its own analysis toolchain (Semgrep, Trivy, Hadolint/Checkov respectively), and returns a structured narrative.
### Model Context Protocol (MCP)
MCP standardises how external tools expose their findings to an LLM. Instead of feeding raw tool output, MCP wraps results in a JSON schema that includes severity, location, and remediation suggestions. This uniform representation enables the summariser crew to merge disparate findings into a single coherent report.
### Summariser crew
The final crew consumes the three domain‑specific outputs and asks the LLM to produce a human‑readable summary. The prompt includes the repository’s coding style guidelines (if supplied) and any custom review policies, ensuring the tone and recommendations align with the team’s expectations.
## Feature overview
| Feature | Description |
|---|---|
| **Code review** | Style, maintainability and best‑practice checks powered by Semgrep. |
| **Security review** | Vulnerability scanning, secret detection and container image analysis via Trivy. |
| **Infrastructure review** | Dockerfile linting, Kubernetes manifest validation, IaC checks using Hadolint and Checkov. |
| **Summarisation** | Consolidated, actionable report generated by an LLM. |
| **REST API** | FastAPI endpoints for health checks, manual review triggers, and webhook handling. |
| **Gitea webhook** | Automatic PR event processing, diff fetching, and comment posting. |
| **Dockerised** | Multi‑stage build with all dependencies baked in. |
| **Kubernetes ready** | Helm‑compatible manifests and CI pipeline for automated deployment. |
| **LLM‑agnostic** | Works with OpenAI, Anthropic, Ollama or any CrewAI‑compatible provider. |
| **Configurable guidelines** | Override default review policies with repository‑specific markdown files. |
## Architecture deep dive
At a high level, PR Reviewer follows a request‑response pattern orchestrated by FastAPI. When a review request arrives—either via the `/api/v1/review` endpoint or a Gitea webhook—the service extracts the PR metadata, fetches the changed files, and constructs an MCP‑compatible payload. This payload is then dispatched to the three review crews in parallel.
```
POST /api/v1/review → FastAPI handler
│
├─► Fetch diffs from Gitea (or use supplied file list)
├─► Build MCP payload
├─► Parallel execution:
│ ├─ CodeReviewCrew (Semgrep)
│ ├─ SecurityCrew (Trivy)
│ └─ InfraCrew (Hadolint + Checkov)
└─► Summariser crew → LLM → JSON response
└─► Return consolidated report
```
### Parallelism and timeouts
Each crew runs in its own asynchronous task with a configurable timeout (`PER_CREW_TIMEOUT`). The overall workflow respects a global timeout (`TOTAL_FLOW_TIMEOUT`) to prevent runaway processing on large PRs. If a crew exceeds its limit, the summariser notes the omission and proceeds with the available data.
### Data flow and persistence
PR Reviewer is deliberately stateless. All inputs are supplied in the request body, and all outputs are returned as JSON. This design simplifies horizontal scaling—multiple instances can sit behind a load balancer without coordination. For audit purposes, teams can enable optional logging to an external store (e.g., Elasticsearch) via environment variables.
## Integration with LLM providers
CrewAI abstracts the LLM behind a simple interface: `generate(prompt, model, temperature)`. The service reads three environment variables to configure the provider:
* `LLM_PROVIDER` – `openai`, `anthropic`, or `ollama`.
* `LLM_MODEL` – model identifier (e.g., `gpt-4`, `claude-3-sonnet`, `gemma4:31b-cloud`).
* `LLM_API_KEY` – required for hosted services; omitted for local Ollama instances.
Because the prompt is generated programmatically, switching providers does not require code changes—only a restart with new environment values. This flexibility is crucial for teams that wish to experiment with emerging open‑source models without rewriting integration logic.
## Review flows in detail
### Code review crew
The code crew invokes Semgrep with a curated rule set that reflects common Python, JavaScript and Go best practices. Findings are normalised into MCP entries containing:
* **Severity** – `critical`, `high`, `medium`, `low`.
* **Location** – file path and line range.
* **Message** – concise description of the issue.
* **Remediation** – suggested code change or reference to documentation.
If a repository supplies a custom `code_review.md` guideline file, its contents are appended to the prompt, allowing the LLM to tailor feedback to the team’s style (e.g., preferring f‑strings over `%` formatting).
### Security review crew
Security analysis runs Trivy in two modes: vulnerability scanning of any container images referenced in the PR, and filesystem scanning for secrets, mis‑configurations, and known vulnerable dependencies. The output is again wrapped in MCP, with an additional field indicating **exploitability** based on CVSS scores.
### Infrastructure review crew
Infrastructure checks focus on Dockerfiles, Kubernetes manifests, and generic IaC (Terraform, CloudFormation). Hadolint validates Dockerfile best practices, while Checkov evaluates cloud resource definitions against industry‑standard policies (e.g., CIS benchmarks). The crew also respects any `infra_review.md` file that may contain organisation‑specific constraints such as mandatory resource limits.
### Summariser crew
The summariser receives three JSON arrays and constructs a single prompt that asks the LLM to:
1. Produce an executive summary of the overall health of the PR.
2. List the top‑5 findings across all domains, ordered by severity.
3. Provide actionable recommendations, grouped by domain.
4. Highlight any deviations from the repository’s own guidelines.
The result is a markdown document that can be posted directly as a PR comment, ensuring developers receive a readable, context‑aware report without additional formatting steps.
## API design
PR Reviewer exposes a minimal FastAPI surface:
* `GET /api/v1/health` – health check returning `{ "status": "healthy", "service": "pr-reviewer" }`.
* `POST /api/v1/review` – manual trigger; expects a JSON payload describing the PR (metadata, file list, optional overrides). Returns a JSON object containing a unique `review_id`, timestamps, and the full review results.
* `POST /api/v1/gitea-webhook` – endpoint for Gitea pull‑request events. Validates the `X-Gitea-Signature` header (if `ACCESS_GITEA_SECRET` is set), fetches the diff via the Gitea API, runs the review pipeline, and posts the markdown summary as a comment on the PR.
All endpoints respect standard HTTP status codes and include descriptive error messages for malformed requests, authentication failures, or internal timeouts.
## Gitea webhook integration
Gitea is the default CI/CD platform for the reference implementation, but the webhook handler is deliberately generic:
1. **Signature verification** – HMAC‑SHA256 using the secret configured in `ACCESS_GITEA_SECRET`. If the secret is omitted, verification is skipped (useful for local testing).
2. **Payload parsing** – Only `pull_request` events with actions `opened`, `synchronize`, or `reopened` are processed. Other events are ignored to reduce noise.
3. **Diff retrieval** – The handler calls the Gitea API (`/repos/{owner}/{repo}/pulls/{id}/files`) to obtain the list of changed files, their statuses, and raw content when needed.
4. **Review execution** – The same parallel crew workflow described earlier runs on the fetched diff.
5. **Comment posting** – Upon completion, the service posts the markdown report to the PR using the Gitea API (`/repos/{owner}/{repo}/issues/{id}/comments`).
### Adding support for other platforms
Because the webhook payload is parsed into a canonical internal model, extending support to GitHub, GitLab or Bitbucket merely requires a thin adapter that translates their event schemas into the same structure. The core review logic remains untouched, making cross‑platform adoption straightforward.
## Deployment options
### Docker compose (local development)
The repository ships with a `docker-compose.yaml` that defines two services:
* `pr-reviewer` – the FastAPI application.
* `ollama` (optional) – a local LLM server for offline use.
Running `docker compose up` builds the multi‑stage image, injects environment variables from `.env`, and exposes the API on `http://localhost:8000`.
### Kubernetes (production)
For production workloads, a Helm chart (or plain manifests in `kube/`) provides:
* A Deployment with configurable replica count.
* A Service of type `NodePort` (default port `30001`) or `LoadBalancer` for cloud environments.
* A Secret (`pr-reviewer-env`) that stores all `.env` values, including Gitea tokens and LLM credentials.
* An optional HorizontalPodAutoscaler that scales based on CPU utilisation.
The CI pipeline (`.gitea/workflows/build_push.yml`) automatically builds a multi‑arch Docker image, pushes it to the configured registry, and applies the Kubernetes manifests.
### Resource considerations
* **CPU** – The LLM inference dominates CPU usage. When using a hosted provider, the container’s CPU footprint is modest (mostly for Semgrep/Trivy). With a local model, allocate at least 4 vCPUs and 8 GB RAM.
* **Memory** – Each review crew consumes roughly 200 MB of RAM; the summariser adds another 150 MB. The total stays under 1 GB for typical PR sizes.
* **Storage** – The image size is ~1.2 GB (including all scanning tools). Persistent storage is not required unless audit logging is enabled.
## Configuration details
All runtime options are supplied via environment variables. The most important groups are:
| Variable | Required? | Description |
|---|---|---|
| `LLM_PROVIDER` | Yes | `openai`, `anthropic`, or `ollama`. |
| `LLM_MODEL` | Yes | Model identifier (e.g., `gpt-4`). |
| `LLM_API_KEY` | Conditional | API key for hosted providers. |
| `ACCESS_GITEA_URL` | Yes | Base URL of the Gitea instance. |
| `ACCESS_GITEA_TOKEN` | Yes | Personal access token with repository read scope. |
| `ACCESS_GITEA_SECRET` | No | Webhook secret for HMAC verification. |
| `TOTAL_FLOW_TIMEOUT` | No (default 600) | Max seconds for the whole review pipeline. |
| `PER_CREW_TIMEOUT` | No (default 300) | Max seconds per individual crew. |
| `LOG_LEVEL` | No (default `INFO`) | Python logging verbosity. |
Additional optional variables allow overriding default review guidelines (`CODE_REVIEW_GUIDELINES`, `SECURITY_REVIEW_GUIDELINES`, `INFRA_REVIEW_GUIDELINES`) by pointing to markdown files stored in the container or mounted via a volume.
## Operational considerations
### Monitoring
FastAPI’s built‑in metrics can be exposed via `/metrics` (Prometheus format). Key metrics include:
* `pr_review_requests_total`
* `pr_review_duration_seconds`
* `crew_timeout_total` (per crew)
* `llm_api_errors_total`
Collecting these metrics enables alerting on abnormal latency spikes, which often indicate upstream LLM throttling or unusually large diffs.
### Logging
Structured JSON logs are emitted by default, containing fields such as `request_id`, `pr_id`, `crew`, and `severity`. When integrated with a log aggregation platform (e.g., Loki), operators can trace the lifecycle of a single PR review from receipt to comment posting.
### Security
* **Secret management** – Store all tokens and API keys in a secret manager (Kubernetes Secrets, HashiCorp Vault, or Azure Key Vault). Never commit `.env` files to source control.
* **Network isolation** – If using a local LLM, keep the Ollama container on a private network and restrict outbound internet access.
* **Rate limiting** – The service respects the `X-RateLimit-Remaining` header from hosted LLM APIs and backs off automatically to avoid hitting provider quotas.
## Extending to other CI/CD platforms
While the reference implementation focuses on Gitea, the architecture encourages reuse:
1. **Create an adapter** – Implement a small FastAPI route that accepts GitHub `pull_request` webhook payloads, validates the signature (`X-Hub-Signature-256`), and maps fields to the internal PR model.
2. **Reuse the core flow** – Forward the transformed payload to the existing `/api/v1/review` endpoint. No changes to the review crews are required.
3. **Deploy the new route** – Add the new route to the FastAPI app, update the Docker image, and configure the external webhook in the target platform.
Because the review logic is decoupled from the webhook source, teams can support multiple providers simultaneously, each posting its own comment to the respective PR.
## Development workflow
Contributors who wish to enhance PR Reviewer can follow these steps:
```bash
# Clone the repository
git clone https://git.aridgwayweb.com/armistace/pr_reviewer.git
cd pr_reviewer
# Install development dependencies
uv pip install -e ".[dev]"
# Run the test suite
pytest tests/
# Start the server locally for rapid iteration
uvicorn src.pr_reviewer.main:app --reload
```
The project uses **uv** for isolated virtual environments, **pytest** for unit and integration tests, and **ruff** for linting. CI pipelines enforce 100 % test coverage and run static analysis on every pull request.
### Adding a new review tool
To incorporate an additional analysis tool (e.g., a custom static analyser), developers should:
1. Write a thin wrapper that converts the tool’s output into the MCP schema.
2. Register a new crew in `crews/` that invokes the wrapper.
3. Update the orchestration flow (`flow.py`) to include the new crew in the parallel execution block.
4. Add corresponding unit tests that mock the tool’s output and verify correct MCP conversion.
## Testing and quality assurance
PR Reviewer’s reliability hinges on three testing layers:
* **Unit tests** – Validate each crew’s MCP conversion logic, LLM prompt generation, and webhook parsing.
* **Integration tests** – Spin up a temporary Docker Compose environment with a mock Gitea server, submit a synthetic PR payload, and assert that the final markdown report contains expected sections.
* **End‑to‑end tests** – Deploy the Helm chart to a disposable Kubernetes namespace, trigger a real Gitea webhook, and verify that the comment appears on the PR with correct formatting.
All tests run in CI on every push, and failures block merges.
## Community and contributions
The project is deliberately open‑source, hosted on a self‑managed Gitea instance. Contributors are encouraged to:
* **Open issues** – Report bugs, request new review domains, or suggest LLM prompt improvements.
* **Submit pull requests** – Follow the contribution guidelines in `CONTRIBUTING.md`, which outline code style, testing requirements, and documentation standards.
* **Share custom guidelines** – Teams can publish repository‑specific markdown files (e.g., `code_review.md`) that the summariser will automatically honour.
Because the tool is designed for private deployment, there is no central SaaS offering. Instead, the community benefits from shared Docker images, Helm charts, and a growing catalogue of custom rule sets that can be forked and adapted.
## Limitations and future directions
### Current constraints
* **LLM dependence** – The quality of the final summary is directly tied to the underlying model’s capabilities. Low‑capacity models may produce vague recommendations.
* **Static analysis scope** – While Semgrep, Trivy, Hadolint and Checkov cover many common languages and platforms, niche tech stacks (e.g., Rust, Terraform Cloud) require additional adapters.
* **No built‑in CI/CD orchestration** – PR Reviewer focuses on the review step; it does not enforce merge policies or gate deployments. Teams must integrate the API into their existing pipelines.
### Planned enhancements
1. **Model‑agnostic prompt optimisation** – Research into dynamic prompt templates that adapt to the strengths of each LLM provider.
2. **Feedback loop** – Capture developer reactions to the AI suggestions (e.g., thumbs up/down) and use them to fine‑tune future prompts.
3. **Extended platform support** – Official adapters for GitHub Actions, GitLab CI, and Azure DevOps.
4. **Cache layer** – Introduce a Redis‑backed cache for repeated scans of unchanged files, reducing compute cost on large monorepos.
5. **Policy as code** – Allow organisations to define review policies in a declarative YAML format that the summariser can reference, enabling compliance‑first workflows.
## Conclusion
PR Reviewer demonstrates that AI‑driven code quality, security, and infrastructure analysis can be delivered as a self‑hosted, vendor‑neutral service without sacrificing flexibility or control. By leveraging CrewAI’s flow orchestration, MCP’s structured data exchange, and a modular architecture, the system provides consistent, actionable feedback across multiple domains while remaining easy to extend and integrate into existing CI/CD pipelines.
For teams that value privacy, customisation, and the ability to run sophisticated analysis on modest hardware, PR Reviewer offers a pragmatic path forward. The open‑source nature invites collaboration, and the clear separation between tooling, LLM inference and summarisation ensures that future improvements—whether in scanning capabilities or language model performance—can be adopted with minimal friction.
Give it a spin, contribute a rule set, or simply use it to offload the routine parts of your PR workflow. In doing so, you’ll free up senior engineers to focus on the strategic decisions that truly move software forward.
+1 -1
View File
@@ -6,7 +6,7 @@ SITENAME = "Andrew Ridgway's Blog"
SITEURL = 'https://blog.aridgwayweb.com'
THEME = 'themes/cleanblog'
PATH = 'content'
HEADER_COVER = 'https://wallpaperaccess.com/full/3239444.jpg'
HEADER_COVER = 'https://blog.aridgwayweb.com/images/Tech-Desktop-Wallpaper-35697.jpg'
TIMEZONE = 'Australia/Brisbane'
COLOR_SCHEME_CSS = 'tomorrow.css'
DEFAULT_LANG = 'en'
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 MiB

+1 -1
View File
@@ -33,7 +33,7 @@
{% if article.header_cover %}
<header class="intro-header" style="background-image: url('{{ article.header_cover }}')">
{% else %}
<header class="intro-header" style="background-image: url('{{ SITEURL }}/{{ THEME_STATIC_DIR }}/images/post-bg.jpg')">
<header class="intro-header" style="background-image: url('{{ SITEURL }}/{{ THEME_STATIC_DIR }}/images/post-bg.png')">
{% endif %}
<div class="container">
<div class="row">