cirdanops 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. cirdanops-0.1.0/.gitignore +7 -0
  2. cirdanops-0.1.0/AGENTS.md +28 -0
  3. cirdanops-0.1.0/Dockerfile +20 -0
  4. cirdanops-0.1.0/LICENSE +201 -0
  5. cirdanops-0.1.0/PKG-INFO +379 -0
  6. cirdanops-0.1.0/README.md +135 -0
  7. cirdanops-0.1.0/SECURITY.md +33 -0
  8. cirdanops-0.1.0/cirdan/__init__.py +3 -0
  9. cirdanops-0.1.0/cirdan/access/__init__.py +3 -0
  10. cirdanops-0.1.0/cirdan/access/context.py +221 -0
  11. cirdanops-0.1.0/cirdan/access/redaction.py +56 -0
  12. cirdanops-0.1.0/cirdan/actions/__init__.py +3 -0
  13. cirdanops-0.1.0/cirdan/actions/executor.py +165 -0
  14. cirdanops-0.1.0/cirdan/adapters/__init__.py +3 -0
  15. cirdanops-0.1.0/cirdan/adapters/aws.py +141 -0
  16. cirdanops-0.1.0/cirdan/adapters/base.py +127 -0
  17. cirdanops-0.1.0/cirdan/adapters/common.py +133 -0
  18. cirdanops-0.1.0/cirdan/adapters/docker.py +221 -0
  19. cirdanops-0.1.0/cirdan/adapters/docker_compose.py +124 -0
  20. cirdanops-0.1.0/cirdan/adapters/github_actions.py +76 -0
  21. cirdanops-0.1.0/cirdan/adapters/helm.py +84 -0
  22. cirdanops-0.1.0/cirdan/adapters/k8s_manifests.py +182 -0
  23. cirdanops-0.1.0/cirdan/adapters/kubernetes.py +374 -0
  24. cirdanops-0.1.0/cirdan/adapters/local_files.py +47 -0
  25. cirdanops-0.1.0/cirdan/adapters/nginx.py +69 -0
  26. cirdanops-0.1.0/cirdan/adapters/prometheus.py +70 -0
  27. cirdanops-0.1.0/cirdan/adapters/registry.py +69 -0
  28. cirdanops-0.1.0/cirdan/adapters/sql_schema.py +54 -0
  29. cirdanops-0.1.0/cirdan/adapters/systemd.py +87 -0
  30. cirdanops-0.1.0/cirdan/adapters/systemd_units.py +54 -0
  31. cirdanops-0.1.0/cirdan/adapters/terraform.py +161 -0
  32. cirdanops-0.1.0/cirdan/agents/__init__.py +3 -0
  33. cirdanops-0.1.0/cirdan/agents/installer.py +156 -0
  34. cirdanops-0.1.0/cirdan/api/__init__.py +0 -0
  35. cirdanops-0.1.0/cirdan/api/http.py +197 -0
  36. cirdanops-0.1.0/cirdan/audit.py +37 -0
  37. cirdanops-0.1.0/cirdan/cli/__init__.py +0 -0
  38. cirdanops-0.1.0/cirdan/cli/main.py +418 -0
  39. cirdanops-0.1.0/cirdan/config.py +102 -0
  40. cirdanops-0.1.0/cirdan/daemon/__init__.py +3 -0
  41. cirdanops-0.1.0/cirdan/daemon/server.py +132 -0
  42. cirdanops-0.1.0/cirdan/engine.py +323 -0
  43. cirdanops-0.1.0/cirdan/fingerprint/__init__.py +3 -0
  44. cirdanops-0.1.0/cirdan/fingerprint/engine.py +141 -0
  45. cirdanops-0.1.0/cirdan/graph/__init__.py +21 -0
  46. cirdanops-0.1.0/cirdan/graph/builder.py +98 -0
  47. cirdanops-0.1.0/cirdan/graph/diff.py +97 -0
  48. cirdanops-0.1.0/cirdan/graph/export.py +101 -0
  49. cirdanops-0.1.0/cirdan/graph/queries.py +144 -0
  50. cirdanops-0.1.0/cirdan/graph/schema.py +169 -0
  51. cirdanops-0.1.0/cirdan/graph/store.py +359 -0
  52. cirdanops-0.1.0/cirdan/incidents/__init__.py +4 -0
  53. cirdanops-0.1.0/cirdan/incidents/detector.py +131 -0
  54. cirdanops-0.1.0/cirdan/incidents/reports.py +82 -0
  55. cirdanops-0.1.0/cirdan/incidents/store.py +90 -0
  56. cirdanops-0.1.0/cirdan/mcp/__init__.py +0 -0
  57. cirdanops-0.1.0/cirdan/mcp/server.py +256 -0
  58. cirdanops-0.1.0/cirdan/query.py +178 -0
  59. cirdanops-0.1.0/cirdan/reports/__init__.py +3 -0
  60. cirdanops-0.1.0/cirdan/reports/infra_report.py +130 -0
  61. cirdanops-0.1.0/cirdan/telemetry/__init__.py +4 -0
  62. cirdanops-0.1.0/cirdan/telemetry/clusters.py +69 -0
  63. cirdanops-0.1.0/cirdan/telemetry/events.py +148 -0
  64. cirdanops-0.1.0/cirdan/ui/__init__.py +4 -0
  65. cirdanops-0.1.0/cirdan/ui/render.py +109 -0
  66. cirdanops-0.1.0/cirdan/ui/router.py +232 -0
  67. cirdanops-0.1.0/cirdan/ui/templates/view.html.j2 +218 -0
  68. cirdanops-0.1.0/cirdan/ui/view_spec.py +67 -0
  69. cirdanops-0.1.0/cirdan/util.py +80 -0
  70. cirdanops-0.1.0/cirdan/verify/__init__.py +3 -0
  71. cirdanops-0.1.0/cirdan/verify/checks.py +95 -0
  72. cirdanops-0.1.0/cirdan.yaml.example +34 -0
  73. cirdanops-0.1.0/docker-compose.yml +14 -0
  74. cirdanops-0.1.0/pyproject.toml +60 -0
  75. cirdanops-0.1.0/tests/conftest.py +38 -0
  76. cirdanops-0.1.0/tests/fixtures/fake-bin/docker +47 -0
  77. cirdanops-0.1.0/tests/fixtures/fake-bin/kubectl +54 -0
  78. cirdanops-0.1.0/tests/fixtures/repos/compose-app/.github/workflows/ci.yml +11 -0
  79. cirdanops-0.1.0/tests/fixtures/repos/compose-app/Dockerfile +3 -0
  80. cirdanops-0.1.0/tests/fixtures/repos/compose-app/README.md +3 -0
  81. cirdanops-0.1.0/tests/fixtures/repos/compose-app/docker-compose.yml +22 -0
  82. cirdanops-0.1.0/tests/fixtures/repos/compose-app/schema.sql +2 -0
  83. cirdanops-0.1.0/tests/fixtures/repos/k8s-aws-app/charts/myapp/Chart.yaml +7 -0
  84. cirdanops-0.1.0/tests/fixtures/repos/k8s-aws-app/k8s/checkout.yaml +49 -0
  85. cirdanops-0.1.0/tests/fixtures/repos/k8s-aws-app/main.tf +16 -0
  86. cirdanops-0.1.0/tests/test_actions.py +83 -0
  87. cirdanops-0.1.0/tests/test_api.py +79 -0
  88. cirdanops-0.1.0/tests/test_daemon.py +69 -0
  89. cirdanops-0.1.0/tests/test_fingerprint.py +33 -0
  90. cirdanops-0.1.0/tests/test_graph.py +88 -0
  91. cirdanops-0.1.0/tests/test_incidents.py +109 -0
  92. cirdanops-0.1.0/tests/test_installer.py +46 -0
  93. cirdanops-0.1.0/tests/test_live_adapters.py +121 -0
  94. cirdanops-0.1.0/tests/test_mcp.py +74 -0
  95. cirdanops-0.1.0/tests/test_query_and_views.py +88 -0
  96. cirdanops-0.1.0/tests/test_redaction.py +25 -0
  97. cirdanops-0.1.0/tests/test_static_adapters.py +80 -0
@@ -0,0 +1,7 @@
1
+ .venv/
2
+ __pycache__/
3
+ *.egg-info/
4
+ cirdan-out/
5
+ .pytest_cache/
6
+ dist/
7
+ build/
@@ -0,0 +1,28 @@
1
+ # Working on Cirdan
2
+
3
+ Cirdan is a Python package (`cirdanops`) providing the `cirdan` CLI and `cirdand` daemon. It maps, watches, and operates live infrastructure on behalf of AI agents.
4
+
5
+ ## Setup
6
+
7
+ ```bash
8
+ python3 -m venv --without-pip .venv # ensurepip may be unavailable on Debian/Ubuntu
9
+ python3 -m pip --python .venv/bin/python install -e ".[all,dev]"
10
+ .venv/bin/python -m pytest tests/ -q
11
+ ```
12
+
13
+ ## Architecture in one paragraph
14
+
15
+ `cirdan.engine.CirdanEngine` is the single wiring point used by the CLI (`cirdan/cli/main.py`), MCP server (`cirdan/mcp/server.py`), HTTP API (`cirdan/api/http.py`), and daemon (`cirdan/daemon/server.py`). It owns config, the access context (a probed *mirror* of what the session can do — `cirdan/access/`), the SQLite graph store (`cirdan/graph/store.py`, one file holding nodes/edges/events/incidents/actions), and the audit log. Adapters (`cirdan/adapters/`) implement one interface (`base.py`): static adapters parse repo files into the declared graph; live adapters shell out to CLIs (`docker`, `kubectl`, `aws`, `systemctl`) to build the observed graph, stream events, collect logs, and expose actions. The builder merges both by stable node ids (`service:<name>`), `graph/diff.py` computes drift, `incidents/` turns drift + clustered error events into lifecycle-managed incidents, `actions/` + `verify/` execute and verify operations, and `ui/` renders ViewSpecs to HTML/Markdown/terminal.
16
+
17
+ ## Rules
18
+
19
+ - **Every graph claim carries evidence and a confidence label** (`EXTRACTED`/`INFERRED`/`AMBIGUOUS`/`UNKNOWN`). New adapters must populate both.
20
+ - **Inherited access only.** Adapters must never embed credentials or escalate; availability is gated on the probed `AccessContext`.
21
+ - **Everything written to `cirdan-out/` goes through `cirdan/access/redaction.py`.**
22
+ - **Subprocess calls use `cirdan.util.run_cmd` with a timeout** so discovery never hangs in restricted sandboxes.
23
+ - Live-adapter tests use the canned CLIs in `tests/fixtures/fake-bin/` (prepended to PATH); never require real infrastructure in unit tests.
24
+ - New CLI commands import their dependencies inside the function body to keep startup fast.
25
+
26
+ ## Tests
27
+
28
+ `pytest` with fixtures in `tests/conftest.py` (`compose_app`, `k8s_aws_app` repo fixtures, `make_access` capability factory). The daemon and MCP tests are async (`asyncio_mode=auto`).
@@ -0,0 +1,20 @@
1
+ FROM python:3.12-slim
2
+
3
+ # CLIs Cirdan can drive if the container is given access (docker socket, kubeconfig).
4
+ RUN apt-get update && apt-get install -y --no-install-recommends \
5
+ curl ca-certificates docker.io \
6
+ && curl -fsSLo /usr/local/bin/kubectl \
7
+ "https://dl.k8s.io/release/v1.30.0/bin/linux/$(dpkg --print-architecture)/kubectl" \
8
+ && chmod +x /usr/local/bin/kubectl \
9
+ && apt-get clean && rm -rf /var/lib/apt/lists/*
10
+
11
+ WORKDIR /opt/cirdan
12
+ COPY . .
13
+ RUN pip install --no-cache-dir ".[all]"
14
+
15
+ WORKDIR /workspace
16
+ VOLUME ["/workspace"]
17
+ EXPOSE 8090
18
+
19
+ ENTRYPOINT ["cirdand"]
20
+ CMD ["serve", "/workspace", "--http", "--mcp", "--host", "0.0.0.0", "--port", "8090"]
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,379 @@
1
+ Metadata-Version: 2.4
2
+ Name: cirdanops
3
+ Version: 0.1.0
4
+ Summary: Cirdan: AI infrastructure cartographer and operations daemon. Graphify for live infrastructure.
5
+ Project-URL: Homepage, https://github.com/adanb13/cirdan
6
+ Project-URL: Repository, https://github.com/adanb13/cirdan
7
+ Project-URL: Issues, https://github.com/adanb13/cirdan/issues
8
+ Author: Cirdan contributors
9
+ License: Apache License
10
+ Version 2.0, January 2004
11
+ http://www.apache.org/licenses/
12
+
13
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
14
+
15
+ 1. Definitions.
16
+
17
+ "License" shall mean the terms and conditions for use, reproduction,
18
+ and distribution as defined by Sections 1 through 9 of this document.
19
+
20
+ "Licensor" shall mean the copyright owner or entity authorized by
21
+ the copyright owner that is granting the License.
22
+
23
+ "Legal Entity" shall mean the union of the acting entity and all
24
+ other entities that control, are controlled by, or are under common
25
+ control with that entity. For the purposes of this definition,
26
+ "control" means (i) the power, direct or indirect, to cause the
27
+ direction or management of such entity, whether by contract or
28
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
29
+ outstanding shares, or (iii) beneficial ownership of such entity.
30
+
31
+ "You" (or "Your") shall mean an individual or Legal Entity
32
+ exercising permissions granted by this License.
33
+
34
+ "Source" form shall mean the preferred form for making modifications,
35
+ including but not limited to software source code, documentation
36
+ source, and configuration files.
37
+
38
+ "Object" form shall mean any form resulting from mechanical
39
+ transformation or translation of a Source form, including but
40
+ not limited to compiled object code, generated documentation,
41
+ and conversions to other media types.
42
+
43
+ "Work" shall mean the work of authorship, whether in Source or
44
+ Object form, made available under the License, as indicated by a
45
+ copyright notice that is included in or attached to the work
46
+ (an example is provided in the Appendix below).
47
+
48
+ "Derivative Works" shall mean any work, whether in Source or Object
49
+ form, that is based on (or derived from) the Work and for which the
50
+ editorial revisions, annotations, elaborations, or other modifications
51
+ represent, as a whole, an original work of authorship. For the purposes
52
+ of this License, Derivative Works shall not include works that remain
53
+ separable from, or merely link (or bind by name) to the interfaces of,
54
+ the Work and Derivative Works thereof.
55
+
56
+ "Contribution" shall mean any work of authorship, including
57
+ the original version of the Work and any modifications or additions
58
+ to that Work or Derivative Works thereof, that is intentionally
59
+ submitted to Licensor for inclusion in the Work by the copyright owner
60
+ or by an individual or Legal Entity authorized to submit on behalf of
61
+ the copyright owner. For the purposes of this definition, "submitted"
62
+ means any form of electronic, verbal, or written communication sent
63
+ to the Licensor or its representatives, including but not limited to
64
+ communication on electronic mailing lists, source code control systems,
65
+ and issue tracking systems that are managed by, or on behalf of, the
66
+ Licensor for the purpose of discussing and improving the Work, but
67
+ excluding communication that is conspicuously marked or otherwise
68
+ designated in writing by the copyright owner as "Not a Contribution."
69
+
70
+ "Contributor" shall mean Licensor and any individual or Legal Entity
71
+ on behalf of whom a Contribution has been received by Licensor and
72
+ subsequently incorporated within the Work.
73
+
74
+ 2. Grant of Copyright License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ copyright license to reproduce, prepare Derivative Works of,
78
+ publicly display, publicly perform, sublicense, and distribute the
79
+ Work and such Derivative Works in Source or Object form.
80
+
81
+ 3. Grant of Patent License. Subject to the terms and conditions of
82
+ this License, each Contributor hereby grants to You a perpetual,
83
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
84
+ (except as stated in this section) patent license to make, have made,
85
+ use, offer to sell, sell, import, and otherwise transfer the Work,
86
+ where such license applies only to those patent claims licensable
87
+ by such Contributor that are necessarily infringed by their
88
+ Contribution(s) alone or by combination of their Contribution(s)
89
+ with the Work to which such Contribution(s) was submitted. If You
90
+ institute patent litigation against any entity (including a
91
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
92
+ or a Contribution incorporated within the Work constitutes direct
93
+ or contributory patent infringement, then any patent licenses
94
+ granted to You under this License for that Work shall terminate
95
+ as of the date such litigation is filed.
96
+
97
+ 4. Redistribution. You may reproduce and distribute copies of the
98
+ Work or Derivative Works thereof in any medium, with or without
99
+ modifications, and in Source or Object form, provided that You
100
+ meet the following conditions:
101
+
102
+ (a) You must give any other recipients of the Work or
103
+ Derivative Works a copy of this License; and
104
+
105
+ (b) You must cause any modified files to carry prominent notices
106
+ stating that You changed the files; and
107
+
108
+ (c) You must retain, in the Source form of any Derivative Works
109
+ that You distribute, all copyright, patent, trademark, and
110
+ attribution notices from the Source form of the Work,
111
+ excluding those notices that do not pertain to any part of
112
+ the Derivative Works; and
113
+
114
+ (d) If the Work includes a "NOTICE" text file as part of its
115
+ distribution, then any Derivative Works that You distribute must
116
+ include a readable copy of the attribution notices contained
117
+ within such NOTICE file, excluding those notices that do not
118
+ pertain to any part of the Derivative Works, in at least one
119
+ of the following places: within a NOTICE text file distributed
120
+ as part of the Derivative Works; within the Source form or
121
+ documentation, if provided along with the Derivative Works; or,
122
+ within a display generated by the Derivative Works, if and
123
+ wherever such third-party notices normally appear. The contents
124
+ of the NOTICE file are for informational purposes only and
125
+ do not modify the License. You may add Your own attribution
126
+ notices within Derivative Works that You distribute, alongside
127
+ or as an addendum to the NOTICE text from the Work, provided
128
+ that such additional attribution notices cannot be construed
129
+ as modifying the License.
130
+
131
+ You may add Your own copyright statement to Your modifications and
132
+ may provide additional or different license terms and conditions
133
+ for use, reproduction, or distribution of Your modifications, or
134
+ for any such Derivative Works as a whole, provided Your use,
135
+ reproduction, and distribution of the Work otherwise complies with
136
+ the conditions stated in this License.
137
+
138
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
139
+ any Contribution intentionally submitted for inclusion in the Work
140
+ by You to the Licensor shall be under the terms and conditions of
141
+ this License, without any additional terms or conditions.
142
+ Notwithstanding the above, nothing herein shall supersede or modify
143
+ the terms of any separate license agreement you may have executed
144
+ with Licensor regarding such Contributions.
145
+
146
+ 6. Trademarks. This License does not grant permission to use the trade
147
+ names, trademarks, service marks, or product names of the Licensor,
148
+ except as required for reasonable and customary use in describing the
149
+ origin of the Work and reproducing the content of the NOTICE file.
150
+
151
+ 7. Disclaimer of Warranty. Unless required by applicable law or
152
+ agreed to in writing, Licensor provides the Work (and each
153
+ Contributor provides its Contributions) on an "AS IS" BASIS,
154
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
155
+ implied, including, without limitation, any warranties or conditions
156
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
157
+ PARTICULAR PURPOSE. You are solely responsible for determining the
158
+ appropriateness of using or redistributing the Work and assume any
159
+ risks associated with Your exercise of permissions under this License.
160
+
161
+ 8. Limitation of Liability. In no event and under no legal theory,
162
+ whether in tort (including negligence), contract, or otherwise,
163
+ unless required by applicable law (such as deliberate and grossly
164
+ negligent acts) or agreed to in writing, shall any Contributor be
165
+ liable to You for damages, including any direct, indirect, special,
166
+ incidental, or consequential damages of any character arising as a
167
+ result of this License or out of the use or inability to use the
168
+ Work (including but not limited to damages for loss of goodwill,
169
+ work stoppage, computer failure or malfunction, or any and all
170
+ other commercial damages or losses), even if such Contributor
171
+ has been advised of the possibility of such damages.
172
+
173
+ 9. Accepting Warranty or Additional Liability. While redistributing
174
+ the Work or Derivative Works thereof, You may choose to offer,
175
+ and charge a fee for, acceptance of support, warranty, indemnity,
176
+ or other liability obligations and/or rights consistent with this
177
+ License. However, in accepting such obligations, You may act only
178
+ on Your own behalf and on Your sole responsibility, not on behalf
179
+ of any other Contributor, and only if You agree to indemnify,
180
+ defend, and hold each Contributor harmless for any liability
181
+ incurred by, or claims asserted against, such Contributor by reason
182
+ of your accepting any such warranty or additional liability.
183
+
184
+ END OF TERMS AND CONDITIONS
185
+
186
+ APPENDIX: How to apply the Apache License to your work.
187
+
188
+ To apply the Apache License to your work, attach the following
189
+ boilerplate notice, with the fields enclosed by brackets "[]"
190
+ replaced with your own identifying information. (Don't include
191
+ the brackets!) The text should be enclosed in the appropriate
192
+ comment syntax for the file format. We also recommend that a
193
+ file or class name and description of purpose be included on the
194
+ same "printed page" as the copyright notice for easier
195
+ identification within third-party archives.
196
+
197
+ Copyright [yyyy] [name of copyright owner]
198
+
199
+ Licensed under the Apache License, Version 2.0 (the "License");
200
+ you may not use this file except in compliance with the License.
201
+ You may obtain a copy of the License at
202
+
203
+ http://www.apache.org/licenses/LICENSE-2.0
204
+
205
+ Unless required by applicable law or agreed to in writing, software
206
+ distributed under the License is distributed on an "AS IS" BASIS,
207
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
208
+ See the License for the specific language governing permissions and
209
+ limitations under the License.
210
+ License-File: LICENSE
211
+ Keywords: agents,ai,graph,infrastructure,mcp,observability,ops
212
+ Classifier: Development Status :: 3 - Alpha
213
+ Classifier: Intended Audience :: Developers
214
+ Classifier: Intended Audience :: System Administrators
215
+ Classifier: License :: OSI Approved :: Apache Software License
216
+ Classifier: Programming Language :: Python :: 3.11
217
+ Classifier: Programming Language :: Python :: 3.12
218
+ Classifier: Topic :: System :: Monitoring
219
+ Classifier: Topic :: System :: Systems Administration
220
+ Requires-Python: >=3.11
221
+ Requires-Dist: httpx>=0.27
222
+ Requires-Dist: jinja2>=3.1
223
+ Requires-Dist: networkx>=3.1
224
+ Requires-Dist: pydantic>=2.5
225
+ Requires-Dist: pyyaml>=6.0
226
+ Requires-Dist: rich>=13.0
227
+ Requires-Dist: typer>=0.12
228
+ Provides-Extra: all
229
+ Requires-Dist: fastapi>=0.110; extra == 'all'
230
+ Requires-Dist: mcp>=1.2; extra == 'all'
231
+ Requires-Dist: python-hcl2>=4.3; extra == 'all'
232
+ Requires-Dist: uvicorn>=0.29; extra == 'all'
233
+ Provides-Extra: api
234
+ Requires-Dist: fastapi>=0.110; extra == 'api'
235
+ Requires-Dist: uvicorn>=0.29; extra == 'api'
236
+ Provides-Extra: dev
237
+ Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
238
+ Requires-Dist: pytest>=8.0; extra == 'dev'
239
+ Provides-Extra: mcp
240
+ Requires-Dist: mcp>=1.2; extra == 'mcp'
241
+ Provides-Extra: terraform
242
+ Requires-Dist: python-hcl2>=4.3; extra == 'terraform'
243
+ Description-Content-Type: text/markdown
244
+
245
+ # Cirdan
246
+
247
+ **Cirdan is a standalone AI infrastructure cartographer and operations daemon — Graphify for live infrastructure.**
248
+
249
+ It installs into AI agents like a skill, but instead of graphing only code, it fingerprints and graphs the live infrastructure the agent can access: Docker, Kubernetes, cloud accounts, IaC, databases, telemetry. It watches that graph continuously, detects incidents, and gives agents (and humans) a structured way to understand and operate the system.
250
+
251
+ ```
252
+ Cirdan fingerprints the system.
253
+ Cirdan graphs the system.
254
+ Cirdan watches the system.
255
+ Cirdan lets the agent operate inside the system using the access the agent already has.
256
+ Cirdan generates views only when the human asks to see something.
257
+ ```
258
+
259
+ ## Install
260
+
261
+ ```bash
262
+ uv tool install "cirdanops[all]"
263
+ # or
264
+ pipx install "cirdanops[all]"
265
+ pip install "cirdanops[all]"
266
+ ```
267
+
268
+ Targeted installs: `cirdanops[mcp]`, `cirdanops[api]`, `cirdanops[terraform]`, or combinations like `cirdanops[terraform,mcp]`. The Docker/Kubernetes/AWS/systemd adapters need no extras — they use the CLIs already on your PATH.
269
+
270
+ Two commands are installed:
271
+
272
+ | Command | What it is |
273
+ |---|---|
274
+ | `cirdan` | Human/agent CLI |
275
+ | `cirdand` | Long-running Always ON daemon |
276
+
277
+ ## First map
278
+
279
+ ```bash
280
+ cirdan map .
281
+ ```
282
+
283
+ This fingerprints the environment (repo files **and** live runtimes the session can reach), builds the graph, and writes:
284
+
285
+ ```
286
+ cirdan-out/
287
+ ├── infra.html # interactive infrastructure map
288
+ ├── INFRA_REPORT.md # plain-English report
289
+ ├── infra.graph.json # machine-readable graph for agents
290
+ ├── fingerprint.json # evidence-backed environment classification
291
+ ├── access.json # what this session can currently reach
292
+ ├── services.json
293
+ ├── dependencies.json
294
+ ├── runtime-state.json
295
+ ├── incidents/ # active.json + history.jsonl
296
+ ├── views/generated/ # on-demand Agentic UI views
297
+ └── audit.jsonl # everything Cirdan observed, generated, executed, verified
298
+ ```
299
+
300
+ ## The access model
301
+
302
+ **Cirdan inherits the agent's execution context.** It is not a permission manager; it is a mirror. If the session can read the repo, run shell, reach `/var/run/docker.sock`, use `kubectl`, or call AWS — Cirdan can use the same context, and nothing more. Run `cirdan access .` to see the live capability report.
303
+
304
+ ## Commands
305
+
306
+ ```bash
307
+ cirdan map . # full pipeline: fingerprint → graph → artifacts
308
+ cirdan fingerprint . # what is this system? (with confidence + evidence)
309
+ cirdan access . # capability mirror for the current session
310
+ cirdan query "what depends on postgres?"
311
+ cirdan query "what broke in the last hour?"
312
+ cirdan query "what can the agent do here?"
313
+ cirdan show "show me the infrastructure map"
314
+ cirdan show "show checkout-api as a dependency graph"
315
+ cirdan show "show last night's incidents as a timeline"
316
+ cirdan incidents # detection pass + list
317
+ cirdan explain <incident-id|node> # evidence-backed explanation
318
+ cirdan actions list <node> # what can be done with current access
319
+ cirdan actions run <action-id> --yes
320
+ cirdan verify <act-record-id> # did the system actually recover?
321
+ cirdan watch . # foreground event stream
322
+ cirdan serve-mcp # MCP server over stdio
323
+ cirdan install --project # teach agents in this repo to use Cirdan
324
+ ```
325
+
326
+ ## Always ON
327
+
328
+ ```bash
329
+ cirdand serve # watch, refresh, detect, export — forever
330
+ cirdand serve --mcp # + MCP (stdio)
331
+ cirdand serve --http --mcp --host 0.0.0.0 --port 8090 # shared team server
332
+ ```
333
+
334
+ The daemon runs supervised loops: access refresh, fingerprint refresh, graph refresh, Docker/Kubernetes event watching, telemetry ingestion, incident detection, verification, and artifact export. A crashing loop logs and restarts; it never takes the daemon down.
335
+
336
+ ## Agent integration
337
+
338
+ ```bash
339
+ cirdan install --project # all platforms, into this repo
340
+ cirdan install --platform claude # .claude/skills/cirdan/SKILL.md + CLAUDE.md + .mcp.json
341
+ cirdan install --platform codex # AGENTS.md + .codex/cirdan.md
342
+ cirdan install --platform cursor # .cursor/rules/cirdan.mdc + .cursor/mcp.json
343
+ cirdan install --platform gemini # GEMINI.md
344
+ cirdan install --platform generic # .agents/skills/cirdan/SKILL.md + AGENTS.md
345
+ ```
346
+
347
+ Installs are idempotent and never touch content outside Cirdan's own marker block. MCP tools include `query_infra_graph`, `get_node`, `get_neighbors`, `shortest_path`, `get_recent_errors`, `get_logs`, `get_state`, `list_incidents`, `explain_incident`, `list_available_actions`, `execute_action`, `verify_action`, `generate_view`, and more.
348
+
349
+ ## The graph
350
+
351
+ Every node and edge carries **evidence** and a **confidence label** (`EXTRACTED`, `INFERRED`, `AMBIGUOUS`, `UNKNOWN`):
352
+
353
+ ```json
354
+ {
355
+ "source": "service:checkout-api",
356
+ "target": "database:postgres-prod",
357
+ "relation": "CONNECTS_TO",
358
+ "confidence": "INFERRED",
359
+ "evidence": ["DATABASE_URL references postgres://postgres-prod… in k8s/checkout.yaml"]
360
+ }
361
+ ```
362
+
363
+ Cirdan maintains a **static graph** (what the repo says should exist: Compose, Kubernetes YAML, Terraform/OpenTofu, Helm, CI, SQL, nginx, systemd units) and a **live graph** (what actually exists: Docker Engine, Kubernetes API, AWS, systemd, Prometheus), merges them, and reports drift — declared-but-not-running, running-but-undeclared, degraded capacity, unhealthy state.
364
+
365
+ ## Actions and verification
366
+
367
+ Cirdan detects which operations are *technically possible* with the session's access (`docker restart`, `kubectl rollout restart`, `systemctl restart`, …), exposes them as graph-attached capabilities, executes only through the session's own tools, records pre/post state in the audit trail, and verifies the outcome (workload ready, health checks passing, error clusters quiet). There is no separate credential store and no privilege escalation.
368
+
369
+ ## HTTP API
370
+
371
+ With the `[api]` extra, `cirdand serve --http` exposes `/health`, `/fingerprint`, `/graph`, `/graph/query`, `/services`, `/incidents`, `/actions`, `/views/generate`, `/audit`, and a minimal OTLP/HTTP JSON receiver at `/v1/logs`. Add `--mcp` to mount the MCP server at `/mcp`.
372
+
373
+ ## Configuration
374
+
375
+ Zero config works. `cirdan.yaml` refines it — see [`cirdan.yaml.example`](cirdan.yaml.example).
376
+
377
+ ## License
378
+
379
+ Apache-2.0