Mechanisms of intramolecular transformations of carbanions generated from 2-aza-1,3,5-trienes by the action of potassium tert-butoxide, which could lead to homo-or heteroannular azacycloheptadienes, were studied by quantum-chemical methods in terms of the density functional theory. The corresponding gradient channels were localized for model 1-methylsulfanyl-1-(cyclopentylideneamino)-and 1-methylsulfanyl-1-(cyclohexylideneamino)buta-1,3-dien-2-ols. Analysis of the kinetic and thermodynamic parameters showed that carbanion generated from N-cyclopentylidenebuta-1,3-dien-1-amine undergoes rearrangement mainly into homoannular azacycloheptadiene and that analogous N-cyclohexylidene derivative gives rise to heteroannular isomer. The results of calculations were consistent with the experimental data. * For communication XV, see [1].Seven-membered nitrogen-containing heterocycles constitute structural fragments of many natural and synthetic biologically active compounds which have found wide applications in medicine and pharmacology [2]. Increased interest in these compounds stimulated search for rational ways of their synthesis, including the synthesis of new derivatives. We recently showed that 2-aza-1,3,5-trienes I available in one preparative step from α-lithiated allenes (e.g., methoxyallene or protected allenyl alcohol) and s-alkyl isothiocyanates (e.g., isopropyl isothiocyanate) (Scheme 1) [3] by the action of potassium tert-butoxide in tetrahydrofuran-dimethyl sulfoxide are readily (-30°C, 30 min) transformed into previously unknown 4,5-dihydro-3H-azepines II (Scheme 2); these results were briefly reported in [4,5].